Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch pspjuth-touch Excluding Merge-Ins
This is equivalent to a diff from 32a9cba0 to e8f2b9e9
2022-10-20
| ||
15:19 | Merge 8.7 Leaf check-in: e8f2b9e9 user: jan.nijtmans tags: pspjuth-touch | |
2022-10-18
| ||
20:15 | merge 8.6 check-in: 1bcc6791 user: fvogel tags: trunk, main | |
2022-10-13
| ||
22:28 | Merge 8.7 check-in: fd8fe7bf user: jan.nijtmans tags: pspjuth-touch | |
2020-10-27
| ||
07:08 | Rename "trunk" to "main". Add "trunk" propagating tag for backwards compatibility check-in: 0f77b70d user: jan.nijtmans tags: trunk, main | |
01:25 | Merge 8.6 Closed-Leaf check-in: 32a9cba0 user: marc_culler tags: trunk | |
2020-10-26
| ||
08:58 | Merge 8.6 check-in: 88e0ce57 user: jan.nijtmans tags: trunk | |
2020-10-25
| ||
20:11 | Adjustment for Sierra. Closed-Leaf check-in: 77a51c32 user: culler tags: bug-5cc72e002c | |
Changes to .fossil-settings/ignore-glob.
︙ | ︙ | |||
16 17 18 19 20 21 22 | */Makefile */autom4te.cache */config.cache */config.log */config.status */tkConfig.sh */wish* | | | > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | */Makefile */autom4te.cache */config.cache */config.log */config.status */tkConfig.sh */wish* */tktest */versions.vc */version.vc */libtk.vfs */libtk*.zip */tkUuid.h html macosx/configure win/Debug* win/Release* win/*.manifest win/nmhlp-out.txt win/nmakehlp.out |
︙ | ︙ |
Added .github/ISSUE_TEMPLATE.md.
> > > | 1 2 3 | Important Note ========== Please do not file issues with Tk on Github. They are unlikely to be noticed in a timely fashion. Tk issues are hosted in the [tk fossil repository on core.tcl-lang.org](https://core.tcl-lang.org/tk/tktnew); please post them there. |
Added .github/PULL_REQUEST_TEMPLATE.md.
> > > | 1 2 3 | Important Note ========== Please do not file pull requests with Tk on Github. They are unlikely to be noticed in a timely fashion. Tk issues (including patches) are hosted in the [tk fossil repository on core.tcl-lang.org](https://core.tcl-lang.org/tk/tktnew); please post them there. |
Added .github/workflows/linux-build.yml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | name: Linux on: [push] permissions: contents: read defaults: run: shell: bash working-directory: tk/unix env: ERROR_ON_FAILURES: 1 jobs: build: runs-on: ubuntu-22.04 strategy: matrix: compiler: - "gcc" - "clang" cfgopt: - "" - "CFLAGS=-DTK_NO_DEPRECATED=1" - "--disable-shared" - "--disable-xft" - "--disable-xss" - "--enable-symbols" steps: - name: Checkout uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-6-branch path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install tcl8.6-dev libxss-dev mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" --disable-zipfs >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV working-directory: "." env: CFGOPT: ${{ matrix.cfgopt }} COMPILER: ${{ matrix.compiler }} OPTS: ${{ matrix.compiler }}${{ matrix.cfgopt }} - name: Configure (opts=${{ matrix.cfgopt }}) run: | ./configure $CFGOPT "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Configure" exit 1 } - name: Build run: | make binaries libraries || { echo "::error::Failure during Build" exit 1 } - name: Build Test Harness run: | make tktest || { echo "::error::Failure during Build" exit 1 } - name: Test-Drive Installation run: | make install || { echo "::error::Failure during Install" exit 1 } - name: Create Distribution Package run: | make dist || { echo "::error::Failure during Distribute" exit 1 } - name: Convert Documentation to HTML run: | make html-tk TOOL_DIR=$TOOL_DIR || { echo "::error::Failure during Distribute" exit 1 } - name: Discover Version ID if: ${{ env.BUILD_CONFIG_ID == 'gcc' }} run: | cd /tmp/dist echo "VERSION=`ls -d tk* | sed 's/tk//'`" >> $GITHUB_ENV - name: Upload Source Distribution if: ${{ env.BUILD_CONFIG_ID == 'gcc-no' }} uses: actions/upload-artifact@v2 with: name: Tk ${{ env.VERSION }} Source distribution (snapshot) path: | /tmp/dist/tk* !/tmp/dist/tk*/html/** - name: Upload Documentation Distribution if: ${{ env.BUILD_CONFIG_ID == 'gcc-no' }} uses: actions/upload-artifact@v2 with: name: Tk ${{ env.VERSION }} HTML documentation (snapshot) path: /tmp/dist/tk*/html test: runs-on: ubuntu-20.04 strategy: matrix: compiler: - "gcc" cfgopt: - "" - "--enable-symbols" steps: - name: Checkout uses: actions/checkout@v3 with: path: tk - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install tcl8.6-dev libxss-dev xvfb libicu-dev mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6 --disable-zipfs" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV working-directory: "." env: CFGOPT: ${{ matrix.cfgopt }} COMPILER: ${{ matrix.compiler }} - name: Configure ${{ matrix.cfgopt }} run: | ./configure $CFGOPT "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Configure" exit 1 } - name: Build run: | make binaries libraries tktest || { echo "::error::Failure during Build" exit 1 } - name: Run Tests run: | xvfb-run --auto-servernum make test-classic | tee out-classic.txt xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" exit 1 } grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } |
Added .github/workflows/linux-with-tcl8-build.yml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | name: Linux (with Tcl 8.7) on: [push] permissions: contents: read defaults: run: shell: bash working-directory: tk/unix env: ERROR_ON_FAILURES: 1 jobs: build: runs-on: ubuntu-22.04 strategy: matrix: compiler: - "gcc" - "clang" cfgopt: - "" - "CFLAGS=-DTK_NO_DEPRECATED=1" - "--disable-shared" - "--disable-xft" - "--disable-xss" - "--enable-symbols" steps: - name: Checkout uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-branch path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV working-directory: "." env: CFGOPT: ${{ matrix.cfgopt }} COMPILER: ${{ matrix.compiler }} OPTS: ${{ matrix.compiler }}${{ matrix.cfgopt }} - name: Configure and Build Tcl run: | ./configure ${CFGOPT} "--prefix=$HOME/install dir" || { cat config.log echo "::warning::Failure during Tcl Configure" exit 1 } make all install || { echo "::warning::Failure during Tcl Build" exit 1 } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV working-directory: tcl/unix - name: Configure (opts=${{ matrix.cfgopt }}) run: | ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Configure" exit 1 } - name: Build run: | make binaries libraries || { echo "::error::Failure during Build" exit 1 } - name: Build Test Harness run: | make tktest || { echo "::error::Failure during Build" exit 1 } - name: Test-Drive Installation run: | make install || { echo "::error::Failure during Install" exit 1 } - name: Create Distribution Package run: | make dist || { echo "::error::Failure during Distribute" exit 1 } - name: Convert Documentation to HTML run: | make html-tk TOOL_DIR=$TOOL_DIR || { echo "::error::Failure during Distribute" exit 1 } - name: Discover Version ID if: ${{ env.BUILD_CONFIG_ID == 'gcc' }} run: | cd /tmp/dist echo "VERSION=`ls -d tk* | sed 's/tk//'`" >> $GITHUB_ENV - name: Upload Source Distribution if: ${{ env.BUILD_CONFIG_ID == 'gcc' }} uses: actions/upload-artifact@v2 with: name: Tk ${{ env.VERSION }} Source distribution (snapshot) path: | /tmp/dist/tk* !/tmp/dist/tk*/html/** - name: Upload Documentation Distribution if: ${{ env.BUILD_CONFIG_ID == 'gcc' }} uses: actions/upload-artifact@v2 with: name: Tk ${{ env.VERSION }} HTML documentation (snapshot) path: /tmp/dist/tk*/html test: runs-on: ubuntu-20.04 strategy: matrix: compiler: - "gcc" cfgopt: - "" - "--enable-symbols" steps: - name: Checkout uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-branch path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev xvfb libicu-dev mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV working-directory: "." env: CFGOPT: ${{ matrix.cfgopt }} COMPILER: ${{ matrix.compiler }} - name: Configure and Build Tcl run: | ./configure ${CFGOPT} "--prefix=$HOME/install dir" || { cat config.log echo "::warning::Failure during Tcl Configure" exit 1 } make all install || { echo "::warning::Failure during Tcl Build" exit 1 } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV working-directory: tcl/unix - name: Configure ${{ matrix.cfgopt }} run: | ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Configure" exit 1 } - name: Build run: | make binaries libraries tktest || { echo "::error::Failure during Build" exit 1 } - name: Run Tests run: | xvfb-run --auto-servernum make test-classic | tee out-classic.txt xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" exit 1 } grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } |
Added .github/workflows/linux-with-tcl9-build.yml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | name: Linux (with Tcl 9.0) on: [push] permissions: contents: read defaults: run: shell: bash working-directory: tk/unix env: ERROR_ON_FAILURES: 1 jobs: build: runs-on: ubuntu-22.04 strategy: matrix: compiler: - "gcc" - "clang" cfgopt: - "" - "CFLAGS=-DTK_NO_DEPRECATED=1" - "--disable-shared" - "--disable-xft" - "--disable-xss" - "--enable-symbols" steps: - name: Checkout uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: main path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV working-directory: "." env: CFGOPT: ${{ matrix.cfgopt }} COMPILER: ${{ matrix.compiler }} OPTS: ${{ matrix.compiler }}${{ matrix.cfgopt }} - name: Configure and Build Tcl run: | ./configure ${CFGOPT} "--prefix=$HOME/install dir" || { cat config.log echo "::warning::Failure during Tcl Configure" exit 1 } make all install || { echo "::warning::Failure during Tcl Build" exit 1 } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV working-directory: tcl/unix - name: Configure (opts=${{ matrix.cfgopt }}) run: | ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Configure" exit 1 } - name: Build run: | make binaries libraries || { echo "::error::Failure during Build" exit 1 } - name: Build Test Harness run: | make tktest || { echo "::error::Failure during Build" exit 1 } - name: Test-Drive Installation run: | make install || { echo "::error::Failure during Install" exit 1 } - name: Create Distribution Package run: | make dist || { echo "::error::Failure during Distribute" exit 1 } - name: Convert Documentation to HTML run: | make html-tk TOOL_DIR=$TOOL_DIR || { echo "::error::Failure during Distribute" exit 1 } - name: Discover Version ID if: ${{ env.BUILD_CONFIG_ID == 'gcc' }} run: | cd /tmp/dist echo "VERSION=`ls -d tk* | sed 's/tk//'`" >> $GITHUB_ENV test: runs-on: ubuntu-20.04 strategy: matrix: compiler: - "gcc" cfgopt: - "" - "--enable-symbols" steps: - name: Checkout uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: main path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev xvfb libicu-dev mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV working-directory: "." env: CFGOPT: ${{ matrix.cfgopt }} COMPILER: ${{ matrix.compiler }} - name: Configure and Build Tcl run: | ./configure ${CFGOPT} "--prefix=$HOME/install dir" || { cat config.log echo "::warning::Failure during Tcl Configure" exit 1 } make all install || { echo "::warning::Failure during Tcl Build" exit 1 } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV working-directory: tcl/unix - name: Configure ${{ matrix.cfgopt }} run: | ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Configure" exit 1 } - name: Build run: | make binaries libraries tktest || { echo "::error::Failure during Build" exit 1 } - name: Run Tests run: | xvfb-run --auto-servernum make test-classic | tee out-classic.txt xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" exit 1 } grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } |
Added .github/workflows/mac-build.yml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | name: macOS on: [push] permissions: contents: read env: ERROR_ON_FAILURES: 1 jobs: xcode: runs-on: macos-11 defaults: run: shell: bash working-directory: tk/macosx steps: - name: Check out Tk uses: actions/checkout@v3 with: path: tk - name: Check out Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-6-branch path: tcl - name: Prepare checked out repositories run: | touch tk/generic/tkStubInit.c mkdir build echo "BUILD_DIR=`cd build && pwd`" >> $GITHUB_ENV echo "DESTDIR=`cd build && pwd`" >> $GITHUB_ENV working-directory: . - name: Build Tcl run: | make all working-directory: tcl/macosx - name: Build run: | make all install || { echo "::error::Failure during Build" exit 1 } - name: Run Tests run: | make test | tee out.txt nmatches=$( grep -c "Failed 0" out.txt ) if [ $nmatches -lt 4 ] then echo "::error::Failure during Test" exit 1 fi clang: runs-on: macos-11 strategy: matrix: symbols: - 'no' - 'mem' options: - '--enable-aqua' - '--disable-aqua' defaults: run: shell: bash working-directory: tk/unix steps: - name: Check out Tk uses: actions/checkout@v3 with: path: tk - name: Check out Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-6-branch path: tcl - name: Prepare checked out repositories env: SET_DISPLAY: ${{ contains(matrix.options, '--disable-aqua') }} run: | touch tkStubInit.c mkdir "$HOME/install dir" echo "USE_XVFB=$SET_DISPLAY" >> $GITHUB_ENV working-directory: tk/generic - name: Add X11 (if required) if: ${{ env.USE_XVFB == 'true' }} run: | brew install --cask xquartz sudo /opt/X11/libexec/privileged_startx || true working-directory: . - name: Build Tcl # Note that macOS is always a 64 bit platform run: | ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Tcl Configure" exit 1 } make all || { echo "::error::Failure during Tcl Build" exit 1 } make install || { echo "::error::Failure during Tcl Install" exit 1 } working-directory: tcl/unix env: CFGOPT: --enable-symbols=${{ matrix.symbols }} - name: Configure (symbols=${{ matrix.symbols }} ${{matrix.options }}) # Note that macOS is always a 64 bit platform run: | ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" --disable-xft || { cat config.log echo "::error::Failure during Configure" exit 1 } env: CFGOPT: --enable-symbols=${{ matrix.symbols }} ${{matrix.options }} - name: Build run: | make all tktest || { echo "::error::Failure during Build" exit 1 } - name: Run Tests run: | if [ $USE_XVFB == true ]; then function runXvfb { PATH=$PATH:/opt/X11/bin Xvfb $1 & XVFB_PID=$! echo Launched Xvfb $1 as process $XVFB_PID >&2 trap "echo killing process $XVFB_PID... >&2; kill $XVFB_PID" 0 export DISPLAY=$1 sleep 2 } else function runXvfb { echo Xvfb not used, this is a --enable-aqua build } fi ( runXvfb :0; make test-classic; exit $? ) | tee out-classic.txt || { echo "::error::Failure during Test (classic)" exit 1 } ( runXvfb :0; make test-ttk; exit $? ) | tee out-ttk.txt || { echo "::error::Failure during Test (ttk)" exit 1 } cat out-classic.txt | grep -q "Failed 0" || { echo "::error::Failure in classic test results" exit 1 } cat out-ttk.txt | grep -q "Failed 0" || { echo "::error::Failure in ttk test results" exit 1 } - name: Carry out trial installation run: | make install || { cat config.log echo "::error::Failure during Install" exit 1 } |
Added .github/workflows/onefiledist.yml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | name: Build Binaries on: [push] permissions: contents: read jobs: linux: name: Linux runs-on: ubuntu-20.04 defaults: run: shell: bash env: CC: gcc CFGOPT: --disable-symbols --disable-shared steps: - name: Checkout Tk uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl 8.7 uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-branch path: tcl - name: Setup Environment run: | sudo apt-get install libxss-dev touch tcl/generic/tclStubInit.c tcl/generic/tclOOStubInit.c touch tk/generic/tkStubInit.c echo "INST_DIR=$(cd install;pwd)" >> $GITHUB_ENV echo "VER_PATH=$(cd tcl/tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV working-directory: "." - name: Configure Tcl run: | ./configure $CFGOPT --enable-zipfs --prefix=$INST_DIR working-directory: tcl/unix - name: Build & Install Tcl run: | make binaries libraries install make shell SCRIPT="$VER_PATH $GITHUB_ENV" working-directory: tcl/unix - name: Configure Tk run: | ./configure $CFGOPT --with-tcl=$INST_DIR/lib --prefix=$INST_DIR working-directory: tk/unix - name: Build & Install Tk run: | make binaries libraries install working-directory: tk/unix # TODO: need the Tk version separately for distro naming below - name: Package run: | cp bin/wish8.7 ${BUILD_NAME} chmod +x ${BUILD_NAME} tar -cf ${BUILD_NAME}.tar ${BUILD_NAME} working-directory: ${{ env.INST_DIR }} env: BUILD_NAME: wish${{ env.TCL_PATCHLEVEL }}_snapshot - name: Upload uses: actions/upload-artifact@v3 with: name: Wish ${{ env.TCL_PATCHLEVEL }} Linux single-file build (snapshot) path: ${{ env.INST_DIR }}/*.tar - name: Describe Installation Zip Contents if: ${{ always() }} run: | unzip -l wish${{ env.TCL_PATCHLEVEL }}_snapshot || true working-directory: ${{ env.INST_DIR }} macos: name: macOS runs-on: macos-11 defaults: run: shell: bash env: CC: gcc CFGOPT: --disable-symbols --disable-shared --enable-64bit steps: - name: Checkout Tk uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl 8.7 uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-branch path: tcl - name: Checkout create-dmg uses: actions/checkout@v3 with: repository: create-dmg/create-dmg ref: v1.0.8 path: create-dmg - name: Setup Environment run: | mkdir -p install/contents touch tcl/generic/tclStubInit.c tcl/generic/tclOOStubInit.c touch tk/generic/tkStubInit.c echo "INST_DIR=$(cd install;pwd)" >> $GITHUB_ENV echo "VER_PATH=$(cd tcl/tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV echo "CREATE_DMG=$(cd create-dmg;pwd)/create-dmg" >> $GITHUB_ENV echo "CFLAGS=-arch x86_64 -arch arm64e" >> $GITHUB_ENV working-directory: "." - name: Configure Tcl run: | ./configure $CFGOPT --enable-zipfs --prefix=$INST_DIR working-directory: tcl/unix - name: Build & Install Tcl run: | make binaries libraries install make shell SCRIPT="$VER_PATH $GITHUB_ENV" working-directory: tcl/unix - name: Configure Tk run: | ./configure $CFGOPT --with-tcl=$INST_DIR/lib --prefix=$INST_DIR \ --enable-aqua working-directory: tk/unix - name: Build & Install Tk run: | make binaries libraries install working-directory: tk/unix # TODO: need the Tk version separately for distro naming below - name: Package run: | cp ../tk/unix/wish contents/${BUILD_NAME} chmod +x contents/${BUILD_NAME} cat > contents/README.txt <<EOF This is a single-file executable developer preview of Tcl/Tk $TCL_PATCHLEVEL It is not intended as an official release at all, so it is unsigned and unnotarized. Use strictly at your own risk. To run it, you need to copy the executable out and run: xattr -d com.apple.quarantine ${BUILD_NAME} to mark the executable as runnable on your machine. EOF $CREATE_DMG \ --volname "TclTk $TCL_PATCHLEVEL (snapshot)" \ --window-pos 200 120 \ --window-size 800 400 \ "TclTk-$TCL_PATCHLEVEL-(snapshot).dmg" \ "contents/" working-directory: ${{ env.INST_DIR }} env: BUILD_NAME: wish${{ env.TCL_PATCHLEVEL }}_snapshot - name: Upload uses: actions/upload-artifact@v3 with: name: Wish ${{ env.TCL_PATCHLEVEL }} macOS single-file build (snapshot) path: ${{ env.INST_DIR }}/*.dmg win: name: Windows runs-on: windows-latest defaults: run: shell: msys2 {0} env: CC: gcc CFGOPT: --disable-symbols --disable-shared steps: - name: Install MSYS2 uses: msys2/setup-msys2@v2 with: msystem: MINGW64 install: git mingw-w64-x86_64-toolchain make zip - name: Checkout Tk uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl 8.7 uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-branch path: tcl - name: Setup Environment run: | mkdir -p install/combined touch tcl/generic/tclStubInit.c tcl/generic/tclOOStubInit.c touch tk/generic/tkStubInit.c echo "INST_DIR=$(cd install;pwd)" >> $GITHUB_ENV echo "VER_PATH=$(cd tcl/tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV working-directory: "." - name: Configure Tcl run: | ./configure $CFGOPT --enable-zipfs --prefix=$INST_DIR working-directory: tcl/win - name: Build & Install Tcl run: | make binaries libraries install $INST_DIR/bin/tclsh* $VER_PATH $GITHUB_ENV working-directory: tcl/win - name: Configure Tk run: | ./configure $CFGOPT --with-tcl=$INST_DIR/lib --prefix=$INST_DIR working-directory: tk/win - name: Build & Install Tk run: | make all install echo "TK_BIN=`pwd`/`echo wish*.exe`" >> $GITHUB_ENV working-directory: tk/win # TODO: need the Tk version separately for distro naming below - name: Package run: | cp ${TK_BIN} combined/${BUILD_NAME}.exe working-directory: install env: BUILD_NAME: wish${{ env.TCL_PATCHLEVEL }}_snapshot - name: Upload uses: actions/upload-artifact@v3 with: name: Wish ${{ env.TCL_PATCHLEVEL }} Windows single-file build (snapshot) path: install/combined/wish${{ env.TCL_PATCHLEVEL }}_snapshot.exe |
Added .github/workflows/win-build.yml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | name: Windows on: [push] permissions: contents: read env: ERROR_ON_FAILURES: 1 jobs: msvc: runs-on: windows-2022 defaults: run: shell: powershell working-directory: tk/win # Using powershell means we need to explicitly stop on failure strategy: matrix: symbols: - "none" - "symbols" steps: - name: Checkout Tk uses: actions/checkout@v3 with: path: tk - name: Checkout Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-branch path: tcl - name: Init MSVC uses: ilammy/msvc-dev-cmd@v1 - name: Make Install Location working-directory: tcl run: | echo "TCLDIR=`pwd`" >> $GITHUB_ENV cd .. mkdir install cd install echo "INSTALLDIR=`pwd`" >> $GITHUB_ENV - name: Build Tcl (OPTS=${{ matrix.symbols }}) run: | &nmake -f makefile.vc release install OPTS=${{ matrix.symbols }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } working-directory: tcl/win - name: Build Tk (OPTS=${{ matrix.symbols }}) run: | &nmake -f makefile.vc all OPTS=${{ matrix.symbols }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } - name: Build Test Harness (OPTS=${{ matrix.symbols }}) run: | &nmake -f makefile.vc tktest OPTS=${{ matrix.symbols }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } - name: Run Tk Tests (OPTS=${{ matrix.symbols }}) run: | nmake -f makefile.vc test-classic OPTS=${{ matrix.symbols }} | tee out-classic.txt || { echo "::error::Failure during Test" exit 1 } nmake -f makefile.vc test-ttk OPTS=${{ matrix.symbols }} | tee out-ttk.txt || { echo "::error::Failure during Test" exit 1 } grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" exit 1 } grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } env: CI_BUILD_WITH_MSVC: 1 shell: bash - name: Build Help (OPTS=${{ matrix.symbols }}) run: | &nmake -f makefile.vc htmlhelp OPTS=${{ matrix.symbols }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } - name: Install (OPTS=${{ matrix.symbols }}) run: | &nmake -f makefile.vc install OPTS=${{ matrix.symbols }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } gcc: runs-on: windows-2019 defaults: run: shell: msys2 {0} working-directory: win strategy: matrix: symbols: - "no" - "mem" - "all" steps: - name: Install MSYS2 uses: msys2/setup-msys2@v2 with: msystem: MINGW64 install: git mingw-w64-x86_64-toolchain make zip - name: Checkout Tk uses: actions/checkout@v3 - name: Checkout Tcl uses: actions/checkout@v3 with: repository: tcltk/tcl ref: core-8-6-branch path: tcl - name: Prepare run: | touch tkStubInit.c touch "${HOME}/forWinDialog-5.12.7" mkdir "${HOME}/install_dir" echo "INSTALL_DIR=${HOME}/install_dir" >> $GITHUB_ENV working-directory: generic - name: Configure and Build Tcl run: | ./configure ${CFGOPT} "--prefix=$INSTALL_DIR" || { cat config.log echo "::warning::Failure during Tcl Configure" exit 1 } make all install || { echo "::warning::Failure during Tcl Build" exit 1 } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV env: CFGOPT: --enable-64bit --enable-symbols=${{ matrix.symbols }} working-directory: tcl/win - name: Configure Tk (symbols=${{ matrix.symbols }}) run: | ./configure ${CFGOPT} "--prefix=$HOME/INSTALL_DIR" "--with-tcl=$TCL_CONFIG_PATH" || { cat config.log echo "::error::Failure during Configure" exit 1 } env: CFGOPT: --enable-64bit --enable-symbols=${{ matrix.symbols }} - name: Build Tk run: | make all tktest || { echo "::error::Failure during Build" exit 1 } - name: Run Tk Tests run: | make test-classic | tee out-classic.txt make test-ttk | tee out-ttk.txt grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" exit 1 } grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } |
Changes to .gitignore.
︙ | ︙ | |||
22 23 24 25 26 27 28 | config.status config.status.lineno html manifest.uuid _FOSSIL_ */tkConfig.sh */wish* | | | | > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | config.status config.status.lineno html manifest.uuid _FOSSIL_ */tkConfig.sh */wish* */tktest */versions.vc */version.vc */libtk.vfs */libtk*.zip */tkUuid.h libtommath/bn.ilg libtommath/bn.ind libtommath/pretty.build libtommath/tommath.src libtommath/*.log libtommath/*.pdf libtommath/*.pl |
︙ | ︙ |
Changes to .travis.yml.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 | - gcc-mingw-w64 - gcc-mingw-w64-base - gcc-mingw-w64-i686 - gcc-mingw-w64-x86-64 - gcc-multilib - tcl8.6-dev - libx11-dev - xvfb homebrew: packages: - tcl-tk | > > > > > | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - gcc-mingw-w64 - gcc-mingw-w64-base - gcc-mingw-w64-i686 - gcc-mingw-w64-x86-64 - gcc-multilib - tcl8.6-dev - libx11-dev - libnotify-dev - libglib2.0-dev - libxss-dev - xvfb homebrew: packages: - tcl-tk - libnotify - glib # casks: # - xquartz jobs: include: # Testing on Linux GCC - name: "Linux/GCC/Shared" os: linux dist: focal services: |
︙ | ︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | dist: focal services: - xvfb compiler: gcc env: - BUILD_DIR=unix - CFGOPT="--disable-xft" script: *x11gui - name: "Linux/GCC/Shared/bionic" os: linux dist: bionic services: - xvfb compiler: gcc | > > > > > > > > > > | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | dist: focal services: - xvfb compiler: gcc env: - BUILD_DIR=unix - CFGOPT="--disable-xft" script: *x11gui - name: "Linux/GCC/Shared/no-libnotify" os: linux dist: focal services: - xvfb compiler: gcc env: - BUILD_DIR=unix - CFGOPT="--disable-libnotify" script: *x11gui - name: "Linux/GCC/Shared/bionic" os: linux dist: bionic services: - xvfb compiler: gcc |
︙ | ︙ | |||
177 178 179 180 181 182 183 | - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" - name: "macOS/Clang++/Xcode 12/Shared" 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" | < < < < < < < < < < < < < < < < | | | | | | < < < < < < < < < < < < | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" - name: "macOS/Clang++/Xcode 12/Shared" 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/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" - 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" # - 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" # 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" - name: "macOS/Xcode 10/Shared" os: osx osx_image: xcode10.3 addons: homebrew: packages: - 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" - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9.4 addons: homebrew: packages: - 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" # Test on Windows with MSVC native # - name: "Windows/MSVC/Shared" # os: windows # compiler: cl # env: &vcenv # - BUILD_DIR=win # - VCDIR="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build" |
︙ | ︙ | |||
288 289 290 291 292 293 294 295 296 297 298 | - cd ${BUILD_DIR} install: - mkdir "$HOME/install dir" - ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) script: - make all tktest - make install cache: directories: - $HOME/AppData/Local/Temp/chocolatey - $HOME/AppData/Local/Apps/Tcl86 | > > > > > > > > | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | - cd ${BUILD_DIR} install: - mkdir "$HOME/install dir" - ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) script: - make all tktest - make install before_cache: - |- case $TRAVIS_OS_NAME in osx) brew cleanup ;; esac cache: directories: - $HOME/Library/Caches/Homebrew - $HOME/AppData/Local/Temp/chocolatey - $HOME/AppData/Local/Apps/Tcl86 |
Changes to ChangeLog.
︙ | ︙ | |||
3199 3200 3201 3202 3203 3204 3205 | * library/demos/mclist.tcl: Added support for arrow indicators to show which way a column is being sorted. Corrected determination of which fonts to use for measurements. 2009-03-25 Jan Nijtmans <[email protected]> * doc/wish.1: Bring doc and demos in line with | | | 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 | * library/demos/mclist.tcl: Added support for arrow indicators to show which way a column is being sorted. Corrected determination of which fonts to use for measurements. 2009-03-25 Jan Nijtmans <[email protected]> * doc/wish.1: Bring doc and demos in line with * library/demos/hello: https://wiki.tcl-lang.org/page/exec+magic * library/demos/rmt * library/demos/square * library/demos/tcolor * library/demos/timer * library/demos/widget * win/tkWinMenu.c: Eliminate a few compiler warnings on mingw * win/ttkWinXPTheme.c: Spacing |
︙ | ︙ |
Changes to README.md.
1 2 | # README: Tk | | > > > > > > > > > | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # README: Tk This is the **Tk 8.7a6** source distribution. You can get any source release of Tk from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). 8.6 (production release, daily build) [![Build Status](https://github.com/tcltk/tk/workflows/Linux/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-6-branch) [![Build Status](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-6-branch) [![Build Status](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-6-branch) <br> 8.7 (in development, daily build)) [![Build Status](https://github.com/tcltk/tk/workflows/Linux/badge.svg?branch=main)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Amain) [![Build Status](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=main)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Amain) [![Build Status](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=main)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Amain) ## <a id="intro">1.</a> Introduction This directory contains the sources and documentation for Tk, a cross-platform GUI toolkit implemented with the Tcl scripting language. For details on features, incompatibilities, and potential problems with this release, see [the Tcl/Tk 8.7 Web page](https://www.tcl-lang.org/software/tcltk/8.7.html) or refer to the "changes" file in this directory, which contains a historical record of all changes to Tk. Tk is maintained, enhanced, and distributed freely by the Tcl community. Source code development and tracking of bug reports and feature requests take place at [core.tcl-lang.org](https://core.tcl-lang.org/). Tcl/Tk release and mailing list services are [hosted by SourceForge](https://sourceforge.net/projects/tcl/) with the Tcl Developer Xchange hosted at [www.tcl-lang.org](https://www.tcl-lang.org). Tk is a freely available open-source package. You can do virtually anything you like with it, such as modifying it, redistributing it, and selling it either in whole or in part. See the file `license.terms` for complete information. ## <a id="tcl">2.</a> See Tcl README.md Please see the README.md file that comes with the associated Tcl release |
︙ | ︙ |
Changes to changes.
︙ | ︙ | |||
7433 7434 7435 7436 7437 7438 7439 | 2017-03-21 (TIP 442) display text in a progressbar (zaumseil) 2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) 2017-08-28 (TIP 166) Extended color notation for alpha channel (bachmann) | | | 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 | 2017-03-21 (TIP 442) display text in a progressbar (zaumseil) 2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) 2017-08-28 (TIP 166) Extended color notation for alpha channel (bachmann) --- Released 8.7a1, September 8, 2017 --- https://core.tcl-lang.org/tk/ for details 2017-08-24 (bug)[f1a3ca] Memory leak in [text] B-tree (edhume3) 2017-08-24 (bug)[ee40fd] Report [console] init errors (the) 2017-08-24 (bug)[3295446] Improve history visibility in [console] (goth) |
︙ | ︙ | |||
7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 | 2019-11-17 [90d555] workaround NSFontManager bad selections (culler) 2019-11-19 (new) Partial Emoji support in text displays (nijtmans,culler) - Released 8.6.10, Nov 21, 2019 - https://core.tcl-lang.org/tk/ for details Changes to 8.7a3 include all changes to the 8.6 line through 8.6.10, plus the following, which focuses on the high-level feature changes in this changeset (new minor version) rather than bug fixes: 2017-11-25 [TIP 161] $menu -tearoff default changed to false (roseman,vogel) *** POTENTIAL INCOMPATIBILITY *** 2017-12-07 [TIP 487] End support for pre-XP Windows (nijtmans) 2018-03-04 [TIP 489] New subcommand [$canvas image] (pitcher,vogel) 2018-05-13 [TIP 496] New options -placeholder* for entries (zaumseil,vogel) 2018-09-23 [TIP 517] New option -activerelief for menus (vogel) 2018-11-03 [TIP 512] Deprecate stub for Tk_MainEx() (nijtmans) 2018-11-06 [TIP 415] New option -height for [$canvas create arc] (geard) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 | 2019-11-17 [90d555] workaround NSFontManager bad selections (culler) 2019-11-19 (new) Partial Emoji support in text displays (nijtmans,culler) - Released 8.6.10, Nov 21, 2019 - https://core.tcl-lang.org/tk/ for details 2019-11-25 (bug)[a95373] TkKeyEvent platform variations (werner) 2019-11-26 (bug) workaround Win bug so test bind-34.3 passes (nijtmans) 2019-12-03 Aqua: white cursors in dark mode (culler) 2019-12-04 (bug)[749bd9] Aqua: systemControlAccentColor (bll,culler) 2019-12-14 (bug)[b3b56a] ttk respect -cursor option (vogel) 2019-12-14 (bug)[b094cb] Win: $tv -show grows widget width 1 pixel (vogel) 2019-12-14 (bug)[02a694] spinbox options used wrong db names (vogel) 2020-01-11 (bug)[2b8fa6] MouseWheel for ttk::scrollbar (oehlmann) 2020-01-18 (bug)[1771594] icursor and scrollregion, canvText-14.7 (vogel) 2020-01-18 (bug)[587937] tag list ops preserve list order (vogel) 2020-01-18 (bug)[2830360] lose invalid state at focus event, entry-10.1 (vogel) 2020-01-18 (bug)[077d49] string table options support null ok (vogel) 2020-01-18 (bug)[bf93d0] Aqua: unresponsive menubar (culler) 2020-01-31 (bug)[a196fb] restore support for unthreaded Tcl (porter,sebres) 2020-02-09 (bug)[90a4d7] fontconfig crash when no font installed (vogel) 2020-02-24 (bug) Aqua: incomplete floating window display (walzer) 2020-03-11 (bug)[fb2ec3] OSX 10.15+: full screen options (nicolas,walzer) 2020-03-12 (bug)[08e2f8] focus on unmapped windows, focus-7.1 (vogel) 2020-03-12 (bug)[2edd84] [$c postscript] result management (gavilan) 2020-03-22 (bug)[98662d] restore TK_MAC_DEBUG_DRAWING build (chavez) 2020-03-29 (bug)[655fe2] tearoff menu redraw artifacts (vogel) 2020-04-03 (bug)[efbedd] Aqua: compund button-like widget appearance (chavez) 2020-04-14 (bug)[87bade] Aqua: improved dealing with PressAndHold (culler) 2020-04-14 (bug)[376788] X: stop crash w/Noto Color Emoji font (nijtmans) 2020-04-15 (bug)[89354d] Aqua: text color w/o clipping (culler) 2020-04-15 (new) Aqua: assign Button 3 to the middle button (chavez) 2020-04-25 (bug)[3519111] treeview horizontal scroll, entry-2.1.1 (vogel) 2020-04-25 (bug)[141881] treeview vertical scroll, treeview-9.2 (vogel) 2020-05-01 (bug)[2712f4] X: crash angled text w/o Xft, canvText-20.2 (vogel) 2020-05-01 (bug)[cd8714] Win: long angled text (chavez) 2020-05-09 (bug)[88c9e0] treeview -selectmode none focus ring (gavilan) 2020-05-12 (new) Aqua: Rewrite of the Key event system (culler) 2020-05-12 (bug)[411359] Aqua: stop crashes/zombies related to TouchBar (culler) 2020-05-12 (new) Aqua: systemLinkColor (chavez) 2020-05-16 (bug)[40ada9] crash when active button is destroyed (chavez) 2020-05-28 (bug)[3c6660,601cea,4b50b7] Win10: ttk scale (nemethi,lanam) 2020-06-08 (bug)[2790615] Some callbacks not eval'd in global scope (nijtmans) 2020-06-25 Aqua: Update OSX version tests to support Big Sur (culler) 2020-06-27 (bug)[6920b2] dup in spinbox -values causes trouble (lanam) 2020-06-27 (bug)[5c51be] invalid mem read buffer in Tk_PhotoPut* (chavez) 2020-06-27 (bug)[16ef16] restore bind sequence support, bind-33.(16-21) (vogel) 2020-07-02 (bug)[2d2459] default style for combobox (bll) 2020-07-06 (bug)[40e4bf] double free, entry-19.21 (vogel) 2020-07-06 (bug)[e3888d] grab & warp, bind-36.1 (vogel) 2020-07-12 (bug)[2442314] fontchooser i18n (nijtmans) 2020-07-13 (bug)[7655f6] [*entry]: selected text drawing reform (chavez) 2020-07-14 (bug)[09abd7] workaround invalid key codes from Debian 10 (vogel) 2020-07-20 (bug)[cf3853] Aqua: improve bounds on non-Retina displays (chavez) 2020-08-01 Aqua: [winfo rgb] light and dark mode support (culler) 2020-08-15 (bug)[315104] Aqua: appearance change virtual events (culler) 2020-08-21 (bug)[291699] mouse binding for scrollbar grip (bll) 2020-09-08 (bug)[6c2425] buffer bounds violation (chavez) 2020-09-08 (bug)[2a6d63] OSX 10.6 crash (hellstrom,culler) 2020-09-08 (bug)[420feb] undefined behavior due to alignment (chavez,nijtmans) 2020-09-10 (bug)[ab1fea] Aqua init issues (culler) 2020-09-14 (bug)[71e18c] Aqua: crash in full screen toggle (culler) 2020-09-18 (bug)[4f4f03] Aqua: mouse drags across title bar (nab,culler) 2020-09-21 (bug)[d91e05] select/copy in disabled text (bll) 2020-09-27 (TIP #581) disfavor Master/Slave terminology (nijtmans) 2020-09-30 (bug)[59cba3] win: improve theme detection (bll,nijtmans) 2020-10-06 (bug)[175a6e] Aqua: support tiled windows (culler) 2020-10-07 (bug)[1fa8c3] Aqua: crash on resize during display (nab,culler) 2020-10-16 (bug)[c2483b] Aqua: consistent finalization (culler,nijtmans) 2020-11-06 (bug)[c9ebac] Aqua: use standard about dialog (culler) 2020-11-07 (bug)[4ebcc0] sticky fontchooser options (roseman,vogel) 2020-11-10 (bug)[f9fa92] Aqua: crash in color caching scheme (culler) 2020-11-20 (bug)[7185d2] Aqua: fixes to special menu support (culler) 2020-11-24 (bug)[4a40c6] Aqua: [wm manage] frame offset (chavez) 2020-12-04 (bug)[3ef77f] Aqua dark mode combobox focus ring (walzer,culler) 2020-12-15 (bug)[80e4c6] Aqua: progressbar animation (nab,culler) 2020-12-24 (bug)[6157a8] Aqua: file dialog -filetypes (davis,culler) - Released 8.6.11, Dec 31, 2020 - https://core.tcl-lang.org/tk/ for details 2021-01-04 (bug)[19fb7a] Mac: [tk_messageBox] use proper icons (ericwb,culler) 2021-01-11 (bug)[7beaed] ttk::bindMouseWheel syntax error (nemethi) 2021-01-15 (new) support 4 new keycodes: CodeInput, SingleCandidate, MultipleCandidate, PreviousCandidate (nijtmans) 2021-01-18 (new) Portable keycodes: OE, oe, Ydiaeresis (nijtmans) 2021-01-27 (bug)[bdcab8] Mac crash on non-BMP menu label (nab,culler) 2021-02-07 (bug)[9e1312] <Enter> to parent after child destroyed (leunissen) 2021-02-10 (bug)[d3cd4c] more robust notebook processing (nemethi) 2021-02-25 (bug)[234ee4] crash in [clipboard get] invalid encoding (nijtmans) 2021-02-25 (bug)[be9cad] Poor trace housekeeping -> tkwait segfault (michael) 2021-03-02 (bug)[1626ed] Mac: crash with dead key as menu accelerator (culler) 2021-03-22 (bug)[9b6065] restore Tcl [update], see window-2.12 (leunissen) 2021-04-07 (bug)[58222c] Mac: entry and spinbox bg colors (chavez,culler) 2021-04-18 (bug)[34db75,ea876b] cursor motion in peer text (vogel) 2021-04-26 (bug)[c97464] memleak in TkpDrawAngledChars (nab,culler) 2021-04-29 Mac: explicit backing CALayer to fix rendering issues (culler) 2021-05-02 Mac: respect key repeat system setting (culler) 2021-05-10 (bug)[171ba7] crash when grab and focus are not coordinated (culler) 2021-05-24 crash due to failed transient record housekeeping (culler) 2021-05-25 (bug)[7bda98] Mac: <Double-1> bindings fire twice on app activation 2021-06-03 (bug)[4401d3] Mac: improved support of pixel formats (chavez,culler) 2021-06-03 (bug)[8ecc3e] Mac: window exposed by Mission Control (chavez,culler) 2021-06-04 (bug)[099109] segfault reusing a container toplevel (culler) 2021-06-22 (bug)[4efbfe] static package init order in wish (werner) 2021-09-21 (bug)[033886] Win: hang in font loading (e-paine,vogel) 2021-10-14 (bug)[8ebed3] multi-thread safety in Xft use (werner) 2021-10-22 (new)[TIP 608] New virtual event <<TkWorldChanged>> (griffin) 2021-10-27 (bug) file dialog compatibility with Mac OS 12 (culler) 2021-10-29 (bug) Mac: stop crash when non-Tk windows go full screen (werner) 2021-10-30 (bug)[6ea0b3] Mac: grab from menu makes dead window (culler) - Released 8.6.12, Nov 5, 2021 - https://core.tcl-lang.org/tk/ for details Changes to 8.7a3 include all changes to the 8.6 line through 8.6.10, plus the following, which focuses on the high-level feature changes in this changeset (new minor version) rather than bug fixes: 2017-11-25 [TIP 161] $menu -tearoff default changed to false (roseman,vogel) *** POTENTIAL INCOMPATIBILITY *** 2017-12-07 [TIP 487] End support for pre-XP Windows (nijtmans) 2018-03-04 [TIP 489] New subcommand [$canvas image] (pitcher,vogel) 2018-05-13 [TIP 496] New options -placeholder* for entries (zaumseil,vogel) 2018-09-23 [TIP 517] New option -activerelief for menus (vogel) 2018-11-03 [TIP 512] Deprecate stub for Tk_MainEx() (nijtmans) 2018-11-06 [TIP 415] New option -height for [$canvas create arc] (geard) 2018-11-06 [TIP 518] New event <<NoManagedChild>> (oehlmann) 2019-04-14 [TIP 164] New subcommand [$canvas rotate] (fellows) 2019-04-14 [TIP 507] New photo image format 'svg' (zaumseil) 2019-04-14 [TIP 483] Record more configuration items (cassoff) 2019-04-14 [TIP 482] Record configured directory for demos (cassoff) 2019-05-25 [TIP 262] New frame options -backgroundimage, -tile (fellows) 2019-06-15 [TIP 528] Deprecate Tk_Offset() (nijtmans) 2019-08-19 [TIP 545] Revised options for photo image format 'svg' (oehlmann) --- Released 8.7a3, November 25, 2019 --- https://core.tcl-lang.org/tk/ for details Changes to 8.7a5 include all changes to the 8.6 line through 8.6.11, plus the following, which focuses on the high-level feature changes in this changeset (new minor version) rather than bug fixes: 2020-02-22 [TIP 565] Gracefully ignore non-existent tags in canvas raise/lower 2020-02-22 [TIP 564] Specify ttk font sizes in points on X11 2020-02-24 [TIP 563] Scrollwheel on Horizontal Scrollbar Scrolls Without Shift too 2020-02-28 [TIP 557] C++ support 2020-03-12 (bug)[355180] solve XKeycodeToKeysym deprecation *** POTENTIAL INCOMPATIBILITY -- Tk 8.7 now requires X11R6 *** 2020-03-18 [TIP 569] Eliminate comments that serve lint 2020-05-17 [d87dc2] Remove TkMacOSXGetStringObjFromCFString() 2020-05-24 [TIP 574] Add a 'tag delete' command to the ttk::treeview widget 2020-06-27 (bug)[50ed1e] spinbox with duplicate values 2020-07-03 [TIP 578] Death to TCL_DBGX 2020-08-23 (bug)[bb85d2] valgrind on TIP 489 2020-08024 (bug)[d30c21] default colors for TIP 496 2020-09-02 [TIP 580] Export Tk_GetDoublePixelsFromObj and 5 more 2020-10-21 [TIP 474] Uniform mouse wheel events 2020-11-15 [TIP 584] Better introspection for ttk 2020-11-16 [TIP 588] Unicode for (X11) keysyms 2020-12-03 [TIP 590] Recommend lowercase package names 2020-12-09 (bug)[d6e9b4] SVG memory overflow 2020-12-11 [TIP 591] Rotate ttk::notebook window with mousewheel on tab 2020-12-12 [TIP 325] System tray and system notification 2021-01-08 [TIP 592] End support: Windows XP, Server 2003, Vista, Server 2008 2021-01-08 (bug)[822330] Prevent buffer overflow in SVG image. 2021-01-28 (bug)[237971] 'end' argument to [$canvas insert] 2021-02-25 (bug)[be9cad] crash in [tkwait] 2021-02-27 [TIP 529] Add metadata dictionary property to tk photo image 2021-03-02 (bug)[1626ed] Aqua crash: dead keys as meny accelerator 2021-03-29 (bug)[9b6065] Restore Tcl [update] when Tk is destroyed 2021-04-08 (bug)[58222c] background colors 2021-04-09 [TIP 595] Unicode-aware/case-sensitive Loadable Library handling 2021-04-21 (bug)[cde766] update scrollbars on treeview 2021-04-26 (bug)[c97464] memleak in aqua fonts 2021-05-02 (bug)[2ecb09] Follow Mac OSX Key-repeat setting 2021-05-03 (bug)[8a5086] ttk::entry issue 2021-05-22 (bug)[3e3360] bind substitution %S 2021-05-25 (bug)[7bda98] aqua: double click bind with changing focus - Released 8.7a5, Jun 18, 2021 --- https://core.tcl-lang.org/tcl/ for details - |
Changes to doc/3DBorder.3.
1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_Alloc3DBorderFromObj 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME | | > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_Alloc3DBorderFromObj 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_Alloc3DBorderFromObj, Tk_ClipDrawableToRect, Tk_DrawHighlightBorder, Tk_Get3DBorder, fBTk_Get3DBorderColors, Tk_Get3DBorderFromObj, Tk_Draw3DRectangle, Tk_Fill3DRectangle, Tk_Draw3DPolygon, Tk_Fill3DPolygon, Tk_3DVerticalBevel, Tk_3DHorizontalBevel, Tk_SetBackgroundFromBorder, Tk_NameOf3DBorder, Tk_3DBorderColor, Tk_3DBorderGC, Tk_Free3DBorderFromObj, Tk_Free3DBorder \- draw borders with three-dimensional appearance .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_3DBorder \fBTk_Alloc3DBorderFromObj(\fIinterp, tkwin, objPtr\fB)\fR .sp void \fBTk_ClipDrawableToRect(\fIdisplay, drawable, x, y, width, height\fB)\fR .sp void \fBTk_DrawHighlightBorder(\fItkwin, fgGC, bgGC, highlightWidth, drawable\fB)\fR .sp Tk_3DBorder \fBTk_Get3DBorder(\fIinterp, tkwin, colorName\fB)\fR .sp void \fBTk_Get3DBorderColors(\fIborder, bgColorPtr, darkColorPtr, lightColorPtr\fB)\fR .sp Tk_3DBorder \fBTk_Get3DBorderFromObj(\fItkwin, objPtr\fB)\fR .sp void \fBTk_Draw3DRectangle(\fItkwin, drawable, border, x, y, width, height, borderWidth, relief\fB)\fR .sp void |
︙ | ︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | Width of rectangle describing border or bevel, in pixels. .AP int height in Height of rectangle describing border or bevel, in pixels. .AP int borderWidth in Width of border in pixels. Positive means border is inside rectangle given by \fIx\fR, \fIy\fR, \fIwidth\fR, \fIheight\fR, negative means border is outside rectangle. .AP int relief in Indicates 3-D position of interior of value relative to exterior; should be \fBTK_RELIEF_RAISED\fR, \fBTK_RELIEF_SUNKEN\fR, \fBTK_RELIEF_GROOVE\fR, \fBTK_RELIEF_SOLID\fR, or \fBTK_RELIEF_RIDGE\fR (may also be \fBTK_RELIEF_FLAT\fR for \fBTk_Fill3DRectangle\fR). .AP XPoint *pointPtr in Pointer to array of points describing the set of vertices in a polygon. | > > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | Width of rectangle describing border or bevel, in pixels. .AP int height in Height of rectangle describing border or bevel, in pixels. .AP int borderWidth in Width of border in pixels. Positive means border is inside rectangle given by \fIx\fR, \fIy\fR, \fIwidth\fR, \fIheight\fR, negative means border is outside rectangle. .AP int highlightWidth in Width of ring around the outside of the widget if the widget has received the input focus. .AP int relief in Indicates 3-D position of interior of value relative to exterior; should be \fBTK_RELIEF_RAISED\fR, \fBTK_RELIEF_SUNKEN\fR, \fBTK_RELIEF_GROOVE\fR, \fBTK_RELIEF_SOLID\fR, or \fBTK_RELIEF_RIDGE\fR (may also be \fBTK_RELIEF_FLAT\fR for \fBTk_Fill3DRectangle\fR). .AP XPoint *pointPtr in Pointer to array of points describing the set of vertices in a polygon. |
︙ | ︙ | |||
129 130 131 132 133 134 135 136 137 138 139 140 141 142 | right than the top. .AP int topBevel in Non-zero means this bevel forms the top side of the value; zero means it forms the bottom side. .AP int which in Specifies which of the border's graphics contexts is desired. Must be \fBTK_3D_FLAT_GC\fR, \fBTK_3D_LIGHT_GC\fR, or \fBTK_3D_DARK_GC\fR. .BE .SH DESCRIPTION .PP These procedures provide facilities for drawing window borders in a way that produces a three-dimensional appearance. \fBTk_Alloc3DBorderFromObj\fR allocates colors and Pixmaps needed to draw a border in the window | > > > > > > > > > > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | right than the top. .AP int topBevel in Non-zero means this bevel forms the top side of the value; zero means it forms the bottom side. .AP int which in Specifies which of the border's graphics contexts is desired. Must be \fBTK_3D_FLAT_GC\fR, \fBTK_3D_LIGHT_GC\fR, or \fBTK_3D_DARK_GC\fR. .AP XColor *bgColorPtr out Pointer to location in which to store the background color of the given border. .AP XColor *darkColorPtr out Pointer to location in which to store the color for darker areas of the given border. .AP XColor *lightColorPtr out Pointer to location in which to store the color for lighter areas of the given border. .AP GC fgGC in Foreground X graphics context. .AP GC fgGC in Background X graphics context. .BE .SH DESCRIPTION .PP These procedures provide facilities for drawing window borders in a way that produces a three-dimensional appearance. \fBTk_Alloc3DBorderFromObj\fR allocates colors and Pixmaps needed to draw a border in the window |
︙ | ︙ | |||
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | for the border (e.g. a bogus color name was given) then NULL is returned and an error message is left as the result of interpreter \fIinterp\fR. If it returns successfully, \fBTk_Alloc3DBorderFromObj\fR caches information about the return value in \fIobjPtr\fR, which speeds up future calls to \fBTk_Alloc3DBorderFromObj\fR with the same \fIobjPtr\fR and \fItkwin\fR. .PP \fBTk_Get3DBorder\fR is identical to \fBTk_Alloc3DBorderFromObj\fR except that the color is specified with a string instead of a value. This prevents \fBTk_Get3DBorder\fR from caching the return value, so \fBTk_Get3DBorder\fR is less efficient than \fBTk_Alloc3DBorderFromObj\fR. .PP \fBTk_Get3DBorderFromObj\fR returns the token for an existing border, given the window and color name used to create the border. \fBTk_Get3DBorderFromObj\fR does not actually create the border; it must already have been created with a previous call to \fBTk_Alloc3DBorderFromObj\fR or \fBTk_Get3DBorder\fR. The return value is cached in \fIobjPtr\fR, which speeds up | > > > > > > > > > > > > > | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | for the border (e.g. a bogus color name was given) then NULL is returned and an error message is left as the result of interpreter \fIinterp\fR. If it returns successfully, \fBTk_Alloc3DBorderFromObj\fR caches information about the return value in \fIobjPtr\fR, which speeds up future calls to \fBTk_Alloc3DBorderFromObj\fR with the same \fIobjPtr\fR and \fItkwin\fR. .PP \fBTk_ClipDrawableToRect\fR will clip all drawing into the drawable d to the given rectangle. If width or height are negative, reset to no clipping. Subsequent drawing into d is offset and clipped as specified. The function is only used when \fBTK_NO_DOUBLE_BUFFERING\fR is specified at compile time. .PP \fBTk_DrawHighlightBorder\fR draws a rectangular ring around the outside of a widget to indicate that it has received the input focus. On the Macintosh, this puts a 1 pixel border in the bgGC color between the widget and the focus ring, except in the case where highlightWidth is 1, in which case the border is left out. For proper Mac L&F, use highlightWidth of 3. .PP \fBTk_Get3DBorder\fR is identical to \fBTk_Alloc3DBorderFromObj\fR except that the color is specified with a string instead of a value. This prevents \fBTk_Get3DBorder\fR from caching the return value, so \fBTk_Get3DBorder\fR is less efficient than \fBTk_Alloc3DBorderFromObj\fR. .PP \fBTk_Get3DBorderColors\fR returns the used colors of the given border. .PP \fBTk_Get3DBorderFromObj\fR returns the token for an existing border, given the window and color name used to create the border. \fBTk_Get3DBorderFromObj\fR does not actually create the border; it must already have been created with a previous call to \fBTk_Alloc3DBorderFromObj\fR or \fBTk_Get3DBorder\fR. The return value is cached in \fIobjPtr\fR, which speeds up |
︙ | ︙ |
Changes to doc/AddOption.3.
1 | '\" | | > > > > > > > | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_AddOption 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_AddOption \- Add an option to the option database .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp void \fBTk_AddOption\fR(\fItkwin, name, value, priority\fR) .sp void \fBTk_GetSystemDefault\fR(\fItkwin, dbName, className\fR) .SH ARGUMENTS .AP Tk_Window tkwin in Token for window. .AP "const char" *name in Multi-element name of option. .AP "const char" *value in Value of option. .AP "const char" *dbName in The option database name. .AP "const char" *className in The name of the option class. .AP int priority in Overall priority level to use for option. .BE .SH DESCRIPTION .PP \fBTk_AddOption\fR is invoked to add an option to the database associated with \fItkwin\fR's main window. \fIName\fR contains the option being specified and consists of names and/or classes separated by asterisks or dots, in the usual X format. \fIValue\fR contains the text string to associate with \fIname\fR; this value will be returned in calls to \fBTk_GetOption\fR. \fIPriority\fR specifies the priority of the value; when options are queried using \fBTk_GetOption\fR, the value with the highest priority is returned. \fIPriority\fR must be between 0 and \fBTK_MAX_PRIO\fR. Some common priority values are: .IP 20 Used for default values hard-coded into widgets. .IP 40 Used for options specified in application-specific startup files. .IP 60 Used for options specified in user-specific defaults files, such as \fB.Xdefaults\fR, resource databases loaded into the X server, or user-specific startup files. .IP 80 Used for options specified interactively after the application starts running. \fBTk_GetSystemDefault\fR return a Tk_Uid string representation of the given \fIdbname\fR and \fIclassName\fR of a configuration option. Returns NULL if there are no system defaults that match this pair. .SH KEYWORDS class, name, option, add |
Changes to doc/CrtPhImgFmt.3.
1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1994 The Australian National University '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" Author: Paul Mackerras ([email protected]), '\" Department of Computer Science, '\" Australian National University. '\" | | > > > > | > > > > | > > > > > | | | | > | | | | | | | | > | | > > | > > | > > | | | > > | > > > | > > > | | > | > | | > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | '\" '\" Copyright (c) 1994 The Australian National University '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" Author: Paul Mackerras ([email protected]), '\" Department of Computer Science, '\" Australian National University. '\" .TH Tk_CreatePhotoImageFormat 3 8.7 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreatePhotoImageFormat \- define new file format for photo images .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp .VS 8.7 \fBTk_CreatePhotoImageFormatVersion3\fR(\fIformatVersion3Ptr\fR) .VE 8.7 .sp \fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR) .SH ARGUMENTS .AS "const Tk_PhotoImageFormatVersion3" *formatVersion3Ptr .VS 8.7 .AP "const Tk_PhotoImageFormatVersion3" *formatVersion3Ptr in Structure that defines the new file format including metadata functionality. .VE 8.7 .AP "const Tk_PhotoImageFormat" *formatPtr in Structure that defines the new file format. .BE .SH DESCRIPTION .PP \fBTk_CreatePhotoImageFormatVersion3\fR is invoked to define a new file format for image data for use with photo images. The code that implements an image file format is called an image file format handler, or handler for short. The photo image code maintains a list of handlers that can be used to read and write data to or from a file. Some handlers may also support reading image data from a string or converting image data to a string format. The user can specify which handler to use with the \fB\-format\fR image configuration option or the \fB\-format\fR option to the \fBread\fR and \fBwrite\fR photo image subcommands. .PP The alternate version 2 function \fBTk_CreatePhotoImageFormat\fR has identical functionality, but does not allow the handler to get or return the metadata dictionary of the image. It is described in section \fBVERSION 2 INTERFACE\fR below. .PP An image file format handler consists of a collection of procedures plus a \fBTk_PhotoImageFormatVersion3\fR structure, which contains the name of the image file format and pointers to six procedures provided by the handler to deal with files and strings in this format. The Tk_PhotoImageFormatVersion3 structure contains the following fields: .VS 8.7 .CS typedef struct Tk_PhotoImageFormatVersion3 { const char *\fIname\fR; Tk_ImageFileMatchProcVersion3 *\fIfileMatchProc\fR; Tk_ImageStringMatchProcVersion3 *\fIstringMatchProc\fR; Tk_ImageFileReadProcVersion3 *\fIfileReadProc\fR; Tk_ImageStringReadProcVersion3 *\fIstringReadProc\fR; Tk_ImageFileWriteProcVersion3 *\fIfileWriteProc\fR; Tk_ImageStringWriteProcVersion3 *\fIstringWriteProc\fR; } \fBTk_PhotoImageFormatVersion3\fR; .CE .VE 8.7 .PP The handler need not provide implementations of all six procedures. For example, the procedures that handle string data would not be provided for a format in which the image data are stored in binary, and could therefore contain null characters. If any procedure is not implemented, the corresponding pointer in the Tk_PhotoImageFormat structure should be set to NULL. The handler must provide the \fIfileMatchProc\fR procedure if it provides the \fIfileReadProc\fR procedure, and the \fIstringMatchProc\fR procedure if it provides the \fIstringReadProc\fR procedure. .SS NAME .PP \fIformatPtr->name\fR provides a name for the image type. Once \fBTk_CreatePhotoImageFormatVersion3\fR returns, this name may be used in the \fB\-format\fR photo image configuration and subcommand option. The manual page for the photo image (photo(n)) describes how image file formats are chosen based on their names and the value given to the \fB\-format\fR option. The first character of \fIformatPtr->name\fR must not be an uppercase character from the ASCII character set (that is, one of the characters \fBA\fR-\fBZ\fR). Such names are used only for legacy interface support (see below). .VS 8.7 .SS FILEMATCHPROC .PP \fIformatPtr->fileMatchProc\fR provides the address of a procedure for Tk to call when it is searching for an image file format handler suitable for reading data in a given file. \fIformatPtr->fileMatchProc\fR must match the following prototype: .CS typedef int \fBTk_ImageFileMatchProcVersion3\fR( Tcl_Interp *\fIinterp\fR, Tcl_Channel \fIchan\fR, const char *\fIfileName\fR, Tcl_Obj *\fIformat\fR, Tcl_Obj *\fImetadataIn\fR, int *\fIwidthPtr\fR, int *\fIheightPtr\fR, Tcl_Obj *\fImetadataOut\fR); .CE The \fIfileName\fR argument is the name of the file containing the image data, which is open for reading as \fIchan\fR. The \fIformat\fR argument contains the value given for the \fB\-format\fR option, or NULL if the option was not specified. \fBmetadataIn\fR and \fBmetadataOut\fR inputs and returns a metadata dictionary as described in section \fBMETADATA INTERFACE\fR below. If the data in the file appears to be in the format supported by this handler, the \fIformatPtr->fileMatchProc\fR procedure should store the width and height of the image in *\fIwidthPtr\fR and *\fIheightPtr\fR respectively, and return 1. Otherwise it should return 0. .SS STRINGMATCHPROC .PP \fIformatPtr->stringMatchProc\fR provides the address of a procedure for Tk to call when it is searching for an image file format handler suitable for reading data from a given string. \fIformatPtr->stringMatchProc\fR must match the following prototype: .CS typedef int \fBTk_ImageStringMatchProcVersion3\fR( Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIdata\fR, Tcl_Obj *\fIformat\fR, Tcl_Obj *\fImetadataIn\fR, int *\fIwidthPtr\fR, int *\fIheightPtr\fR, Tcl_Obj *\fImetadataOut\fR); .CE The \fIdata\fR argument points to the object containing the image data. The \fIformat\fR argument contains the value given for the \fB\-format\fR option, or NULL if the option was not specified. \fBmetadataIn\fR and \fBmetadataOut\fR inputs and returns a metadata dictionary as described in section \fBMETADATA INTERFACE\fR below. If the data in the string appears to be in the format supported by this handler, the \fIformatPtr->stringMatchProc\fR procedure should store the width and height of the image in *\fIwidthPtr\fR and *\fIheightPtr\fR respectively, and return 1. Otherwise it should return 0. .SS FILEREADPROC .PP \fIformatPtr->fileReadProc\fR provides the address of a procedure for Tk to call to read data from an image file into a photo image. \fIformatPtr->fileReadProc\fR must match the following prototype: .CS typedef int \fBTk_ImageFileReadProc\fR( Tcl_Interp *\fIinterp\fR, Tcl_Channel \fIchan\fR, const char *\fIfileName\fR, Tcl_Obj *\fIformat\fR, Tcl_Obj *\fImetadataIn\fR, PhotoHandle \fIimageHandle\fR, int \fIdestX\fR, int \fIdestY\fR, int \fIwidth\fR, int \fIheight\fR, int \fIsrcX\fR, int \fIsrcY\fR, Tcl_Obj *\fImetadataOut\fR); .CE The \fIinterp\fR argument is the interpreter in which the command was invoked to read the image; it should be used for reporting errors. The image data is in the file named \fIfileName\fR, which is open for reading as \fIchan\fR. The \fIformat\fR argument contains the value given for the \fB\-format\fR option, or NULL if the option was not specified. The image data in the file, or a subimage of it, is to be read into the photo image identified by the handle \fIimageHandle\fR. The subimage of the data in the file is of dimensions \fIwidth\fR x \fIheight\fR and has its top-left corner at coordinates (\fIsrcX\fR,\fIsrcY\fR). It is to be stored in the photo image with its top-left corner at coordinates (\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure. \fBmetadataIn\fR and \fBmetadataOut\fR inputs and returns a metadata dictionary as described in section \fBMETADATA INTERFACE\fR below. The return value is a standard Tcl return value. .SS STRINGREADPROC .PP \fIformatPtr->stringReadProc\fR provides the address of a procedure for Tk to call to read data from a string into a photo image. \fIformatPtr->stringReadProc\fR must match the following prototype: .CS typedef int \fBTk_ImageStringReadProc\fR( Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIdata\fR, Tcl_Obj *\fIformat\fR, Tcl_Obj *\fImetadataIn\fR, PhotoHandle \fIimageHandle\fR, int \fIdestX\fR, int \fIdestY\fR, int \fIwidth\fR, int \fIheight\fR, int \fIsrcX\fR, int \fIsrcY\fR, Tcl_Obj *\fImetadataOut\fR); .CE The \fIinterp\fR argument is the interpreter in which the command was invoked to read the image; it should be used for reporting errors. The \fIdata\fR argument points to the image data in object form. The \fIformat\fR argument contains the value given for the \fB\-format\fR option, or NULL if the option was not specified. The image data in the string, or a subimage of it, is to be read into the photo image identified by the handle \fIimageHandle\fR. The subimage of the data in the string is of dimensions \fIwidth\fR x \fIheight\fR and has its top-left corner at coordinates (\fIsrcX\fR,\fIsrcY\fR). It is to be stored in the photo image with its top-left corner at coordinates (\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure. \fBmetadataIn\fR and \fBmetadataOut\fR inputs and returns a metadata dictionary as described in section \fBMETADATA INTERFACE\fR below. The return value is a standard Tcl return value. .SS FILEWRITEPROC .PP \fIformatPtr->fileWriteProc\fR provides the address of a procedure for Tk to call to write data from a photo image to a file. \fIformatPtr->fileWriteProc\fR must match the following prototype: .CS typedef int \fBTk_ImageFileWriteProc\fR( Tcl_Interp *\fIinterp\fR, const char *\fIfileName\fR, Tcl_Obj *\fIformat\fR, Tcl_Obj *\fImetadataIn\fR, Tk_PhotoImageBlock *\fIblockPtr\fR); .CE The \fIinterp\fR argument is the interpreter in which the command was invoked to write the image; it should be used for reporting errors. The image data to be written are in memory and are described by the Tk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see the manual page FindPhoto(3) for details. The \fIfileName\fR argument points to the string giving the name of the file in which to write the image data. The \fIformat\fR argument contains the value given for the \fB\-format\fR option, or NULL if the option was not specified. The format string can contain extra characters after the name of the format. If appropriate, the \fIformatPtr->fileWriteProc\fR procedure may interpret these characters to specify further details about the image file. \fBmetadataIn\fR may contain metadata keys that a driver may include into the output data. The return value is a standard Tcl return value. .SS STRINGWRITEPROC .PP \fIformatPtr->stringWriteProc\fR provides the address of a procedure for Tk to call to translate image data from a photo image into a string. \fIformatPtr->stringWriteProc\fR must match the following prototype: .CS typedef int \fBTk_ImageStringWriteProc\fR( Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIformat\fR, Tcl_Obj *\fImetadataIn\fR, Tk_PhotoImageBlock *\fIblockPtr\fR); .CE The \fIinterp\fR argument is the interpreter in which the command was invoked to convert the image; it should be used for reporting errors. The image data to be converted are in memory and are described by the Tk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see the manual page FindPhoto(3) for details. The data for the string should be put in the interpreter \fIinterp\fR result. The \fIformat\fR argument contains the value given for the \fB\-format\fR option, or NULL if the option was not specified. The format string can contain extra characters after the name of the format. If appropriate, the \fIformatPtr->stringWriteProc\fR procedure may interpret these characters to specify further details about the image file. \fBmetadataIn\fR may contain metadata keys that a driver may include into the output data. The return value is a standard Tcl return value. .PP .SH "METADATA INTERFACE" .PP Image formats contain a description of the image bitmap and may contain additional information like image resolution or comments. Image metadata may be read from image files and passed to the script level by including dictionary keys into the metadata property of the image. Image metadata may be written to image data on file write or image data output. .PP .PP .SS "METADATA KEYS" .PP The metadata may contain any key. A driver will handle only a set of dictionary keys documented in the documentation. See the photo image manual page for currently defined keys for the system drivers. .PP The following rules may give guidance to name metadata keys: .RS Abreviation are in upper case .RE .RS Words are in US English in small case (except proper nouns) .RE .RS Vertical DPI is expressed as DPI/aspect. The reason is, that some image formats may feature aspect and no resolution value. .RE .SS "METADATA INPUT" .PP Each driver function gets a Tcl object pointer \fBmetadataIn\fR as parameter. This parameter serves to input a metadata dict to the driver function. It may be NULL to flag that the metadata dict is empty. .PP A typical driver code snipped to check for a metadata key is: .CS if (NULL != metadataIn) { Tcl_Obj *itemData; Tcl_DictObjGet(interp, metadataIn, Tcl_NewStringObj("Comment",-1), &itemData)); .CE .PP The \-metadata command option data of the following commands is passed to the driver: \fBimage create\fR, \fBconfigure\fR, \fBput\fR, \fBread\fR, \fBdata\fR and \fBwrite\fR. If no \-metadata command option available or not given, the metadata property of the image is passed to the driver using the following commands: \fBcget\fR, \fBconfigure\fR, \fBdata\fR and \fBwrite\fR. .PP Note that setting the \-metadata property of an image using \fBconfigure\fR without any other option does not invoke any driver function. .PP The metadata dictionary is not suited to pass options to the driver related to the bitmap representation, as the image bitmap is not recreated on a metadata change. The format string should be used for this purpose. .PP .SS "METADATA OUTPUT" .PP The image match and read driver functions may set keys in a prepared matadata dict to return them. Those functions get a Tcl object pointer \fBmetadataOut\fR as parameter. metadataOut may be NULL to indicate, that no metadata return is attended(\fBput\fR, \fBread\fR subcommands). \fBmetadataOut\fR is initialized to an empty unshared dict object if metadata return is attended (\fBimage create\fR command, \fBconfigure\fR subcommand). The driver may set dict keys in this object to return metadata. If a match function succeeds, the metadataOut pointer is passed to the corresponding read function. .PP A sample driver code snippet is: .CS if (NULL != metadataOut) { Tcl_DictObjPut(NULL, metadataOut, Tcl_NewStringObj("XMP",-1), Tcl_NewStringObj(xmpMetadata); .CE .PP The metadata keys returned by the driver are merged into the present metadata property of the image or into the metadata dict given by the \fB\-metadata\fR command line option. At the script level, the command \fBimage create\fR and the \fBconfigure\fR method may return metadata from the driver. .PP Format string options or metadata keys may influence the creation of metadata within the driver. For example, the creation of an expensive metadata key may depend on a format string option or on a metadata input key. .PP .VE 8.7 .SH "VERSION 2 INTERFACE" .PP Version 2 Interface does not include the possibility for the driver to use the metadata dict for input or output. .SS SYNOPSIS \fB#include <tk.h>\fR .sp \fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR) .SS ARGUMENTS .AS "const Tk_PhotoImageFormat" *formatPtr .AP "const Tk_PhotoImageFormat" *formatPtr in Structure that defines the new file format. .BE .SS DESCRIPTION A driver using the version 2 interface invokes \fBTk_CreatePhotoImageFormat\fR for driver registration. The Tk_PhotoImageFormat structure contains the following fields: .CS typedef struct Tk_PhotoImageFormat { const char *\fIname\fR; Tk_ImageFileMatchProc *\fIfileMatchProc\fR; Tk_ImageStringMatchProc *\fIstringMatchProc\fR; Tk_ImageFileReadProc *\fIfileReadProc\fR; Tk_ImageStringReadProc *\fIstringReadProc\fR; Tk_ImageFileWriteProc *\fIfileWriteProc\fR; Tk_ImageStringWriteProc *\fIstringWriteProc\fR; } \fBTk_PhotoImageFormat\fR; .CE .PP .SS FILEMATCHPROC .PP \fIformatPtr->fileMatchProc\fR must match the following prototype: .CS typedef int \fBTk_ImageFileMatchProc\fR( Tcl_Channel \fIchan\fR, const char *\fIfileName\fR, Tcl_Obj *\fIformat\fR, int *\fIwidthPtr\fR, int *\fIheightPtr\fR, Tcl_Interp *\fIinterp\fR); .CE .PP .SS STRINGMATCHPROC .PP \fIformatPtr->stringMatchProc\fR must match the following prototype: .CS typedef int \fBTk_ImageStringMatchProc\fR( Tcl_Obj *\fIdata\fR, Tcl_Obj *\fIformat\fR, int *\fIwidthPtr\fR, int *\fIheightPtr\fR, Tcl_Interp *\fIinterp\fR); .CE .SS FILEREADPROC .PP \fIformatPtr->fileReadProc\fR must match the following prototype: .CS typedef int \fBTk_ImageFileReadProc\fR( Tcl_Interp *\fIinterp\fR, Tcl_Channel \fIchan\fR, const char *\fIfileName\fR, Tcl_Obj *\fIformat\fR, PhotoHandle \fIimageHandle\fR, int \fIdestX\fR, int \fIdestY\fR, int \fIwidth\fR, int \fIheight\fR, int \fIsrcX\fR, int \fIsrcY\fR); .CE .SS STRINGREADPROC .PP \fIformatPtr->stringReadProc\fR must match the following prototype: .CS typedef int \fBTk_ImageStringReadProc\fR( Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIdata\fR, Tcl_Obj *\fIformat\fR, PhotoHandle \fIimageHandle\fR, int \fIdestX\fR, int \fIdestY\fR, int \fIwidth\fR, int \fIheight\fR, int \fIsrcX\fR, int \fIsrcY\fR); .CE .SS FILEWRITEPROC .PP \fIformatPtr->fileWriteProc\fR must match the following prototype: .CS typedef int \fBTk_ImageFileWriteProc\fR( Tcl_Interp *\fIinterp\fR, const char *\fIfileName\fR, Tcl_Obj *\fIformat\fR, Tk_PhotoImageBlock *\fIblockPtr\fR); .CE .SS STRINGWRITEPROC .PP \fIformatPtr->stringWriteProc\fR must match the following prototype: .CS typedef int \fBTk_ImageStringWriteProc\fR( Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIformat\fR, Tk_PhotoImageBlock *\fIblockPtr\fR); .CE .PP .SH "LEGACY INTERFACE SUPPORT" .PP In Tk 8.2 and earlier, the definition of all the function pointer types stored in fields of a \fBTk_PhotoImageFormat\fR struct were incompatibly different. Legacy programs and libraries dating from those days may still contain code that defines extended Tk photo image formats using the old interface. The Tk header file will still support |
︙ | ︙ |
Changes to doc/GetHINSTANCE.3.
1 | '\" | | | 1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_GetHISTANCE 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetHINSTANCE \- retrieve the global application instance handle |
︙ | ︙ |
Changes to doc/GetHWND.3.
1 | '\" | | | 1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" .TH HWND 3 8.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetHWND, Tk_AttachHWND \- manage interactions between the Windows handle and an X window |
︙ | ︙ |
Changes to doc/Grab.3.
1 | '\" | | | 1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_Grab 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_Grab, Tk_Ungrab \- manipulate grab state in an application |
︙ | ︙ |
Changes to doc/HWNDToWindow.3.
1 | '\" | | | 1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_HWNDToWindow 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_HWNDToWindow \- Find Tk's window information for a Windows window |
︙ | ︙ |
Changes to doc/Inactive.3.
1 | '\" | | | 1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_GetUserInactiveTime 3 8.5 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime \- discover user inactivity time |
︙ | ︙ |
Changes to doc/MainWin.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_MainWindow\fR(\fIinterp\fR) .sp int \fBTk_GetNumMainWindows\fR() .SH ARGUMENTS .AS Tcl_Interp *pathName .AP Tcl_Interp *interp in/out Interpreter associated with the application. .BE .SH DESCRIPTION .PP A main window is a special kind of toplevel window used as the outermost window in an application. .PP If \fIinterp\fR is associated with a Tk application then \fBTk_MainWindow\fR returns the application's main window. If there is no Tk application associated with \fIinterp\fR then \fBTk_MainWindow\fR returns NULL and leaves an error message in interpreter \fIinterp\fR's result. .PP \fBTk_GetNumMainWindows\fR returns a count of the number of main windows currently open in the current thread. .SH KEYWORDS application, main window | > > > > > > > > > > > > > > > > > > > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_MainWindow\fR(\fIinterp\fR) .sp void \fBTk_SetMainMenubar\fR(\fIinterp, tkwin, menuName\fR) .sp void \fBTk_SetWindowMenubar\fR(\fIinterp, tkwin, oldMenuName, menuName\fR) .sp int \fBTk_GetNumMainWindows\fR() .SH ARGUMENTS .AS Tcl_Interp *pathName .AP Tcl_Interp *interp in/out Interpreter associated with the application. .AP Tk_Window tkwin in Token for main window. .AP const char *menuName in The name of the new menubar that the toplevel needs to be set to. NULL means that their is no menu now. .AP const char *oldMenuName in The name of the menubar previously set in this toplevel. NULL means no menu was set previously. .BE .SH DESCRIPTION .PP A main window is a special kind of toplevel window used as the outermost window in an application. .PP If \fIinterp\fR is associated with a Tk application then \fBTk_MainWindow\fR returns the application's main window. If there is no Tk application associated with \fIinterp\fR then \fBTk_MainWindow\fR returns NULL and leaves an error message in interpreter \fIinterp\fR's result. .PP \fBTk_GetNumMainWindows\fR returns a count of the number of main windows currently open in the current thread. \fBTk_SetMainMenubar\fR Called when a toplevel widget is brought to front. On the Macintosh, sets up the menubar that goes accross the top of the main monitor. On other platforms, nothing is necessary. \fBTk_SetWindowMenubar\fR associates a menu with a window. The old menu clones for the menubar are thrown away, and a handler is set up to allocate the new ones. .SH KEYWORDS application, main window |
Changes to doc/SetOptions.3.
︙ | ︙ | |||
329 330 331 332 333 334 335 | the \fIclientData\fR field of the Tk_OptionSpec, then it is indicated explicitly; if not mentioned, the type requires neither \fItkwin\fR nor \fIclientData\fR. .TP \fBTK_OPTION_ANCHOR\fR The value must be a standard anchor position such as \fBne\fR or \fBcenter\fR. The internal form is a Tk_Anchor value like the ones | | > > | > > > > | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | the \fIclientData\fR field of the Tk_OptionSpec, then it is indicated explicitly; if not mentioned, the type requires neither \fItkwin\fR nor \fIclientData\fR. .TP \fBTK_OPTION_ANCHOR\fR The value must be a standard anchor position such as \fBne\fR or \fBcenter\fR. The internal form is a Tk_Anchor value like the ones returned by \fBTk_GetAnchorFromObj\fR. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if the empty string is specified as the value for the option, the integer relief value is set to \fBTK_ANCHOR_NULL\fR. .TP \fBTK_OPTION_BITMAP\fR The value must be a standard Tk bitmap name. The internal form is a Pixmap token like the ones returned by \fBTk_AllocBitmapFromObj\fR. This option type requires \fItkwin\fR to be supplied to procedures such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_BOOLEAN\fR The value must be a standard boolean value such as \fBtrue\fR or \fBno\fR. The internal form is an integer with value 0 or 1. Note: if the \fIobjOffset\fR field is not used then information about the original value of this option will be lost. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal representation is set to -1. .TP \fBTK_OPTION_BORDER\fR The value must be a standard color name such as \fBred\fR or \fB#ff8080\fR. The internal form is a Tk_3DBorder token like the ones returned by \fBTk_Alloc3DBorderFromObj\fR. This option type requires \fItkwin\fR to be supplied to procedures such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag. |
︙ | ︙ | |||
373 374 375 376 377 378 379 | clientData field of the entry points to a structure defining the new option type. See the section \fBCUSTOM OPTION TYPES\fR below for details. .TP \fBTK_OPTION_DOUBLE\fR The string value must be a floating-point number in the format accepted by \fBstrtol\fR. The internal form is a C \fBdouble\fR value. This option type supports the \fBTK_OPTION_NULL_OK\fR | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | clientData field of the entry points to a structure defining the new option type. See the section \fBCUSTOM OPTION TYPES\fR below for details. .TP \fBTK_OPTION_DOUBLE\fR The string value must be a floating-point number in the format accepted by \fBstrtol\fR. The internal form is a C \fBdouble\fR value. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal representation is set to NaN. .TP \fBTK_OPTION_END\fR Marks the end of the template. There must be a Tk_OptionSpec structure with \fItype\fR \fBTK_OPTION_END\fR at the end of each template. If the \fIclientData\fR field of this structure is not NULL, then it points to an additional array of Tk_OptionSpec's, which is itself terminated by another \fBTK_OPTION_END\fR entry. Templates may be chained arbitrarily |
︙ | ︙ | |||
395 396 397 398 399 400 401 | This option type requires \fItkwin\fR to be supplied to procedures such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_INT\fR The string value must be an integer in the format accepted by \fBstrtol\fR (e.g. \fB0\fR and \fB0x\fR prefixes may be used to specify octal or hexadecimal numbers, respectively). The internal | | > | > > | | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | This option type requires \fItkwin\fR to be supplied to procedures such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_INT\fR The string value must be an integer in the format accepted by \fBstrtol\fR (e.g. \fB0\fR and \fB0x\fR prefixes may be used to specify octal or hexadecimal numbers, respectively). The internal form is a C \fBint\fR value. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal representation is set to INT_MIN. .TP \fBTK_OPTION_JUSTIFY\fR The value must be a standard justification value such as \fBleft\fR. The internal form is a Tk_Justify like the values returned by \fBTk_GetJustifyFromObj\fR. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if the empty string is specified as the value for the option, the integer relief value is set to \fBTK_JUSTIFY_NULL\fR. .TP \fBTK_OPTION_PIXELS\fR The value must specify a screen distance such as \fB2i\fR or \fB6.4\fR. The internal form is an integer value giving a distance in pixels, like the values returned by \fBTk_GetPixelsFromObj\fR. Note: if the \fIobjOffset\fR field is not used then information about the original value of this option will be lost. See \fBOBJOFFSET VS. INTERNALOFFSET\fR below for details. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal representation is set to INT_MIN. .TP \fBTK_OPTION_RELIEF\fR The value must be standard relief such as \fBraised\fR. The internal form is an integer relief value such as \fBTK_RELIEF_RAISED\fR. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal representation is set to \fBTK_RELIEF_NULL\fR. .TP \fBTK_OPTION_STRING\fR The value may be any string. The internal form is a (char *) pointer that points to a dynamically allocated copy of the value. This option type supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_STRING_TABLE\fR |
︙ | ︙ |
Changes to doc/TextLayout.3.
︙ | ︙ | |||
104 105 106 107 108 109 110 | The index of the first character to draw from the given text layout. The number 0 means to draw from the beginning. .AP int lastChar in The index of the last character up to which to draw. The character specified by \fIlastChar\fR itself will not be drawn. A number less than 0 means to draw all characters in the text layout. .AP int underline in | | > | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | The index of the first character to draw from the given text layout. The number 0 means to draw from the beginning. .AP int lastChar in The index of the last character up to which to draw. The character specified by \fIlastChar\fR itself will not be drawn. A number less than 0 means to draw all characters in the text layout. .AP int underline in Index of the single character to underline in the text layout, or a negative number counting backwards from the end of the string. Any out-of-range number (e.g. INT_MIN) means no underline. .AP int index in The index of the character whose bounding box is desired. The bounding box is computed with respect to the upper-left hand corner of the text layout. .AP int "*xPtr, *yPtr" out Filled with the upper-left hand corner, in pixels, of the bounding box for the character specified by \fIindex\fR. Either or both \fIxPtr\fR and \fIyPtr\fR may be NULL, in which case the corresponding value |
︙ | ︙ |
Added doc/WinUtil.3.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_ConfigureWindow 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetOtherWindow, Tk_MakeContainer, Tk_MakeWindow, Tk_UseWindow \- window utility functions .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_GetOtherWindow(\fItkwin\fB)\fR .sp \fBTk_MakeContainer(\fItkwin\fB)\fR .sp \fBTk_MakeWindow(\fItkwin, parent\fB)\fR .sp int \fBTk_UseWindow(\fIinterp, tkwin, string\fB)\fR .SH ARGUMENTS .AS XSetWindowAttributes borderWidth .AP Tcl_Interp * interp in Interpreter associated with the application. .AP Tk_Window tkwin in Token for window. .AP Window parent in Parent window. .AP "const char" *string in String identifying an X window to use for \fItkwin\fR; must be an integer value. .BE .SH DESCRIPTION .PP If both the container and embedded window are in the same process, \fBTk_GetOtherWindow\fR will return either one, given the other. If winPtr is a container, the return value is the token for the embedded window, and vice versa. If the "other" window isn't in this process, NULL is returned. .PP \fBTk_MakeContainer\fR is called to indicate that a particular window will be a container for an embedded application. This changes certain aspects of the window's behavior, such as whether it will receive events anymore. .PP \fBTk_MakeWindow\fR creates an actual window system window object based on the current attributes of the specified TkWindow. It returns the handle to the new window, or None on failure. .PP \fBTk_UseWindow\fR causes a Tk window to use a given X window as its parent window, rather than the root window for the screen. It is invoked by an embedded application to specify the window in which it is embedded. .PP The return value is normally TCL_OK. If an error occurs (such as string not being a valid window spec), then the return value is TCL_ERROR and an error message is left in the interp's result if interp is non-NULL. .PP .SH KEYWORDS parent, window |
Changes to doc/bind.n.
1 2 3 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 1998 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH bind n 8.0 Tk "Tk Built-In Commands" .so man.macros .BS |
︙ | ︙ | |||
49 50 51 52 53 54 55 56 57 58 59 | the window. Although the \fBbindtags\fR command may be used to assign an arbitrary set of binding tags to a window, the default binding tags provide the following behavior: .IP \(bu 3 If a tag is the name of an internal window the binding applies to that window. .IP \(bu 3 If the tag is the name of a toplevel window the binding applies to the toplevel window and all its internal windows. .IP \(bu 3 | > > > < < < | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | the window. Although the \fBbindtags\fR command may be used to assign an arbitrary set of binding tags to a window, the default binding tags provide the following behavior: .IP \(bu 3 If a tag is the name of an internal window the binding applies to that window. .IP \(bu 3 If the tag is the name of a class of widgets, such as \fBButton\fR, the binding applies to all widgets in that class. .IP \(bu 3 If the tag is the name of a toplevel window the binding applies to the toplevel window and all its internal windows. .IP \(bu 3 If \fItag\fR has the value \fBall\fR, the binding applies to all windows in the application. .SH "EVENT PATTERNS" .PP The \fIsequence\fR argument specifies a sequence of one or more event patterns, with optional white space between the patterns. Each event pattern may |
︙ | ︙ | |||
102 103 104 105 106 107 108 | .SS "MODIFIERS" .PP Modifiers consist of any of the following values: .DS .ta 6c \fBControl\fR \fBMod1\fR, \fBM1\fR, \fBCommand\fR \fBAlt\fR \fBMod2\fR, \fBM2\fR, \fBOption\fR | | | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | .SS "MODIFIERS" .PP Modifiers consist of any of the following values: .DS .ta 6c \fBControl\fR \fBMod1\fR, \fBM1\fR, \fBCommand\fR \fBAlt\fR \fBMod2\fR, \fBM2\fR, \fBOption\fR \fBShift\fR \fBMod3\fR, \fBM3\fR, \fBNum\fR \fBLock\fR \fBMod4\fR, \fBM4\fR, \fBFn\fR \fBExtended\fR \fBMod5\fR, \fBM5\fR \fBButton1\fR, \fBB1\fR \fBMeta\fR, \fBM\fR \fBButton2\fR, \fBB2\fR \fBDouble\fR \fBButton3\fR, \fBB3\fR \fBTriple\fR \fBButton4\fR, \fBB4\fR \fBQuadruple\fR \fBButton5\fR, \fBB5\fR .DE |
︙ | ︙ | |||
145 146 147 148 149 150 151 | times, and also place a time and space requirement on the sequence: for a sequence of events to match a \fBDouble\fR, \fBTriple\fR or \fBQuadruple\fR pattern, all of the events must occur close together in time and without substantial mouse motion in between. For example, \fB<Double\-Button\-1>\fR is equivalent to \fB<Button\-1><Button\-1>\fR with the extra time and space requirement. .PP | | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | times, and also place a time and space requirement on the sequence: for a sequence of events to match a \fBDouble\fR, \fBTriple\fR or \fBQuadruple\fR pattern, all of the events must occur close together in time and without substantial mouse motion in between. For example, \fB<Double\-Button\-1>\fR is equivalent to \fB<Button\-1><Button\-1>\fR with the extra time and space requirement. .PP The \fBCommand\fR, \fBOption\fR, \fBNum\fR and \fBFn\fRmodifiers are equivalents of \fBMod1\fR up to \fBMod4\fR, they correspond to Macintosh-specific modifier keys. .PP The \fBExtended\fR modifier is, at present, specific to Windows. It appears on events that are associated with the keys on the .QW "extended keyboard" . On a US keyboard, the extended keys include the \fBAlt\fR and \fBControl\fR keys at the right of the keyboard, the cursor keys in the cluster to the left of the numeric pad, the \fBNumLock\fR key, |
︙ | ︙ |
Changes to doc/canvas.n.
︙ | ︙ | |||
1252 1253 1254 1255 1256 1257 1258 | \fB\-fill \fIcolor\fR .TP \fB\-activefill \fIcolor\fR .TP \fB\-disabledfill \fIcolor\fR . Specifies the color to be used to fill item's area. | | > | 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | \fB\-fill \fIcolor\fR .TP \fB\-activefill \fIcolor\fR .TP \fB\-disabledfill \fIcolor\fR . Specifies the color to be used to fill item's area. in its normal, active, and disabled states. The even-odd fill rule is used. \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR. For the line item, it specifies the color of the line drawn. For the text item, it specifies the foreground color of the text. If \fIcolor\fR is an empty string (the default for all canvas items except line and text), then the item will not be filled. .TP \fB\-outline \fIcolor\fR |
︙ | ︙ | |||
1760 1761 1762 1763 1764 1765 1766 | and third, and so on. Straight-line segments can be generated within a curve by duplicating the end-points of the desired line segment. If the smoothing method is \fBraw\fR, this indicates that the polygon should also be drawn as a curve but where the list of coordinates is such that the first coordinate pair (and every third coordinate pair thereafter) is a knot point on a cubic Bezier curve, and the other coordinates are control points on the cubic Bezier curve. Straight | | | 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 | and third, and so on. Straight-line segments can be generated within a curve by duplicating the end-points of the desired line segment. If the smoothing method is \fBraw\fR, this indicates that the polygon should also be drawn as a curve but where the list of coordinates is such that the first coordinate pair (and every third coordinate pair thereafter) is a knot point on a cubic Bezier curve, and the other coordinates are control points on the cubic Bezier curve. Straight line segments can be generated within a curve by making control points equal to their neighbouring knot points. If the last point is not the second point of a pair of control points, the point is repeated (one or two times) so that it also becomes the second point of a pair of control points (the associated knot point will be the first control point). .TP \fB\-splinesteps \fInumber\fR Specifies the degree of smoothness desired for curves: each spline |
︙ | ︙ |
Changes to doc/chooseDirectory.n.
1 | '\" | | | 1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" .TH tk_chooseDirectory n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME |
︙ | ︙ |
Changes to doc/colors.n.
1 | '\" | | | 1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" Copyright (c) 2003 ActiveState Corporation. '\" Copyright (c) 2006-2007 Daniel A. Steffen <[email protected]> '\" Copyright (c) 2008 Donal K. Fellows '\" .TH colors n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS |
︙ | ︙ |
Changes to doc/console.n.
︙ | ︙ | |||
19 20 21 22 23 24 25 | and output on the standard I/O channels on platforms that do not have a real console. It is implemented as a separate interpreter with the Tk toolkit loaded, and control over this interpreter is given through the \fBconsole\fR command. The behaviour of the console window is defined mainly through the contents of the \fIconsole.tcl\fR file in the Tk library. Except for TkAqua, this command is not available when Tk is loaded into a tclsh interpreter with | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | and output on the standard I/O channels on platforms that do not have a real console. It is implemented as a separate interpreter with the Tk toolkit loaded, and control over this interpreter is given through the \fBconsole\fR command. The behaviour of the console window is defined mainly through the contents of the \fIconsole.tcl\fR file in the Tk library. Except for TkAqua, this command is not available when Tk is loaded into a tclsh interpreter with .QW "\fBpackage require tk\fR" , as a conventional terminal is expected to be present in that case. In TkAqua, this command is disabled when there is a startup script and stdin is \fB/dev/null\fR (as is the case e.g. when a bundled application embedding Tk is started by the macOS Launcher). To enable the command in that case, define the environment variable \fBTK_CONSOLE\fR. This can be done by modifying the Info.plist file by adding the LSEnvironment key to the main dict and setting its value to be a dict with the key \fBTK_CONSOLE\fR. |
︙ | ︙ |
Changes to doc/cursors.n.
1 | '\" | | | 1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" '\" Copyright (c) 2006-2007 Daniel A. Steffen <[email protected]> '\" .TH cursors n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS |
︙ | ︙ |
Changes to doc/event.n.
︙ | ︙ | |||
338 339 340 341 342 343 344 345 346 347 348 349 350 351 | This is sent to a text widget when the selection in the widget is changed. .TP \fB<<ThemeChanged>>\fR This is sent to all widgets when the ttk theme changed. The ttk widgets listen to this event and redisplay themselves when it fires. The legacy widgets ignore this event. .TP \fB<<TraverseIn>>\fR This is sent to a widget when the focus enters the widget because of a user-driven .QW "tab to widget" action. .TP | > > > > > > > > > | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | This is sent to a text widget when the selection in the widget is changed. .TP \fB<<ThemeChanged>>\fR This is sent to all widgets when the ttk theme changed. The ttk widgets listen to this event and redisplay themselves when it fires. The legacy widgets ignore this event. .TP \fB<<TkWorldChanged>>\fR . This event is sent to all widgets when a font is changed, for example, by the use of [font configure]. The user_data field (%d) will have the value "FontChanged". For other system wide changes, this event will be sent to all widgets, and the user_data field will indicate the cause of the change. NOTE: all tk and ttk widgets already handle this event internally. .TP \fB<<TraverseIn>>\fR This is sent to a widget when the focus enters the widget because of a user-driven .QW "tab to widget" action. .TP |
︙ | ︙ |
Changes to doc/grid.n.
︙ | ︙ | |||
307 308 309 310 311 312 313 | is returned, most recently managed first. \fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which causes only the content in the row (or column) specified by \fIvalue\fR to be returned. .TP \fBgrid slaves \fIwindow\fR ?\fI\-option value\fR? . | | | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | is returned, most recently managed first. \fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which causes only the content in the row (or column) specified by \fIvalue\fR to be returned. .TP \fBgrid slaves \fIwindow\fR ?\fI\-option value\fR? . Synonym for \fBgrid content \fIwindow\fR ?\fI\-option value\fR?. .SH "RELATIVE PLACEMENT" .PP The \fBgrid\fR command contains a limited set of capabilities that permit layouts to be created without specifying the row and column information for each content. This permits content to be rearranged, added, or removed without the need to explicitly specify row and column information. |
︙ | ︙ |
Changes to doc/image.n.
︙ | ︙ | |||
89 90 91 92 93 94 95 96 | color, or nothing. See the \fBbitmap\fR manual entry for more information. .TP \fBphoto\fR Displays a variety of full-color images, using dithering to approximate colors on displays with limited color capabilities. See the \fBphoto\fR manual entry for more information. .SH "SEE ALSO" | > > > > > > > > > > > > | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | color, or nothing. See the \fBbitmap\fR manual entry for more information. .TP \fBphoto\fR Displays a variety of full-color images, using dithering to approximate colors on displays with limited color capabilities. See the \fBphoto\fR manual entry for more information. .TP \fBnsimage\fR This type is only available in the Aqua platform. It is a full-color image which may be created from a named system image. It has options designed to facilitate the use of these images in buttons. An \fBnsimage\fR can be based on an a \fItemplate image\fR, which is an anti-aliased 2-color image format that automatically interchanges black and white in response to changes between the light and dark modes on macOS. An \fBnsimage\fR can also generate an alternate \fIpressed\fR variant which is lighter in dark mode and darker in light mode. These are for use in image buttons. See the \fBnsimage\fR manual entry for more information. .SH "SEE ALSO" bitmap(n), options(n), photo(n), nsimage(n) .SH KEYWORDS height, image, types of images, width '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/keysyms.n.
1 | '\" | | | | > > | | | | < | | | | | < | | > | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | '\" '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" All rights reserved. '\" .TH keysyms n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME keysyms \- keysyms recognized by Tk .BE .SH DESCRIPTION .PP Tk recognizes many keysyms when specifying key bindings (e.g., .QW "\fBbind\fR \fB. <\fR\fIkeysym\fR\fB>\fR" ). The following list enumerates the keysyms that will be recognized by Tk. Note that not all keysyms will be valid on all platforms, and some keysyms are also available on platforms that have a different native name for that key. For example, on Unix systems, the presence of a particular keysym is dependent on the configuration of the keyboard modifier map. This list shows keysyms along with their decimal and hexadecimal values. .PP .CS space 32 0x20 ! (exclam) 33 0x21 quotedbl 34 0x22 numbersign 35 0x23 dollar 36 0x24 % (percent) 37 0x25 & (ampersand) 38 0x26 ' (apostrophe) 39 0x27 ( (parenleft) 40 0x28 ) (parenright) 41 0x29 * (asterisk) 42 0x2A + (plus) 43 0x2B , (comma) 44 0x2C minus 45 0x2D . (period) 46 0x2E / (slash) 47 0x2F 0 48 0x30 1 49 0x31 2 50 0x32 3 51 0x33 4 52 0x34 5 53 0x35 6 54 0x36 7 55 0x37 8 56 0x38 9 57 0x39 : (colon) 58 0x3A semicolon 59 0x3B less 60 0x3C = (equal) 61 0x3D greater 62 0x3E ? (question) 63 0x3F @ (at) 64 0x40 A 65 0x41 B 66 0x42 C 67 0x43 D 68 0x44 E 69 0x45 F 70 0x46 G 71 0x47 |
︙ | ︙ | |||
81 82 83 84 85 86 87 | W 87 0x57 X 88 0x58 Y 89 0x59 Z 90 0x5A bracketleft 91 0x5B backslash 92 0x5C bracketright 93 0x5D | | > | < | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | W 87 0x57 X 88 0x58 Y 89 0x59 Z 90 0x5A bracketleft 91 0x5B backslash 92 0x5C bracketright 93 0x5D ^ (asciicircum) 94 0x5E _ (underscore) 95 0x5F ` (grave) 96 0x60 a 97 0x61 b 98 0x62 c 99 0x63 d 100 0x64 e 101 0x65 f 102 0x66 g 103 0x67 |
︙ | ︙ | |||
111 112 113 114 115 116 117 | u 117 0x75 v 118 0x76 w 119 0x77 x 120 0x78 y 121 0x79 z 122 0x7A braceleft 123 0x7B | | | < | | | < < | | | | | > | > > < | | < | | | | | < | | | < | < > | | | | > > | > > < | | | | | < | | | | | | | | | | | | > | | > < | < | | > | | | | < | | > | | | | | < | | > > | | < | | | | < | | | | | | | | | > | | | > > > < < | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | u 117 0x75 v 118 0x76 w 119 0x77 x 120 0x78 y 121 0x79 z 122 0x7A braceleft 123 0x7B | (bar) 124 0x7C braceright 125 0x7D ~ (asciitilde) 126 0x7E nobreakspace 160 0xA0 \(r! (exclamdown) 161 0xA1 \(ct (cent) 162 0xA2 \(Po (sterling) 163 0xA3 \(Cs (currency) 164 0xA4 \(Ye (yen) 165 0xA5 \(bb (brokenbar) 166 0xA6 \(sc (section) 167 0xA7 \(ad (diaeresis) 168 0xA8 \(co (copyright) 169 0xA9 \(Of (ordfeminine) 170 0xAA \(Fo (guillemotleft) 171 0xAB \(no (notsign) 172 0xAC hyphen 173 0xAD \(rg (registered) 174 0xAE \(a- (macron) 175 0xAF \(de (degree) 176 0xB0 \(+- (plusminus) 177 0xB1 \(S2 (twosuperior) 178 0xB2 \(S3 (threesuperior) 179 0xB3 \(aa (acute) 180 0xB4 \(mc (mu) 181 0xB5 \(ps (paragraph) 182 0xB6 \(pc (periodcentered) 183 0xB7 \(ac (cedilla) 184 0xB8 \(S1 (onesuperior) 185 0xB9 \(Om (masculine) 186 0xBA \(Fc (guillemotright) 187 0xBB \(14 (onequarter) 188 0xBC \(12 (onehalf) 189 0xBD \(34 (threequarters) 190 0xBE \(r? (questiondown) 191 0xBF \(`A (Agrave) 192 0xC0 \('A (Aacute) 193 0xC1 \(^A (Acircumflex) 194 0xC2 \(~A (Atilde) 195 0xC3 \(:A (Adiaeresis) 196 0xC4 \(oA (Aring) 197 0xC5 \(AE (AE) 198 0xC6 \(,C (Ccedilla) 199 0xC7 \(`E (Egrave) 200 0xC8 \('E (Eacute) 201 0xC9 \(^E (Ecircumflex) 202 0xCA \(:E (Ediaeresis) 203 0xCB \(`I (Igrave) 204 0xCC \('I (Iacute) 205 0xCD \(^I (Icircumflex) 206 0xCE \(:I (Idiaeresis) 207 0xCF \(-D (ETH) 208 0xD0 \(~N (Ntilde) 209 0xD1 \(`O (Ograve) 210 0xD2 \('O (Oacute) 211 0xD3 \(^O (Ocircumflex) 212 0xD4 \(~O (Otilde) 213 0xD5 \(:O (Odiaeresis) 214 0xD6 \(mu (multiply) 215 0xD7 \(/O (Oslash) 216 0xD8 \(`U (Ugrave) 217 0xD9 \('U (Uacute) 218 0xDA \(^U (Ucircumflex) 219 0xDB \(:U (Udiaeresis) 220 0xDC \('Y (Yacute) 221 0xDD \(TP (THORN) 222 0xDE \(ss (ssharp) 223 0xDF \(`a (agrave) 224 0xE0 \('a (aacute) 225 0xE1 \(^a (acircumflex) 226 0xE2 \(~a (atilde) 227 0xE3 \(:a (adiaeresis) 228 0xE4 \(oa (aring) 229 0xE5 \(ae (ae) 230 0xE6 \(,c (ccedilla) 231 0xE7 \(`e (egrave) 232 0xE8 \('e (eacute) 233 0xE9 \(^e (ecircumflex) 234 0xEA \(:e (ediaeresis) 235 0xEB \(`i (igrave) 236 0xEC \('i (iacute) 237 0xED \(^i (icircumflex) 238 0xEE \(:i (idiaeresis) 239 0xEF \(Sd (eth) 240 0xF0 \(~n (ntilde) 241 0xF1 \(`o (ograve) 242 0xF2 \('o (oacute) 243 0xF3 \(^o (ocircumflex) 244 0xF4 \(~o (otilde) 245 0xF5 \(:o (odiaeresis) 246 0xF6 \(di (division) 247 0xF7 \(/o (oslash) 248 0xF8 \(`u (ugrave) 249 0xF9 \('u (uacute) 250 0xFA \(^u (ucircumflex) 251 0xFB \(:u (udiaeresis) 252 0xFC \('y (yacute) 253 0xFD \(Tp (thorn) 254 0xFE \(:y (ydiaeresis) 255 0xFF .CE .CS Aogonek 417 0x1A1 breve 418 0x1A2 Lstroke 419 0x1A3 Lcaron 421 0x1A5 Sacute 422 0x1A6 Scaron 425 0x1A9 Scedilla 426 0x1AA Tcaron 427 0x1AB Zacute 428 0x1AC Zcaron 430 0x1AE Zabovedot 431 0x1AF aogonek 433 0x1B1 ogonek 434 0x1B2 lstroke 435 0x1B3 lcaron 437 0x1B5 sacute 438 0x1B6 |
︙ | ︙ | |||
390 391 392 393 394 395 396 397 398 399 400 401 402 403 | kana_RU 1241 0x4D9 kana_RE 1242 0x4DA kana_RO 1243 0x4DB kana_WA 1244 0x4DC kana_N 1245 0x4DD voicedsound 1246 0x4DE semivoicedsound 1247 0x4DF Arabic_comma 1452 0x5AC Arabic_semicolon 1467 0x5BB Arabic_question_mark 1471 0x5BF Arabic_hamza 1473 0x5C1 Arabic_maddaonalef 1474 0x5C2 Arabic_hamzaonalef 1475 0x5C3 Arabic_hamzaonwaw 1476 0x5C4 | > > | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | kana_RU 1241 0x4D9 kana_RE 1242 0x4DA kana_RO 1243 0x4DB kana_WA 1244 0x4DC kana_N 1245 0x4DD voicedsound 1246 0x4DE semivoicedsound 1247 0x4DF .CE .CS Arabic_comma 1452 0x5AC Arabic_semicolon 1467 0x5BB Arabic_question_mark 1471 0x5BF Arabic_hamza 1473 0x5C1 Arabic_maddaonalef 1474 0x5C2 Arabic_hamzaonalef 1475 0x5C3 Arabic_hamzaonwaw 1476 0x5C4 |
︙ | ︙ | |||
425 426 427 428 429 430 431 | Arabic_ghain 1498 0x5DA Arabic_tatweel 1504 0x5E0 Arabic_feh 1505 0x5E1 Arabic_qaf 1506 0x5E2 Arabic_kaf 1507 0x5E3 Arabic_lam 1508 0x5E4 Arabic_meem 1509 0x5E5 | < < | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | Arabic_ghain 1498 0x5DA Arabic_tatweel 1504 0x5E0 Arabic_feh 1505 0x5E1 Arabic_qaf 1506 0x5E2 Arabic_kaf 1507 0x5E3 Arabic_lam 1508 0x5E4 Arabic_meem 1509 0x5E5 Arabic_noon 1510 0x5E6 Arabic_ha 1511 0x5E7 Arabic_waw 1512 0x5E8 Arabic_alefmaksura 1513 0x5E9 Arabic_yeh 1514 0x5EA Arabic_fathatan 1515 0x5EB Arabic_dammatan 1516 0x5EC |
︙ | ︙ | |||
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | Cyrillic_CHE 1790 0x6FE Cyrillic_HARDSIGN 1791 0x6FF Greek_ALPHAaccent 1953 0x7A1 Greek_EPSILONaccent 1954 0x7A2 Greek_ETAaccent 1955 0x7A3 Greek_IOTAaccent 1956 0x7A4 Greek_IOTAdieresis 1957 0x7A5 Greek_OMICRONaccent 1959 0x7A7 Greek_UPSILONaccent 1960 0x7A8 Greek_UPSILONdieresis 1961 0x7A9 Greek_OMEGAaccent 1963 0x7AB Greek_accentdieresis 1966 0x7AE Greek_horizbar 1967 0x7AF Greek_alphaaccent 1969 0x7B1 Greek_epsilonaccent 1970 0x7B2 Greek_etaaccent 1971 0x7B3 Greek_iotaaccent 1972 0x7B4 | > > | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | Cyrillic_CHE 1790 0x6FE Cyrillic_HARDSIGN 1791 0x6FF Greek_ALPHAaccent 1953 0x7A1 Greek_EPSILONaccent 1954 0x7A2 Greek_ETAaccent 1955 0x7A3 Greek_IOTAaccent 1956 0x7A4 Greek_IOTAdieresis 1957 0x7A5 Greek_IOTAaccentdiaeresis 1958 0x7A6 Greek_OMICRONaccent 1959 0x7A7 Greek_UPSILONaccent 1960 0x7A8 Greek_UPSILONdieresis 1961 0x7A9 Greek_UPSILONaccentdieresis 1962 0x7AA Greek_OMEGAaccent 1963 0x7AB Greek_accentdieresis 1966 0x7AE Greek_horizbar 1967 0x7AF Greek_alphaaccent 1969 0x7B1 Greek_epsilonaccent 1970 0x7B2 Greek_etaaccent 1971 0x7B3 Greek_iotaaccent 1972 0x7B4 |
︙ | ︙ | |||
606 607 608 609 610 611 612 613 614 615 616 617 618 619 | Greek_finalsmallsigma 2035 0x7F3 Greek_tau 2036 0x7F4 Greek_upsilon 2037 0x7F5 Greek_phi 2038 0x7F6 Greek_chi 2039 0x7F7 Greek_psi 2040 0x7F8 Greek_omega 2041 0x7F9 leftradical 2209 0x8A1 topleftradical 2210 0x8A2 horizconnector 2211 0x8A3 topintegral 2212 0x8A4 botintegral 2213 0x8A5 vertconnector 2214 0x8A6 topleftsqbracket 2215 0x8A7 | > > | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | Greek_finalsmallsigma 2035 0x7F3 Greek_tau 2036 0x7F4 Greek_upsilon 2037 0x7F5 Greek_phi 2038 0x7F6 Greek_chi 2039 0x7F7 Greek_psi 2040 0x7F8 Greek_omega 2041 0x7F9 .CE .CS leftradical 2209 0x8A1 topleftradical 2210 0x8A2 horizconnector 2211 0x8A3 topintegral 2212 0x8A4 botintegral 2213 0x8A5 vertconnector 2214 0x8A6 topleftsqbracket 2215 0x8A7 |
︙ | ︙ | |||
629 630 631 632 633 634 635 | topleftsummation 2225 0x8B1 botleftsummation 2226 0x8B2 topvertsummationconnector 2227 0x8B3 botvertsummationconnector 2228 0x8B4 toprightsummation 2229 0x8B5 botrightsummation 2230 0x8B6 rightmiddlesummation 2231 0x8B7 | < < | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | topleftsummation 2225 0x8B1 botleftsummation 2226 0x8B2 topvertsummationconnector 2227 0x8B3 botvertsummationconnector 2228 0x8B4 toprightsummation 2229 0x8B5 botrightsummation 2230 0x8B6 rightmiddlesummation 2231 0x8B7 lessthanequal 2236 0x8BC notequal 2237 0x8BD greaterthanequal 2238 0x8BE integral 2239 0x8BF therefore 2240 0x8C0 variation 2241 0x8C1 infinity 2242 0x8C2 |
︙ | ︙ | |||
812 813 814 815 816 817 818 819 820 821 822 823 824 825 | hebrew_pe 3316 0xCF4 hebrew_finalzade 3317 0xCF5 hebrew_zade 3318 0xCF6 hebrew_qoph 3319 0xCF7 hebrew_resh 3320 0xCF8 hebrew_shin 3321 0xCF9 hebrew_taw 3322 0xCFA Thai_kokai 3489 0xDA1 Thai_khokhai 3490 0xDA2 Thai_khokhuat 3491 0xDA3 Thai_khokhwai 3492 0xDA4 Thai_khokhon 3493 0xDA5 Thai_khorakhang 3494 0xDA6 Thai_ngongu 3495 0xDA7 | > > | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | hebrew_pe 3316 0xCF4 hebrew_finalzade 3317 0xCF5 hebrew_zade 3318 0xCF6 hebrew_qoph 3319 0xCF7 hebrew_resh 3320 0xCF8 hebrew_shin 3321 0xCF9 hebrew_taw 3322 0xCFA .CE .CS Thai_kokai 3489 0xDA1 Thai_khokhai 3490 0xDA2 Thai_khokhuat 3491 0xDA3 Thai_khokhwai 3492 0xDA4 Thai_khokhon 3493 0xDA5 Thai_khorakhang 3494 0xDA6 Thai_ngongu 3495 0xDA7 |
︙ | ︙ | |||
990 991 992 993 994 995 996 | Hangul_J_PanSios 3832 0xEF8 Hangul_J_KkogjiDalrinIeung 3833 0xEF9 Hangul_J_YeorinHieuh 3834 0xEFA Korean_Won 3839 0xEFF OE 5052 0x13BC oe 5053 0x13BD Ydiaeresis 5054 0x13BE | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < > > | 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | Hangul_J_PanSios 3832 0xEF8 Hangul_J_KkogjiDalrinIeung 3833 0xEF9 Hangul_J_YeorinHieuh 3834 0xEFA Korean_Won 3839 0xEFF OE 5052 0x13BC oe 5053 0x13BD Ydiaeresis 5054 0x13BE \(eu (EuroSign) 8364 0x20AC .CE .CS ISO_Lock 65025 0xFE01 ISO_Level2_Latch 65026 0xFE02 ISO_Level3_Shift 65027 0xFE03 ISO_Level3_Latch 65028 0xFE04 ISO_Level3_Lock 65029 0xFE05 ISO_Group_Latch 65030 0xFE06 ISO_Group_Lock 65031 0xFE07 |
︙ | ︙ | |||
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 | Pointer_Drag3 65271 0xFEF7 Pointer_Drag4 65272 0xFEF8 Pointer_EnableKeys 65273 0xFEF9 Pointer_Accelerate 65274 0xFEFA Pointer_DfltBtnNext 65275 0xFEFB Pointer_DfltBtnPrev 65276 0xFEFC Pointer_Drag5 65277 0xFEFD BackSpace 65288 0xFF08 Tab 65289 0xFF09 Linefeed 65290 0xFF0A Clear 65291 0xFF0B Return 65293 0xFF0D Pause 65299 0xFF13 Scroll_Lock 65300 0xFF14 | > > | 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 | Pointer_Drag3 65271 0xFEF7 Pointer_Drag4 65272 0xFEF8 Pointer_EnableKeys 65273 0xFEF9 Pointer_Accelerate 65274 0xFEFA Pointer_DfltBtnNext 65275 0xFEFB Pointer_DfltBtnPrev 65276 0xFEFC Pointer_Drag5 65277 0xFEFD .CE .CS BackSpace 65288 0xFF08 Tab 65289 0xFF09 Linefeed 65290 0xFF0A Clear 65291 0xFF0B Return 65293 0xFF0D Pause 65299 0xFF13 Scroll_Lock 65300 0xFF14 |
︙ | ︙ | |||
1211 1212 1213 1214 1215 1216 1217 | Up 65362 0xFF52 Right 65363 0xFF53 Down 65364 0xFF54 Prior 65365 0xFF55 Next 65366 0xFF56 End 65367 0xFF57 Begin 65368 0xFF58 | < < < < < | | 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | Up 65362 0xFF52 Right 65363 0xFF53 Down 65364 0xFF54 Prior 65365 0xFF55 Next 65366 0xFF56 End 65367 0xFF57 Begin 65368 0xFF58 Select 65376 0xFF60 Print 65377 0xFF61 Execute 65378 0xFF62 Insert 65379 0xFF63 Undo 65381 0xFF65 Redo 65382 0xFF66 Menu (App) 65383 0xFF67 Find 65384 0xFF68 Cancel 65385 0xFF69 Help 65386 0xFF6A Break 65387 0xFF6B Mode_switch 65406 0xFF7E Num_Lock 65407 0xFF7F KP_Space 65408 0xFF80 |
︙ | ︙ | |||
1309 1310 1311 1312 1313 1314 1315 | Control_R 65508 0xFFE4 Caps_Lock 65509 0xFFE5 Shift_Lock 65510 0xFFE6 Meta_L 65511 0xFFE7 Meta_R 65512 0xFFE8 Alt_L 65513 0xFFE9 Alt_R 65514 0xFFEA | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | Control_R 65508 0xFFE4 Caps_Lock 65509 0xFFE5 Shift_Lock 65510 0xFFE6 Meta_L 65511 0xFFE7 Meta_R 65512 0xFFE8 Alt_L 65513 0xFFE9 Alt_R 65514 0xFFEA Super_L (Win_L) 65515 0xFFEB Super_R (Win_R) 65516 0xFFEC Hyper_L 65517 0xFFED Hyper_R 65518 0xFFEE braille_dot_1 65521 0xFFF1 braille_dot_2 65522 0xFFF2 braille_dot_3 65523 0xFFF3 braille_dot_4 65524 0xFFF4 braille_dot_5 65525 0xFFF5 braille_dot_6 65526 0xFFF6 braille_dot_7 65527 0xFFF7 braille_dot_8 65528 0xFFF8 braille_dot_9 65529 0xFFF9 braille_dot_10 65530 0xFFFA Delete 65535 0xFFFF .CE .CS SunFA_Grave 268828416 0x1005FF00 SunFA_Circum 268828417 0x1005FF01 SunFA_Tilde 268828418 0x1005FF02 SunFA_Acute 268828419 0x1005FF03 SunFA_Diaeresis 268828420 0x1005FF04 SunFA_Cedilla 268828421 0x1005FF05 SunF36 268828432 0x1005FF10 |
︙ | ︙ | |||
2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 | SunAudioLowerVolume 268828535 0x1005FF77 SunAudioMute 268828536 0x1005FF78 SunAudioRaiseVolume 268828537 0x1005FF79 SunVideoDegauss 268828538 0x1005FF7A SunVideoLowerBrightness 268828539 0x1005FF7B SunVideoRaiseBrightness 268828540 0x1005FF7C SunPowerSwitchShift 268828541 0x1005FF7D XF86Switch_VT_1 269024769 0x1008FE01 XF86Switch_VT_2 269024770 0x1008FE02 XF86Switch_VT_3 269024771 0x1008FE03 XF86Switch_VT_4 269024772 0x1008FE04 XF86Switch_VT_5 269024773 0x1008FE05 XF86Switch_VT_6 269024774 0x1008FE06 XF86Switch_VT_7 269024775 0x1008FE07 XF86Switch_VT_8 269024776 0x1008FE08 XF86Switch_VT_9 269024777 0x1008FE09 XF86Switch_VT_10 269024778 0x1008FE0A XF86Switch_VT_11 269024779 0x1008FE0B XF86Switch_VT_12 269024780 0x1008FE0C XF86Ungrab 269024800 0x1008FE20 XF86ClearGrab 269024801 0x1008FE21 XF86Next_VMode 269024802 0x1008FE22 XF86Prev_VMode 269024803 0x1008FE23 XF86LogWindowTree 269024804 0x1008FE24 XF86LogGrabInfo 269024805 0x1008FE25 XF86ModeLock 269025025 0x1008FF01 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | SunAudioLowerVolume 268828535 0x1005FF77 SunAudioMute 268828536 0x1005FF78 SunAudioRaiseVolume 268828537 0x1005FF79 SunVideoDegauss 268828538 0x1005FF7A SunVideoLowerBrightness 268828539 0x1005FF7B SunVideoRaiseBrightness 268828540 0x1005FF7C SunPowerSwitchShift 268828541 0x1005FF7D XF86BrightnessAuto 268964084 0x100810F4 XF86DisplayOff 268964085 0x100810F5 XF86Info 268964198 0x10081166 XF86AspectRatio 268964215 0x10081177 XF86DVD 268964229 0x10081185 XF86Audio 268964232 0x10081188 XF86ChannelUp 268964242 0x10081192 XF86ChannelDown 268964243 0x10081193 XF86Break 268964251 0x1008119B XF86VideoPhone 268964256 0x100811A0 XF86ZoomReset 268964260 0x100811A4 XF86Editor 268964262 0x100811A6 XF86GraphicsEditor 268964264 0x100811A8 XF86Presentation 268964265 0x100811A9 XF86Database 268964266 0x100811AA XF86Voicemail 268964268 0x100811AC XF86Addressbook 268964269 0x100811AD XF86DisplayToggle 268964271 0x100811AF XF86SpellCheck 268964272 0x100811B0 XF86ContextMenu 268964278 0x100811B6 XF86MediaRepeat 268964279 0x100811B7 XF8610ChannelsUp 268964280 0x100811B8 XF8610ChannelsDown 268964281 0x100811B9 XF86Images 268964282 0x100811BA XF86NotificationCenter 268964284 0x100811BC XF86PickupPhone 268964285 0x100811BD XF86HangupPhone 268964286 0x100811BE XF86Fn 268964304 0x100811D0 XF86Fn_Esc 268964305 0x100811D1 XF86FnRightShift 268964325 0x100811E5 XF86Numeric0 268964352 0x10081200 XF86Numeric1 268964353 0x10081201 XF86Numeric2 268964354 0x10081202 XF86Numeric3 268964355 0x10081203 XF86Numeric4 268964356 0x10081204 XF86Numeric5 268964357 0x10081205 XF86Numeric6 268964358 0x10081206 XF86Numeric7 268964359 0x10081207 XF86Numeric8 268964360 0x10081208 XF86Numeric9 268964361 0x10081209 XF86NumericStar 268964362 0x1008120A XF86NumericPound 268964363 0x1008120B XF86NumericA 268964364 0x1008120C XF86NumericB 268964365 0x1008120D XF86NumericC 268964366 0x1008120E XF86NumericD 268964367 0x1008120F XF86CameraFocus 268964368 0x10081210 XF86WPSButton 268964369 0x10081211 XF86CameraZoomIn 268964373 0x10081215 XF86CameraZoomOut 268964374 0x10081216 XF86CameraUp 268964375 0x10081217 XF86CameraDown 268964376 0x10081218 XF86CameraLeft 268964377 0x10081219 XF86CameraRight 268964378 0x1008121A XF86AttendantOn 268964379 0x1008121B XF86AttendantOff 268964380 0x1008121C XF86AttendantToggle 268964381 0x1008121D XF86LightsToggle 268964382 0x1008121E XF86ALSToggle 268964400 0x10081230 XF86Buttonconfig 268964416 0x10081240 XF86Taskmanager 268964417 0x10081241 XF86Journal 268964418 0x10081242 XF86ControlPanel 268964419 0x10081243 XF86AppSelect 268964420 0x10081244 XF86Screensaver 268964421 0x10081245 XF86VoiceCommand 268964422 0x10081246 XF86Assistant 268964423 0x10081247 XF86EmojiPicker 268964425 0x10081249 XF86Dictate 268964426 0x1008124A XF86BrightnessMin 268964432 0x10081250 XF86BrightnessMax 268964433 0x10081251 XF86KbdInputAssistPrev 268964448 0x10081260 XF86KbdInputAssistNext 268964449 0x10081261 XF86KbdInputAssistPrevgroup 268964450 0x10081262 XF86KbdInputAssistNextgroup 268964451 0x10081263 XF86KbdInputAssistAccept 268964452 0x10081264 XF86KbdInputAssistCancel 268964453 0x10081265 XF86RightUp 268964454 0x10081266 XF86RightDown 268964455 0x10081267 XF86LeftUp 268964456 0x10081268 XF86LeftDown 268964457 0x10081269 XF86RootMenu 268964458 0x1008126A XF86MediaTopMenu 268964459 0x1008126B XF86Numeric11 268964460 0x1008126C XF86Numeric12 268964461 0x1008126D XF86AudioDesc 268964462 0x1008126E XF863DMode 268964463 0x1008126F XF86NextFavorite 268964464 0x10081270 XF86StopRecord 268964465 0x10081271 XF86PauseRecord 268964466 0x10081272 XF86VOD 268964467 0x10081273 XF86Unmute 268964468 0x10081274 XF86FastReverse 268964469 0x10081275 XF86SlowReverse 268964470 0x10081276 XF86Data 268964471 0x10081277 XF86OnScreenKeyboard 268964472 0x10081278 XF86PrivacyScreenToggle 268964473 0x10081279 XF86SelectiveScreenshot 268964474 0x1008127A XF86Macro1 268964496 0x10081290 XF86Macro2 268964497 0x10081291 XF86Macro3 268964498 0x10081292 XF86Macro4 268964499 0x10081293 XF86Macro5 268964500 0x10081294 XF86Macro6 268964501 0x10081295 XF86Macro7 268964502 0x10081296 XF86Macro8 268964503 0x10081297 XF86Macro9 268964504 0x10081298 XF86Macro10 268964505 0x10081299 XF86Macro11 268964506 0x1008129A XF86Macro12 268964507 0x1008129B XF86Macro13 268964508 0x1008129C XF86Macro14 268964509 0x1008129D XF86Macro15 268964510 0x1008129E XF86Macro16 268964511 0x1008129F XF86Macro17 268964512 0x100812A0 XF86Macro18 268964513 0x100812A1 XF86Macro19 268964514 0x100812A2 XF86Macro20 268964515 0x100812A3 XF86Macro21 268964516 0x100812A4 XF86Macro22 268964517 0x100812A5 XF86Macro23 268964518 0x100812A6 XF86Macro24 268964519 0x100812A7 XF86Macro25 268964520 0x100812A8 XF86Macro26 268964521 0x100812A9 XF86Macro27 268964522 0x100812AA XF86Macro28 268964523 0x100812AB XF86Macro29 268964524 0x100812AC XF86Macro30 268964525 0x100812AD XF86MacroRecordStart 268964528 0x100812B0 XF86MacroRecordStop 268964529 0x100812B1 XF86MacroPresetCycle 268964530 0x100812B2 XF86MacroPreset1 268964531 0x100812B3 XF86MacroPreset2 268964532 0x100812B4 XF86MacroPreset3 268964533 0x100812B5 XF86KbdLcdMenu1 268964536 0x100812B8 XF86KbdLcdMenu2 268964537 0x100812B9 XF86KbdLcdMenu3 268964538 0x100812BA XF86KbdLcdMenu4 268964539 0x100812BB XF86KbdLcdMenu5 268964540 0x100812BC XF86Switch_VT_1 269024769 0x1008FE01 XF86Switch_VT_2 269024770 0x1008FE02 XF86Switch_VT_3 269024771 0x1008FE03 XF86Switch_VT_4 269024772 0x1008FE04 XF86Switch_VT_5 269024773 0x1008FE05 XF86Switch_VT_6 269024774 0x1008FE06 XF86Switch_VT_7 269024775 0x1008FE07 XF86Switch_VT_8 269024776 0x1008FE08 XF86Switch_VT_9 269024777 0x1008FE09 XF86Switch_VT_10 269024778 0x1008FE0A XF86Switch_VT_11 269024779 0x1008FE0B XF86Switch_VT_12 269024780 0x1008FE0C .CE .CS XF86Ungrab 269024800 0x1008FE20 XF86ClearGrab 269024801 0x1008FE21 XF86Next_VMode 269024802 0x1008FE22 XF86Prev_VMode 269024803 0x1008FE23 XF86LogWindowTree 269024804 0x1008FE24 XF86LogGrabInfo 269024805 0x1008FE25 XF86ModeLock 269025025 0x1008FF01 |
︙ | ︙ | |||
2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 | XF86TouchpadOff 269025201 0x1008FFB1 XF86AudioMicMute 269025202 0x1008FFB2 XF86Keyboard 269025203 0x1008FFB3 XF86WWAN 269025204 0x1008FFB4 XF86RFKill 269025205 0x1008FFB5 XF86AudioPreset 269025206 0x1008FFB6 XF86RotationLockToggle 269025207 0x1008FFB7 .CE .SH "SEE ALSO" bind(n), event(n) .SH KEYWORDS bind, binding, event, keysym '\" Local Variables: '\" mode: nroff '\" End: | > | 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 | XF86TouchpadOff 269025201 0x1008FFB1 XF86AudioMicMute 269025202 0x1008FFB2 XF86Keyboard 269025203 0x1008FFB3 XF86WWAN 269025204 0x1008FFB4 XF86RFKill 269025205 0x1008FFB5 XF86AudioPreset 269025206 0x1008FFB6 XF86RotationLockToggle 269025207 0x1008FFB7 XF86FullScreen 269025208 0x1008FFB8 .CE .SH "SEE ALSO" bind(n), event(n) .SH KEYWORDS bind, binding, event, keysym '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/listbox.n.
︙ | ︙ | |||
559 560 561 562 563 564 565 | extend the selection to the active element just as if button 1 had been pressed with the Shift key down. .IP [16] In \fBextended\fR mode, the Escape key cancels the most recent selection and restores all the elements in the selected range to their previous selection state. .IP [17] | | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | extend the selection to the active element just as if button 1 had been pressed with the Shift key down. .IP [16] In \fBextended\fR mode, the Escape key cancels the most recent selection and restores all the elements in the selected range to their previous selection state. .IP [17] Control-/ selects everything in the widget, except in \fBsingle\fR and \fBbrowse\fR modes, in which case it selects the active element and deselects everything else. .IP [18] Control-backslash deselects everything in the widget, except in \fBbrowse\fR mode where it has no effect. .IP [19] The F16 key (labelled Copy on many Sun workstations) or Meta-w |
︙ | ︙ |
Changes to doc/menu.n.
︙ | ︙ | |||
36 37 38 39 40 41 42 | .OP \-tearoff tearOff TearOff This option must have a proper boolean value (default is false), which specifies whether or not the menu should include a tear-off entry at the top. If so, it will exist as entry 0 of the menu and the other entries will number starting at 1. The default menu bindings arrange for the menu to be torn off when the tear-off entry is invoked. | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | .OP \-tearoff tearOff TearOff This option must have a proper boolean value (default is false), which specifies whether or not the menu should include a tear-off entry at the top. If so, it will exist as entry 0 of the menu and the other entries will number starting at 1. The default menu bindings arrange for the menu to be torn off when the tear-off entry is invoked. This option is ignored under Aqua/MacOS, where menus cannot be torn off. .OP \-tearoffcommand tearOffCommand TearOffCommand If this option has a non-empty value, then it specifies a Tcl command to invoke whenever the menu is torn off. The actual command will consist of the value of this option, followed by a space, followed by the name of the menu window, followed by a space, followed by the name of the name of the torn off menu window. For example, if the option's value is .QW "\fBa b\fR" and menu \fB.x.y\fR is torn off to create a new menu \fB.x.tearoff1\fR, then the command .QW "\fBa b .x.y .x.tearoff1\fR" will be invoked. This option is ignored under Aqua/MacOS, where menus cannot be torn off. .OP \-title title Title The string will be used to title the window created when this menu is torn off. If the title is NULL, then the window will have the title of the menubutton or the text of the cascade item from which this menu was invoked. .OP \-type type Type |
︙ | ︙ | |||
312 313 314 315 316 317 318 | indicator of which entry of the menu to operate on. These indicators are called \fIindex\fRes and may be specified in any of the following forms: .TP 12 \fBactive\fR . Indicates the entry that is currently active. If no entry is | | | | | > > > > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | indicator of which entry of the menu to operate on. These indicators are called \fIindex\fRes and may be specified in any of the following forms: .TP 12 \fBactive\fR . Indicates the entry that is currently active. If no entry is active then this form is equivalent to \fB{}\fR. This form may not be abbreviated. .TP 12 \fBend\fR . Indicates the bottommost entry in the menu. If there are no entries in the menu then this form is equivalent to \fB{}\fR. This form may not be abbreviated. .TP 12 \fBlast\fR . Same as \fBend\fR. .TP 12 \fB{}\fR . Indicates .QW "no entry at all" ; this is used most commonly with the \fBactivate\fR option to deactivate all the entries in the menu. In most cases the specification of \fB{}\fR causes nothing to happen in the widget command. .TP 12 \fBnone\fR . Same as \fB{}\fR This form may not be abbreviated. .TP 12 \fB@\fInumber\fR . In this form, \fInumber\fR is treated as a y-coordinate in the menu's window; the entry closest to that y-coordinate is used. For example, |
︙ | ︙ | |||
367 368 369 370 371 372 373 | The following widget commands are possible for menu widgets: .TP \fIpathName \fBactivate \fIindex\fR . Change the state of the entry indicated by \fIindex\fR to \fBactive\fR and redisplay it using its active colors. Any previously-active entry is deactivated. If \fIindex\fR | | | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | The following widget commands are possible for menu widgets: .TP \fIpathName \fBactivate \fIindex\fR . Change the state of the entry indicated by \fIindex\fR to \fBactive\fR and redisplay it using its active colors. Any previously-active entry is deactivated. If \fIindex\fR is specified as \fB{}\fR or \fBnone\fR, or if the specified entry is disabled, then the menu ends up with no active entry. Returns an empty string. .TP \fIpathName \fBadd \fItype \fR?\fIoption value option value ...\fR? . Add a new entry to the bottom of the menu. The new entry's type is given by \fItype\fR and must be one of \fBcascade\fR, |
︙ | ︙ | |||
443 444 445 446 447 448 449 | If no \fIoptions\fR are specified, returns a list describing the current options for entry \fIindex\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). .TP \fIpathName \fBindex \fIindex\fR . Returns the numerical index corresponding to \fIindex\fR, or | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | If no \fIoptions\fR are specified, returns a list describing the current options for entry \fIindex\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). .TP \fIpathName \fBindex \fIindex\fR . Returns the numerical index corresponding to \fIindex\fR, or \fB{}\fR if \fIindex\fR was specified as \fB{}\fR or \fBnone\fR. .TP \fIpathName \fBinsert \fIindex type \fR?\fIoption value option value ...\fR? . Same as the \fBadd\fR widget command except that it inserts the new entry just before the entry given by \fIindex\fR, instead of appending to the end of the menu. The \fItype\fR, \fIoption\fR, and \fIvalue\fR arguments have the same interpretation as for the \fBadd\fR widget |
︙ | ︙ | |||
519 520 521 522 523 524 525 | .SH "MENU ENTRY OPTIONS" The following options are allowed on menu entries. Most options are not supported by all entry types. .TP \fB\-activebackground \fIvalue\fR . Specifies a background color to use for displaying this entry when it | | | | > | | | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | .SH "MENU ENTRY OPTIONS" The following options are allowed on menu entries. Most options are not supported by all entry types. .TP \fB\-activebackground \fIvalue\fR . Specifies a background color to use for displaying this entry when it is active. This option is ignored on Aqua/MacOS. If it is specified as an empty string (the default), then the \fB\-activebackground\fR option for the overall menu is used. If the \fBtk_strictMotif\fR variable has been set to request strict Motif compliance, then this option is ignored and the \fB\-background\fR option is used in its place. This option is not available for separator or tear-off entries. .TP \fB\-activeforeground \fIvalue\fR . Specifies a foreground color to use for displaying this entry when it is active. This option is ignored on Aqua/macOS. If this option is specified as an empty string (the default), then the \fB\-activeforeground\fR option for the overall menu is used. This option is not available for separator or tear-off entries. .TP \fB\-accelerator \fIvalue\fR . Specifies a string to display at the right side of the menu entry. Normally describes an accelerator keystroke sequence that may be used to invoke the same function as the menu entry. This is a display option, it does not actually set the corresponding binding (which can be achieved using the \fBbind\fR command). This option is not available for separator or tear-off entries. .TP \fB\-background \fIvalue\fR . Specifies a background color to use for displaying this entry when it is in the normal state (neither active nor disabled). This option is ignored on Aqua/macOS. If it is specified as an empty string (the default), then the \fB\-background\fR option for the overall menu is used. This option is not available for separator or tear-off entries. .TP \fB\-bitmap \fIvalue\fR . Specifies a bitmap to display in the menu instead of a textual label, in any of the forms accepted by \fBTk_GetBitmap\fR. This option overrides the \fB\-label\fR option (as controlled by the \fB\-compound\fR option) but may be reset to an empty string to enable a textual label to be displayed. If a \fB\-image\fR option has been specified, it overrides \fB\-bitmap\fR. This option is not available for separator or tear-off entries. .TP \fB\-columnbreak \fIvalue\fR . When this option is zero, the entry appears below the previous entry. When this option is one, the entry appears at the top of a new column in the menu. This option is ignored on Aqua/macOS, where menus are always a single column. .TP \fB\-command \fIvalue\fR . Specifies a Tcl command to execute when the menu entry is invoked. Not available for separator or tear-off entries. .TP |
︙ | ︙ | |||
599 600 601 602 603 604 605 | the \fB\-font\fR option for the overall menu is used. This option is not available for separator or tear-off entries. .TP \fB\-foreground \fIvalue\fR . Specifies a foreground color to use for displaying this entry when it is in the normal state (neither active nor disabled). | > | | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | the \fB\-font\fR option for the overall menu is used. This option is not available for separator or tear-off entries. .TP \fB\-foreground \fIvalue\fR . Specifies a foreground color to use for displaying this entry when it is in the normal state (neither active nor disabled). This option is ignored on Aqua/macOS. If it is specified as an empty string (the default), then the \fB\-foreground\fR option for the overall menu is used. This option is not available for separator or tear-off entries. .TP \fB\-hidemargin \fIvalue\fR . Specifies whether the standard margins should be drawn for this menu entry. This is useful when creating palette with images in them, i.e., |
︙ | ︙ |
Changes to doc/menubutton.n.
︙ | ︙ | |||
20 21 22 23 24 25 26 | \-background \-highlightbackground \-takefocus \-bitmap \-highlightcolor \-text \-borderwidth \-highlightthickness \-textvariable \-cursor \-image \-underline \-compound \-justify \-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | \-background \-highlightbackground \-takefocus \-bitmap \-highlightcolor \-text \-borderwidth \-highlightthickness \-textvariable \-cursor \-image \-underline \-compound \-justify \-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-direction direction Direction Specifies where the menu is going to be popup up. \fBabove\fR tries to pop the menu above the menubutton. \fBbelow\fR tries to pop the menu below the menubutton. \fBleft\fR tries to pop the menu to the left of the menubutton. \fBright\fR tries to pop the menu to the right of the menu button. \fBflush\fR pops the menu directly over the menubutton. In the case of \fBabove\fR or \fBbelow\fR, the direction will be reversed if the menu would show offscreen. |
︙ | ︙ |
Changes to doc/messageBox.n.
︙ | ︙ | |||
62 63 64 65 66 67 68 | \fB\-parent\fR \fIwindow\fR . Makes \fIwindow\fR the logical parent of the message box. The message box is displayed on top of its parent window. .TP \fB\-title\fR \fItitleString\fR . | | < | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | \fB\-parent\fR \fIwindow\fR . Makes \fIwindow\fR the logical parent of the message box. The message box is displayed on top of its parent window. .TP \fB\-title\fR \fItitleString\fR . Specifies a string to display as the title of the message box. The default value is an empty string. .TP \fB\-type\fR \fIpredefinedType\fR . Arranges for a predefined set of buttons to be displayed. The following values are possible for \fIpredefinedType\fR: .RS .TP 18 |
︙ | ︙ |
Added doc/nsimage.n.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | '\" '\" Copyright (c) 2022 Marc Culler '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH nsimage n 8.7 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME nsimage \- A Tk image type for macOS based on the NSImage class. .BE .SH DESCRIPTION The nsimage is implemented as a Tk image type. The \fBimage\fR command is used to create, delete, and query all images, including images of type \fBnsimage\fR. The options that are available are specific to the nsimage type and are described below. .PP The command to create an \fBnsimage\fR: .TP \fBimage create nsimage \fR?\fIname\fR? ?\fIoption value ...\fR? .PP creates a new nsimage and a command with the same name and returns its name. .SH OPTIONS .PP Valid \fIoptions\fR are: .TP \fB\-source\fR .PP The value of the \fB\-source\fR option is a string describing an NSimage. There are several ways to interpret this string, and the interpretation is determined by the value of the \fB\-as\fR option. This option is required. .PP .TP \fB\-as\fR .PP There are four possible values for the \fB-as\fR option which specify how the source string should be interpreted. The allowed values and their meanings are: .IP \fBname\fR .IP The source should be interpreted as the name of a named NSImage provided by the system. This is the default if the -as option is not specified. .IP \fBfile\fR .IP The source should be interpreted as a path to an image file in one of the formats understood by the NSImage class. .IP \fBpath\fR .IP The source should be interpreted as a path to an arbitrary file. The type of the file will be examined and the resulting image will be the system icon for files of that type. .IP \fBfiletype\fR .IP The source is interpreted as a string identifying a particular file type. It may be a filename extension, an Apple Uniform Type Identifier or a 4-character OSType value as used in the HFS filesystem. .TP \fB\-width\fR .PP The value of the \fIwidth\fR option is an integer specifying the width in pixels of the nsimage. If the width is not specified it will be computed from the height so as to preserve the aspect ration. If neither width nor height are specified then the width and height of the underlying NSImage will be used. .TP \fB\-height\fR .PP The value of the \fIheight\fR option is an integer specifying the height in pixels of the nsimage. If the height is not specified it will be computed from the height so as to preserve the aspect ration. If neither width nor height are specified then the width and height of the underlying NSImage will be used. .TP \fB\-radius\fR .PP The value of the \fIradius\fR option is an integer. If non-zero the image will be clipped to a rounded rectangle with the same width and height as the image, but with circular arcs of the specified radius cutting off the corners of the rectangle. .TP \fB\-ring\fR .PP The value of the \fIring\fR option is an integer. If non-zero then it specifies the thickness of a focus ring which will be drawn around the image using the control accent color specified in the System Preferences. The image is resized to reduce its width and height by twice the thickness of the ring. Note that this may create a small amount of distortion. The aspect ration of a non-square image will change slightly. .TP \fB\-alpha\fR .PP The value of the \fIalpha\fR option should be a floating point number between 0.0 and 1.0. This alpha value will be applied to each pixel of the nsimage, producing a partially transparent image. The default value is 1,0, which makes the image opaque. .TP \fB\-pressed\fR .PP The \fIpressed\fR option takes a boolean value. If the value is true or 1 then the image will be algorithmically modified to become darker in light mode or lighter in dark mode. The default is false. For an image button, the primary image should use the value false while the pressed image should be the same image but with the \fIpressed\fR option set to true. .TP \fB\-template\fR .PP The \fItemplate\fR option takes a boolean value. If the value is true or 1 then the image will be marked as being a template image. This means that the system will algorithmically convert the image to a light colored image when in dark mode. For the algorithm to work correctly the image must consist only of black pixels with alpha values. .SH "SEE ALSO" image(n), options(n), photo(n) .SH KEYWORDS height, image, types of images, width '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/pack.n.
︙ | ︙ | |||
162 163 164 165 166 167 168 | Returns a list of all of the content windows in the packing order for \fIwindow\fR. The order of the content windows in the list is the same as their order in the packing order. If \fIwindow\fR has no content then an empty string is returned. .TP \fBpack slaves \fIwindow\fR . | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | Returns a list of all of the content windows in the packing order for \fIwindow\fR. The order of the content windows in the list is the same as their order in the packing order. If \fIwindow\fR has no content then an empty string is returned. .TP \fBpack slaves \fIwindow\fR . Synonym for \fBpack content \fIwindow\fR. .SH "THE PACKER ALGORITHM" .PP For each container the packer maintains an ordered list of content windows called the \fIpacking list\fR. The \fB\-in\fR, \fB\-after\fR, and \fB\-before\fR configuration options are used to specify the container for each content and the content's position in the packing list. |
︙ | ︙ |
Changes to doc/photo.n.
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 | .TP \fB\-height \fInumber\fR . Specifies the height of the image, in pixels. This option is useful primarily in situations where the user wishes to build up the contents of the image piece by piece. A value of zero (the default) allows the image to expand or shrink vertically to fit the data stored in it. .TP \fB\-palette \fIpalette-spec\fR . Specifies the resolution of the color cube to be allocated for displaying this image, and thus the number of colors used from the colormaps of the windows where it is displayed. The \fIpalette-spec\fR string may be either a single decimal number, | > > > > > > > > > > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | .TP \fB\-height \fInumber\fR . Specifies the height of the image, in pixels. This option is useful primarily in situations where the user wishes to build up the contents of the image piece by piece. A value of zero (the default) allows the image to expand or shrink vertically to fit the data stored in it. .VS 8.7 .TP \fB\-metadata \fImetadata\fR . Set the metadata dictionary of the image. Additional keys may be set within the metadata dictionary of the image, if image data is processed due to a \fB\-file\fR or \fB\-data\fR options and the driver outputs any metadata keys. See section \fBMETADATA DICTIONARY\fR below. .VE 8.7 .TP \fB\-palette \fIpalette-spec\fR . Specifies the resolution of the color cube to be allocated for displaying this image, and thus the number of colors used from the colormaps of the windows where it is displayed. The \fIpalette-spec\fR string may be either a single decimal number, |
︙ | ︙ | |||
142 143 144 145 146 147 148 | .PP The following commands are possible for photo images: .TP \fIimageName \fBblank\fR . Blank the image; that is, set the entire image to have no data, so it will be displayed as transparent, and the background of whatever | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | .PP The following commands are possible for photo images: .TP \fIimageName \fBblank\fR . Blank the image; that is, set the entire image to have no data, so it will be displayed as transparent, and the background of whatever window it is displayed in will show through. The metadata dict of the image is not changed. .TP \fIimageName \fBcget\fR \fIoption\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBimage create\fR \fBphoto\fR command. |
︙ | ︙ | |||
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | one named option (this list will be identical to the corresponding sublist of the value returned if no \fIoption\fR is specified). If one or more \fIoption\-value\fR pairs are specified, then the command modifies the given option(s) to have the given value(s); in this case the command returns an empty string. \fIOption\fR may have any of the values accepted by the \fBimage create\fR \fBphoto\fR command. .TP \fIimageName \fBcopy\fR \fIsourceImage\fR ?\fIoption value(s) ...\fR? . Copies a region from the image called \fIsourceImage\fR (which must be a photo image) to the image called \fIimageName\fR, possibly with pixel zooming and/or subsampling. If no options are specified, this command copies the whole of \fIsourceImage\fR into \fIimageName\fR, | > > > > | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | one named option (this list will be identical to the corresponding sublist of the value returned if no \fIoption\fR is specified). If one or more \fIoption\-value\fR pairs are specified, then the command modifies the given option(s) to have the given value(s); in this case the command returns an empty string. \fIOption\fR may have any of the values accepted by the \fBimage create\fR \fBphoto\fR command. .VS 8.7 Note: setting the \fB\-metadata\fR option without any other option will not invoke the image format driver to recreate the bitmap. .VE 8.7 .TP \fIimageName \fBcopy\fR \fIsourceImage\fR ?\fIoption value(s) ...\fR? . Copies a region from the image called \fIsourceImage\fR (which must be a photo image) to the image called \fIimageName\fR, possibly with pixel zooming and/or subsampling. If no options are specified, this command copies the whole of \fIsourceImage\fR into \fIimageName\fR, |
︙ | ︙ | |||
283 284 285 286 287 288 289 | and excluding x2,y2. The default, if this option is not given, is the whole image. .TP \fB\-grayscale\fR . If this options is specified, the data will not contain color information. All pixel data will be transformed into grayscale. | < > > > > > > > > > > | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | and excluding x2,y2. The default, if this option is not given, is the whole image. .TP \fB\-grayscale\fR . If this options is specified, the data will not contain color information. All pixel data will be transformed into grayscale. .VS 8.7 .TP \fB\-metadata\fR \fImetadata\fR . Image format handler may use metadata to be included in the returned data string. The specified \fImetadata\fR is passed to the driver for inclusion in the data. If no \fB\-metadata\fR option is given, the current metadata of the image is used. .VE 8.7 .RE \fIimageName \fBget\fR \fIx y\fR ?\fB-withalpha\fR? . Returns the color of the pixel at coordinates (\fIx\fR,\fIy\fR) in the image as a list of three integers between 0 and 255, representing the red, green and blue components respectively. If the \fB-withalpha\fR option is specified, the returned list will have a fourth element representing the alpha value of the pixel as an integer between 0 and |
︙ | ︙ | |||
318 319 320 321 322 323 324 325 326 327 328 329 330 331 | arguments to be passed to the format handler. Specifically, only image file format handlers whose names begin with \fIformat-name\fR will be used while searching for an image data format handler to read the data. Note: the value of this option must be a Tcl list. This means that the braces may be omitted if the argument has only one word. Also, instead of braces, double quotes may be used for quoting. .TP \fB\-to \fIx1 y1\fR ?\fIx2 y2\fR? . Specifies the coordinates of the top-left corner (\fIx1\fR,\fIy1\fR) of the region of \fIimageName\fR into which the image data will be copied. The default position is (0,0). If \fIx2\fR,\fIy2\fR is given and \fIdata\fR is not large enough to cover the rectangle specified by | > > > > > > > > > | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | arguments to be passed to the format handler. Specifically, only image file format handlers whose names begin with \fIformat-name\fR will be used while searching for an image data format handler to read the data. Note: the value of this option must be a Tcl list. This means that the braces may be omitted if the argument has only one word. Also, instead of braces, double quotes may be used for quoting. .VS 8.7 .TP \fB\-metadata\fR \fImetadata\fR . A specified \fImetadata\fR is passed to the image format driver when interpreting the data. Note: The current metadata of the image is not passed to the format driver and is not changed by the command. .VE 8.7 .TP \fB\-to \fIx1 y1\fR ?\fIx2 y2\fR? . Specifies the coordinates of the top-left corner (\fIx1\fR,\fIy1\fR) of the region of \fIimageName\fR into which the image data will be copied. The default position is (0,0). If \fIx2\fR,\fIy2\fR is given and \fIdata\fR is not large enough to cover the rectangle specified by |
︙ | ︙ | |||
363 364 365 366 367 368 369 370 371 372 373 374 375 376 | Specifies a rectangular sub-region of the image file data to be copied to the destination image. If only \fIx1\fR and \fIy1\fR are specified, the region extends from (\fIx1,y1\fR) to the bottom-right corner of the image in the image file. If all four coordinates are specified, they specify diagonally opposite corners or the region. The default, if this option is not specified, is the whole of the image in the image file. .TP \fB\-shrink\fR . If this option, the size of \fIimageName\fR will be reduced, if necessary, so that the region into which the image file data are read is at the bottom-right corner of the \fIimageName\fR. This option will not affect the width or height of the image if the user has | > > > > > > > > > | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | Specifies a rectangular sub-region of the image file data to be copied to the destination image. If only \fIx1\fR and \fIy1\fR are specified, the region extends from (\fIx1,y1\fR) to the bottom-right corner of the image in the image file. If all four coordinates are specified, they specify diagonally opposite corners or the region. The default, if this option is not specified, is the whole of the image in the image file. .VS 8.7 .TP \fB\-metadata\fR \fImetadata\fR . A specified \fImetadata\fR is passed to the image format driver when interpreting the data. Note: The current metadata of the image is not passed to the format driver and is not changed by the command. .VE 8.7 .TP \fB\-shrink\fR . If this option, the size of \fIimageName\fR will be reduced, if necessary, so that the region into which the image file data are read is at the bottom-right corner of the \fIimageName\fR. This option will not affect the width or height of the image if the user has |
︙ | ︙ | |||
456 457 458 459 460 461 462 463 464 465 466 467 468 469 | diagonally opposite corners of the rectangular region. The default, if this option is not given, is the whole image. .TP \fB\-grayscale\fR . If this options is specified, the data will not contain color information. All pixel data will be transformed into grayscale. .RE .SH "IMAGE FORMATS" .PP The photo image code is structured to allow handlers for additional image file formats to be added easily. The photo image code maintains a list of these handlers. Handlers are added to the list by registering them with a call to \fBTk_CreatePhotoImageFormat\fR. The | > > > > > > > > > > | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | diagonally opposite corners of the rectangular region. The default, if this option is not given, is the whole image. .TP \fB\-grayscale\fR . If this options is specified, the data will not contain color information. All pixel data will be transformed into grayscale. .VS 8.7 .TP \fB\-metadata\fR \fBmetadata\fR . Image format handler may use metadata to be included in the written file. The specified \fImetadata\fR is passed to the driver for inclusion in the file. If no \fB\-metadata\fR option is given, the current metadata of the image is used. .VE 8.7 .RE .SH "IMAGE FORMATS" .PP The photo image code is structured to allow handlers for additional image file formats to be added easily. The photo image code maintains a list of these handlers. Handlers are added to the list by registering them with a call to \fBTk_CreatePhotoImageFormat\fR. The |
︙ | ︙ | |||
678 679 680 681 682 683 684 685 686 687 688 689 690 691 | The user can exercise some control over the number of colors that a photo image uses with the \fB\-palette\fR configuration option. If this option is used, it specifies the maximum number of shades of each primary color to try to allocate. It can also be used to force the image to be displayed in shades of gray, even on a color display, by giving a single number rather than three numbers separated by slashes. .SH CREDITS .PP The photo image type was designed and implemented by Paul Mackerras, based on his earlier photo widget and some suggestions from John Ousterhout. .SH EXAMPLE .PP | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | The user can exercise some control over the number of colors that a photo image uses with the \fB\-palette\fR configuration option. If this option is used, it specifies the maximum number of shades of each primary color to try to allocate. It can also be used to force the image to be displayed in shades of gray, even on a color display, by giving a single number rather than three numbers separated by slashes. .VS 8.7 .SH "METADATA DICTIONARY" .PP Each image has a metadata dictionary property. This dictionary is not relevant to the bitmap representation of the image, but may contain additional information like resolution or comments. Image format drivers may output metadata when image data is parsed, or may use metadata to be included in image files or formats. .SS "METADATA KEYS (MULTIPLE FORMATS)" .PP Each image format driver supports an individual set of metadata dictionary keys. Predefined keys are: .TP DPI . Horizontal image resolution in DPI as a double value. Supported by format \fBpng\fR. .TP aspect . Aspect ratio horizontal divided by vertical as double value. Supported by formats \fBgif\fR and \fBpng\fR. .TP comment . Image text comment. Supported by formats \fBgif\fR and \fBpng\fR. .PP It is valid to set any key in the metadata dict. A format driver will ignore keys it does not handle. .SS "METADATA KEYS FOR ANIMATED GIF INFORMATION" .PP The following metadata keys are reported when reading a \fBgif\fR format file. They are typically used in conjunction with the \fI-index\fR option of an animated \fBgif\fR file to properly display the subimage sequence. The options are linked to each subimage selected by \fI-index\fR. .TP \fBdelay time\fR \fItime\fR . Update delay time in 10ms unit. This key is only present, if delay time is not 0. .TP \fBdisposal method\fR \fImethod\fR . Disposal method of the preceeding image, if given for the current image. Possible values are: \fIdo not dispose\fR, \fIrestore to background color\fR, \fIrestore to previous\fR. .TP \fBuser interaction\fR \fIbool\fR . The key is present with a value of 1, if user interaction is specified. Otherwise, the key is not present. .TP \fBupdate region\fR \fIX0\fR, \fIY0\fR, \fIwidth\fR, \fIheight\fR . Update region of the current subimage, if subimage has not the same size as the full image. The pixel outside of this box are all fully transparent. .PP .VE 8.7 .SH CREDITS .PP The photo image type was designed and implemented by Paul Mackerras, based on his earlier photo widget and some suggestions from John Ousterhout. .SH EXAMPLE .PP |
︙ | ︙ |
Changes to doc/place.n.
︙ | ︙ | |||
193 194 195 196 197 198 199 | .TP \fBplace content \fIwindow\fR Returns a list of all the content windows for which \fIwindow\fR is the container. If there is no content for \fIwindow\fR then an empty string is returned. .TP \fBplace slaves \fIwindow\fR . | | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | .TP \fBplace content \fIwindow\fR Returns a list of all the content windows for which \fIwindow\fR is the container. If there is no content for \fIwindow\fR then an empty string is returned. .TP \fBplace slaves \fIwindow\fR . Synonym for \fBplace content \fIwindow\fR. .PP If the configuration of a window has been retrieved with \fBplace info\fR, that configuration can be restored later by first using \fBplace forget\fR to erase any existing information for the window and then invoking \fBplace configure\fR with the saved information. .SH "FINE POINTS" |
︙ | ︙ |
Added doc/print.n.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | .\" Text automatically generated by txt2man '\" '\" Copyright (c) 2021 Kevin Walzer/WordTech Communications LLC. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. .TH tk print n "" Tk "Tk Built-in Commands" .so man.macros .SH NAME print \- Print canvas and text widgets using native dialogs and APIs. .SH SYNOPSIS \fBtk print \fIwindow\fR . .SH DESCRIPTION .PP The \fBtk print\fR command posts a dialog that allows users to print output from the \fBcanvas\fR and \fBtext\fR widgets. The printing will be done using platform-native APIs and dialogs where available. .PP The \fBcanvas\fR widget has long supported PostScript export and both PostScript and text files can be sent directly to a printer on Unix-like systems using the .QW "lp" and .QW "lpr" Unix commands, and the \fBtk print\fR command does not supersede that functionality; it builds on it. The \fBtk print\fR command is a fuller implementation that uses native dialogs on macOS and Windows, and a Tk-based dialog that provides parallel functionality on X11. .SH PLATFORM NOTES .TP \fBmacOS\fR . The Mac implementation uses native print dialogs and relies on the underlying Common Unix Printing System (CUPS) to render text output from the text widget and PostScript output from the canvas widget to the printer, to a PDF file, or a PostScript file. .TP \fBWindows\fR . The Windows implementation is based on the GDI (Graphics Device Interface) API. Because there are slight differences in how GDI and Tk's \fBcanvas\fR widget display graphics, printed output from the \fBcanvas\fR on Windows may not be identical to screen rendering. .TP \fBX11\fR . The X11 implementation uses a Tk GUI to configure print jobs for sending to a printer via the .QW "lpr" or .QW "lp" commands. While these commands have a large number of parameters for configuring print jobs, printers vary widely in how they support these parameters. As a result, only printer selection and number of copies are configured as arguments to the print command; many aspects of print rendering, such as grayscale or color for the canvas, are instead configured when PostScript is generated. .SH "SEE ALSO" canvas(n), text(n), tk(n) .SH KEYWORDS print, output, graphics, text, canvas |
Changes to doc/spinbox.n.
︙ | ︙ | |||
220 221 222 223 224 225 226 | associated \fB\-textvariable\fR during validation, as that can cause the spinbox widget to become out of sync with the \fB\-textvariable\fR. .PP Also, the \fB-validate\fR option will set itself to \fBnone\fR when the spinbox value gets changed because of adjustment of \fB-from\fR or \fB-to\fR and the \fB-validatecommand\fR returns false. For instance .CS | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | associated \fB\-textvariable\fR during validation, as that can cause the spinbox widget to become out of sync with the \fB\-textvariable\fR. .PP Also, the \fB-validate\fR option will set itself to \fBnone\fR when the spinbox value gets changed because of adjustment of \fB-from\fR or \fB-to\fR and the \fB-validatecommand\fR returns false. For instance .CS \fIspinbox pathName \-from 1 \-to 10 \-validate all \-validatecommand {return 0}\fR .CE will in fact set the \fB-validate\fR option to \fBnone\fR because the default value for the spinbox gets changed (due to the \fB-from\fR and \fB-to\fR options) to a value not accepted by the validation script. .PP Moreover, forced validation is performed when invoking any spinbutton of the spinbox. If the validation script returns false in this situation, |
︙ | ︙ |
Added doc/sysnotify.n.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | .\" Text automatically generated by txt2man '\" '\" Copyright (c) 2020 Kevin Walzer/WordTech Communications LLC. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH tk sysnotify n "" Tk "Tk Built-In Commands" .so man.macros .SH NAME sysnotify \- Creates a notification window with a title and message. .SH SYNOPSIS \fBtk sysnotify\fR \fItitle\fR \fImessage\fR .BE .SH DESCRIPTION .PP The \fBtk sysnotify\fR command creates a platform-specific system notification alert. Its intent is to provide a brief, unobtrusive notification to the user by popping up a window that briefly appears in a corner of the screen. .SH EXAMPLE .PP Here is an example of the \fBtk sysnotify\fR code: .PP .CS tk sysnotify "Alert" \e "This is just a test of the Tk System Notification Code." .CE .SH PLATFORM NOTES .PP The macOS and Windows versions are native implementations using system API's. The X11 version has a conditional dependency on libnotify, and falls back to a Tcl-only implementation if libnotify is not installed. On each platform the notification includes a platform-specific default image to accompany the text. .TP \fBmacOS\fR . The macOS version will request permission from the user to authorize notifications. This must be activated in Apple's System Preferences Notifications section. .RS .PP If deploying an application using the standalone version of Wish.app, setting the bundle ID in the applications Info.plist file to begin with .QW \fBcom\fR seems necessary for notifications to work. Using a different prefix for the bundle ID, such as something like .QW \fBtk.tcl.tkchat\fR , will cause notifications to silently fail. .RE .TP \fBWindows\fR . The image is taken from the system tray, i.e., \fBsysnotify\fR can only be called when a \fBsystray\fR was installed. . .SH KEYWORDS notify, alert |
Added doc/systray.n.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | .\" Text automatically generated by txt2man '\" '\" Copyright (c) 2020 Kevin Walzer/WordTech Communications LLC. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH tk systray n "" Tk "Tk Built-In Commands" .so man.macros .SH NAME systray \- Creates an icon display in the platform-specific system tray. .SH SYNOPSIS \fBtk systray create \fI-image image\fR \fI?-text text\fR? \fI?-button1 callback?\fR \fI?-button3 callback?\fR .sp \fBtk systray configure \fI?option? ?value option value ...?\fR .sp \fBtk systray destroy\fR .BE .BE .SH DESCRIPTION .PP The \fBtk systray create\fR command creates an icon in the platform-specific tray. The widget is configured with a Tk image for the icon display, an optional string for display in a tooltip, and optional callbacks that are bound to <Button-1> and <Button-3>. .PP The \fBtk systray configure\fR command sets one or more options of the systray icon. Configurable options are the same as for the \fBcreate\fR subcommand. When a single option name is given, the command returns the current valus of this option. When no option is given this command returns the list of all options and their current value. .PP The \fBtk systray destroy\fR command removes the icon from display and deallocates it. .PP From a user-interface standpoint, only one icon per interpreter is supported; attempts to create additional icons will return an error. The existing tray icon can be modified with different images and strings to indicate app state. Loading additional interpreters into a running instance of Wish will allow additional icons to be displayed. .SH EXAMPLE .PP Here is an example of the \fBtk systray\fR code: .CS image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== tk systray create -image book -text "tk systray sample" -button1 {puts "Here is the tk systray output"} -button3 {puts "here is alternate output"} .CE .PP Here is an example of modifying the \fBtk systray\fR icon: .CS image create photo book_page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7 tk systray configure -image book_page -text "Updated sample" -button1 {puts "Different output from the tk systray"} -button3 {puts "and more different output from the tk systray"} .CE .SH PLATFORM NOTES .PP The X11 implementation is supported on a "best efforts" basis because it is dependent on the window manager. The "text" flag, which is implemented as a tooltip, does not always display if the WM does not support such features; the systray icon itself may not even display with some window managers. .PP On Windows, the Tk image provided in the \fI-image\fR option must be a photo image. On other platforms either a bitmap image or a photo image may be provided. .SH KEYWORDS image, callback |
Changes to doc/text.n.
︙ | ︙ | |||
843 844 845 846 847 848 849 850 851 852 853 854 855 856 | .IP [3] If the selection is claimed away by another application or by another window within this application, then the \fBsel\fR tag will be removed from all characters in the text. .IP [4] Whenever the \fBsel\fR tag range changes a virtual event \fB<<Selection>>\fR is generated. .PP The \fBsel\fR tag is automatically defined when a text widget is created, and it may not be deleted with the .QW "\fIpathName \fBtag delete\fR" widget command. Furthermore, the \fB\-selectbackground\fR, \fB\-selectborderwidth\fR, and \fB\-selectforeground\fR options for the text widget are tied to the \fB\-background\fR, \fB\-borderwidth\fR, and | > > > | 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | .IP [3] If the selection is claimed away by another application or by another window within this application, then the \fBsel\fR tag will be removed from all characters in the text. .IP [4] Whenever the \fBsel\fR tag range changes a virtual event \fB<<Selection>>\fR is generated. It might also be generated when selection is affected but not actually changed. Further, multiple selection changes could happen before events can be processed leading to multiple events with the same visible selection. .PP The \fBsel\fR tag is automatically defined when a text widget is created, and it may not be deleted with the .QW "\fIpathName \fBtag delete\fR" widget command. Furthermore, the \fB\-selectbackground\fR, \fB\-selectborderwidth\fR, and \fB\-selectforeground\fR options for the text widget are tied to the \fB\-background\fR, \fB\-borderwidth\fR, and |
︙ | ︙ | |||
1348 1349 1350 1351 1352 1353 1354 | given, then, within each range, only those characters which are not elided will be returned. This may have the effect that some of the returned ranges are empty strings. .TP \fIpathName \fBimage \fIoption \fR?\fIarg ...\fR? . This command is used to manipulate embedded images. The behavior of the | | | 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 | given, then, within each range, only those characters which are not elided will be returned. This may have the effect that some of the returned ranges are empty strings. .TP \fIpathName \fBimage \fIoption \fR?\fIarg ...\fR? . This command is used to manipulate embedded images. The behavior of the command depends on the \fIoption\fR argument that follows the \fBimage\fR argument. The following forms of the command are currently supported: .RS .TP \fIpathName \fBimage cget \fIindex option\fR . Returns the value of a configuration option for an embedded image. \fIIndex\fR identifies the embedded image, and \fIoption\fR specifies a particular |
︙ | ︙ | |||
1730 1731 1732 1733 1734 1735 1736 | \fIsequence\fR (an error occurs if there is no such binding). If both \fIscript\fR and \fIsequence\fR are omitted then the command returns a list of all the sequences for which bindings have been defined for \fItagName\fR. .RS .PP The only events for which bindings may be specified are those related to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR, \fBButton\fR, | | > | | > | | 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 | \fIsequence\fR (an error occurs if there is no such binding). If both \fIscript\fR and \fIsequence\fR are omitted then the command returns a list of all the sequences for which bindings have been defined for \fItagName\fR. .RS .PP The only events for which bindings may be specified are those related to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR, \fBButton\fR, \fBMotion\fR, and \fBKey\fR) or virtual events. Mouse and keyboard event bindings for a text widget respectively use the \fBcurrent\fR and \fBinsert\fR marks described under \fBMARKS\fR above. An \fBEnter\fR event triggers for a tag when the tag first becomes present on the current character, and a \fBLeave\fR event triggers for a tag when it ceases to be present on the current character. \fBEnter\fR and \fBLeave\fR events can happen either because the \fBcurrent\fR mark moved or because the character at that position changed. Note that these events are different than \fBEnter\fR and \fBLeave\fR events for windows. Mouse events are directed to the current character, while keyboard events are directed to the insert character. If a virtual event is used in a binding, that binding can trigger only if the virtual event is defined by an underlying mouse-related or keyboard-related event. .PP It is possible for the current character to have multiple tags, and for each of them to have a binding for a particular event sequence. When this occurs, one binding is invoked for each tag, in order from lowest-priority to highest priority. If there are multiple matching bindings for a single tag, then the |
︙ | ︙ | |||
2029 2030 2031 2032 2033 2034 2035 | Tk automatically creates class bindings for texts that give them the following default behavior. In the descriptions below, .QW word is dependent on the value of the \fBtcl_wordchars\fR variable. See \fBtclvars\fR(n). .IP [1] | | | 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 | Tk automatically creates class bindings for texts that give them the following default behavior. In the descriptions below, .QW word is dependent on the value of the \fBtcl_wordchars\fR variable. See \fBtclvars\fR(n). .IP [1] Clicking mouse button 1 positions the insertion cursor at the closest edge of the character underneath the mouse cursor, sets the input focus to this widget, and clears any selection in the widget. Dragging with mouse button 1 strokes out a selection between the insertion cursor and the character under the mouse. .IP [2] Double-clicking with mouse button 1 selects the word under the mouse and positions the insertion cursor at the start of the word. Dragging after a |
︙ | ︙ |
Changes to doc/tk.n.
︙ | ︙ | |||
81 82 83 84 85 86 87 88 89 90 91 92 93 94 | inactivity time is forbidden in safe interpreters and will throw an error if tried. .RE .TP \fBtk fontchooser \fIsubcommand\fR ... Controls the Tk font selection dialog. For more details see the \fBfontchooser\fR manual page. .TP \fBtk scaling \fR?\fB\-displayof \fIwindow\fR? ?\fInumber\fR? . Sets and queries the current scaling factor used by Tk to convert between physical units (for example, points, inches, or millimeters) and pixels. The \fInumber\fR argument is a floating point number that specifies the number of pixels per point on \fIwindow\fR's display. If the \fIwindow\fR argument is | > > > > > > > | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | inactivity time is forbidden in safe interpreters and will throw an error if tried. .RE .TP \fBtk fontchooser \fIsubcommand\fR ... Controls the Tk font selection dialog. For more details see the \fBfontchooser\fR manual page. .TP \fBtk print \fIwindow\fR . The \fBtk print\fR command posts a dialog that allows users to print output from the \fBcanvas\fR and \fBtext\fR widgets. The printing will be done using platform-native APIs and dialogs where available. For more details see the \fBprint\fR manual page. .TP \fBtk scaling \fR?\fB\-displayof \fIwindow\fR? ?\fInumber\fR? . Sets and queries the current scaling factor used by Tk to convert between physical units (for example, points, inches, or millimeters) and pixels. The \fInumber\fR argument is a floating point number that specifies the number of pixels per point on \fIwindow\fR's display. If the \fIwindow\fR argument is |
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | factor is set when the application starts, based on properties of the installed monitor, but it can be changed at any time. Measurements made after the scaling factor is changed will use the new scaling factor, but it is undefined whether existing widgets will resize themselves dynamically to accommodate the new scaling factor. .RE .TP \fBtk useinputmethods \fR?\fB\-displayof \fIwindow\fR? ?\fIboolean\fR? . Sets and queries the state of whether Tk should use XIM (X Input Methods) for filtering events. The resulting state is returned. XIM is used in some locales (i.e., Japanese, Korean), to handle special input devices. This feature is only significant on X. If XIM support is not available, this will always return 0. If the \fIwindow\fR argument is omitted, it defaults to the main window. If the \fIboolean\fR argument is omitted, the current state is returned. This is turned on by default for the main display. .TP \fBtk windowingsystem\fR . Returns the current Tk windowing system, one of \fBx11\fR (X11-based), \fBwin32\fR (MS Windows), or \fBaqua\fR (Mac OS X Aqua). .SH "SEE ALSO" | > > > > > > > > > > > > | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | factor is set when the application starts, based on properties of the installed monitor, but it can be changed at any time. Measurements made after the scaling factor is changed will use the new scaling factor, but it is undefined whether existing widgets will resize themselves dynamically to accommodate the new scaling factor. .RE .TP \fBtk sysnotify \fP \fItitle\fP? \fImessage\fP? . The \fBtk sysnotify\fP command creates a platform-specific system notification alert. Its intent is to provide a brief, unobtrusive notification to the user by popping up a window that briefly appears in a corner of the screen. For more details see the \fBsysnotify\fR manual page. .TP \fBtk systray create\fP \fIsubcommand...\fP . The \fBtk systray\fP command creates an icon in the platform-specific tray. For more details see the \fBsystray\fR manual page. .TP \fBtk useinputmethods \fR?\fB\-displayof \fIwindow\fR? ?\fIboolean\fR? . Sets and queries the state of whether Tk should use XIM (X Input Methods) for filtering events. The resulting state is returned. XIM is used in some locales (i.e., Japanese, Korean), to handle special input devices. This feature is only significant on X. If XIM support is not available, this will always return 0. If the \fIwindow\fR argument is omitted, it defaults to the main window. If the \fIboolean\fR argument is omitted, the current state is returned. This is turned on by default for the main display. .TP \fBtk windowingsystem\fR . Returns the current Tk windowing system, one of \fBx11\fR (X11-based), \fBwin32\fR (MS Windows), or \fBaqua\fR (Mac OS X Aqua). .SH "SEE ALSO" busy(n), fontchooser(n), print(n), send(n), sysnotify(n), systray(n), winfo(n) .SH KEYWORDS application name, print, send, sysnotify, systray '\" Local Variables: '\" mode: nroff '\" End: |
Deleted doc/tk4.0.ps.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to doc/tk_mac.n.
︙ | ︙ | |||
214 215 216 217 218 219 220 | .SH "ADDITIONAL DIALOGS" .PP The Aqua/Mac OS X defines additional dialogs that applications should support. .TP \fB::tk::mac::standardAboutPanel\fR . | | | | > > > > | < > > > | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | .SH "ADDITIONAL DIALOGS" .PP The Aqua/Mac OS X defines additional dialogs that applications should support. .TP \fB::tk::mac::standardAboutPanel\fR . Brings the standard Cocoa about panel to the front with information filled in from the application bundle files. The panel displays the application icon and the values associated to the info.plist keys named CFBundleName, CFBundleShortVersionString, NSAboutPanelOptionVersion and NSHumanReadableCopyright. If a file named \fICredits.html\fR or \fICredits.rtf\fR exists in the bundle's Resources directory then its contents will be displayed in a scrolling text box at the bottom of the dialog. See the documentation for -[NSApplication orderFrontStandardAboutPanelWithOptions:] for more details. A hook is also provided for a custom About dialog. If a Tcl proc named tkAboutDialog is defined in the main interpreter then that procedure will be called instead of opening the standardAboutPanel. .SH "SYSTEM CONFIGURATION" .PP There are a number of additional global configuration options that control the details of how Tk renders by default. .TP \fB::tk::mac::useCompatibilityMetrics \fIboolean\fR . |
︙ | ︙ |
Changes to doc/tkvars.n.
︙ | ︙ | |||
22 23 24 25 26 27 28 | This variable holds the file name for a directory containing a library of Tcl scripts related to Tk. These scripts include an initialization file that is normally processed whenever a Tk application starts up, plus other files containing procedures that implement default behaviors for widgets. .RS .PP | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | This variable holds the file name for a directory containing a library of Tcl scripts related to Tk. These scripts include an initialization file that is normally processed whenever a Tk application starts up, plus other files containing procedures that implement default behaviors for widgets. .RS .PP The initial value of \fBtk_library\fR is set when Tk is added to an interpreter; this is done by searching several different directories until one is found that contains an appropriate Tk startup script. If the \fBTK_LIBRARY\fR environment variable exists, then the directory it names is checked first. If \fBTK_LIBRARY\fR is not set or does not refer to an appropriate directory, then Tk checks several other directories based on a compiled-in default location, the location of the Tcl library directory, |
︙ | ︙ | |||
46 47 48 49 50 51 52 | Contains a dot-separated sequence of decimal integers giving the current patch level for Tk. The patch level is incremented for each new release or patch, and it uniquely identifies an official version of Tk. .RS .PP This value is normally the same as the result of | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | Contains a dot-separated sequence of decimal integers giving the current patch level for Tk. The patch level is incremented for each new release or patch, and it uniquely identifies an official version of Tk. .RS .PP This value is normally the same as the result of .QW "\fBpackage require\fR \fBtk\fR" . .RE .TP \fBtk_strictMotif\fR . This variable is set to zero by default. If an application sets it to one, then Tk attempts to adhere as closely as possible to Motif look-and-feel standards. |
︙ | ︙ |
Changes to doc/toplevel.n.
︙ | ︙ | |||
36 37 38 39 40 41 42 | been created with the \fBimage create\fR command. If specified as the empty string, no image will be displayed. .VE "8.7, TIP262" .OP \-class class Class Specifies a class for the window. This class will be used when querying the option database for the window's other options, and it will also be used later for | | > > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | been created with the \fBimage create\fR command. If specified as the empty string, no image will be displayed. .VE "8.7, TIP262" .OP \-class class Class Specifies a class for the window. This class will be used when querying the option database for the window's other options, and it will also be used later for other purposes such as bindings. Some window managers display the class name for windows in their dock while some others display the window title. The \fB\-class\fR option may not be changed with the \fBconfigure\fR widget command. .OP \-colormap colormap Colormap Specifies a colormap to use for the window. The value may be either \fBnew\fR, in which case a new colormap is created for the window and its children, or the name of another window (which must be on the same screen and have the same visual |
︙ | ︙ |
Changes to doc/ttk_button.n.
︙ | ︙ | |||
44 45 46 47 48 49 50 | .\" .OP \-foreground foreground Foreground .\" .OP \-font font Font .\" .OP \-anchor anchor Anchor .\" .OP \-relief relief Relief .SH "WIDGET COMMAND" .PP In addition to the standard | | > > | > > > > > > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | .\" .OP \-foreground foreground Foreground .\" .OP \-font font Font .\" .OP \-anchor anchor Anchor .\" .OP \-relief relief Relief .SH "WIDGET COMMAND" .PP In addition to the standard \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 \fBTtk::button\fR widgets support the \fBToolbutton\fR style in all standard themes, which is useful for creating widgets for toolbars. .PP In the Aqua theme there are several other styles which can be used to produce replicas of many of the different button types that are discussed in Apple's Human Interface Guidelines. These include \fBDisclosureButton\fR, \fBDisclosureTriangle\fR, \fBHelpButton\fR, \fBImageButton\fR, \fBInlineButton\fR, \fBGradientButton\fR, \fBRoundedRectButton\fR, and \fBRecessedButton\fR. .SH "STYLING OPTIONS" .PP The class name for a \fBttk::button\fP is \fBTButton\fP. .PP Dynamic states: \fBactive\fP, \fBdisabled\fP, \fBpressed\fP, \fBreadonly\fP. .PP \fBTButton\fP styling options configurable with \fBttk::style\fP |
︙ | ︙ |
Changes to doc/ttk_checkbutton.n.
︙ | ︙ | |||
33 34 35 36 37 38 39 | when the widget is selected. Defaults to \fB1\fR. .OP \-variable variable Variable 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 | | > > | < | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | when the widget is selected. Defaults to \fB1\fR. .OP \-variable variable Variable 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 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 to the \fB\-offvalue\fR and deselects the widget; otherwise, sets the \fB\-variable\fR to the \fB\-onvalue\fR |
︙ | ︙ |
Changes to doc/ttk_combobox.n.
︙ | ︙ | |||
51 52 53 54 55 56 57 | .OP \-values values Values Specifies the list of values to display in the drop-down listbox. .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 | | < | < > | < < | < < < < < < < < < < < < < | < < < < < < < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | .OP \-values values Values Specifies the list of values to display in the drop-down listbox. .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 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 the last element of the list). 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 \fBset\fR \fIvalue\fR Sets the value of the combobox to \fIvalue\fR. .PP The combobox widget also supports the following \fBttk::entry\fR widget commands: .DS .ta 5.5c 11c \fBbbox\fR \fBdelete\fR \fBicursor\fR \fBindex\fR \fBinsert\fR \fBselection\fR \fBxview\fR .DE .SH "VIRTUAL EVENTS" .PP The combobox widget generates a \fB<<ComboboxSelected>>\fR virtual event when the user selects an element from the list of values. If the selection action unposts the listbox, this event is delivered after the listbox is unposted. .SH "STYLING OPTIONS" |
︙ | ︙ |
Changes to doc/ttk_entry.n.
︙ | ︙ | |||
135 136 137 138 139 140 141 | .QW \fBe\fR or .QW \fBsel.l\fR . In general, out-of-range indices are automatically rounded to the nearest legal value. .SH "WIDGET COMMAND" .PP | > > > > | < < < < < < < < < < < < < < < < | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | .QW \fBe\fR or .QW \fBsel.l\fR . In general, out-of-range indices are automatically rounded to the nearest legal value. .SH "WIDGET COMMAND" .PP 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 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 \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 one to delete. If \fIlast\fR is not specified it defaults to \fIfirst\fR+1, i.e. a single character is deleted. This command returns the empty string. .TP \fIpathName \fBget\fR 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 \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 \fBselection \fIoption arg\fR This command is used to adjust the selection within an entry. It has several forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBselection clear\fR |
︙ | ︙ | |||
207 208 209 210 211 212 213 | \fIpathName \fBselection range \fIstart\fR \fIend\fR Sets the selection to include the characters starting with 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 | < < < < < < < < < < < < | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | \fIpathName \fBselection range \fIstart\fR \fIend\fR Sets the selection to include the characters starting with 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 \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. .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" .PP There are two main validation modes: \fIprevalidation\fR, |
︙ | ︙ |
Changes to doc/ttk_frame.n.
︙ | ︙ | |||
31 32 33 34 35 36 37 | Defaults to \fBflat\fR. .OP \-width width Width 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 | | | > | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | Defaults to \fBflat\fR. .OP \-width width Width 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 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 over the \fBframe\fR widget's \fB\-width\fR and \fB\-height\fR options. \fBpack propagate\fR and \fBgrid propagate\fR can be used |
︙ | ︙ |
Changes to doc/ttk_image.n.
︙ | ︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 | or vertically (\fB\-sticky ns\fR), subregions of the image are replicated to fill the parcel based on the \fB\-border\fR option. The \fB\-border\fR divides the image into 9 regions: four fixed corners, top and left edges (which may be tiled horizontally), left and right edges (which may be tiled vertically), and the central area (which may be tiled in both directions). .SH "EXAMPLE" .PP .CS set img1 [image create photo \-file button.png] set img2 [image create photo \-file button-pressed.png] set img3 [image create photo \-file button-active.png] | > > > | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | or vertically (\fB\-sticky ns\fR), subregions of the image are replicated to fill the parcel based on the \fB\-border\fR option. The \fB\-border\fR divides the image into 9 regions: four fixed corners, top and left edges (which may be tiled horizontally), left and right edges (which may be tiled vertically), and the central area (which may be tiled in both directions). .PP An image element that is not meant to claim any space (for example when used as a background image) should use \fB\-width 0\fR and \fB\-height 0\fR. .SH "EXAMPLE" .PP .CS set img1 [image create photo \-file button.png] set img2 [image create photo \-file button-pressed.png] set img3 [image create photo \-file button-active.png] ttk::style element create Button.button image \e [list $img1 pressed $img2 active $img3] \e \-border {2 4} \-sticky we .CE .SH "SEE ALSO" ttk::intro(n), ttk::style(n), ttk_vsapi(n), image(n), photo(n) .SH KEYWORDS style, theme, appearance, pixmap theme, image |
︙ | ︙ |
Changes to doc/ttk_label.n.
︙ | ︙ | |||
38 39 40 41 42 43 44 | Specifies the maximum line length (in pixels). If this option is less than or equal to zero, 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 | | | > | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | Specifies the maximum line length (in pixels). If this option is less than or equal to zero, 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 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. .PP \fBTLabel\fP styling options configurable with \fBttk::style\fP |
︙ | ︙ |
Changes to doc/ttk_labelframe.n.
︙ | ︙ | |||
58 59 60 61 62 63 64 | The underlined character is used for mnemonic activation. Mnemonic activation for a \fBttk::labelframe\fR 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 | | | > | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | The underlined character is used for mnemonic activation. Mnemonic activation for a \fBttk::labelframe\fR 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 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. .PP Dynamic states: \fBdisabled\fP, \fBreadonly\fP. |
︙ | ︙ |
Changes to doc/ttk_menubutton.n.
︙ | ︙ | |||
34 35 36 37 38 39 40 | To be on the safe side, the menu ought to be a direct child of the menubutton. .\" not documented: may go away: .\" .OP \-anchor anchor Anchor .\" .OP \-padding padding Pad .SH "WIDGET COMMAND" .PP | | | > | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | To be on the safe side, the menu ought to be a direct child of the menubutton. .\" not documented: may go away: .\" .OP \-anchor anchor Anchor .\" .OP \-padding padding Pad .SH "WIDGET COMMAND" .PP 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" .PP The class name for a \fBttk::menubutton\fP is \fBTMenubutton\fP. |
︙ | ︙ |
Changes to doc/ttk_notebook.n.
︙ | ︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 | .IP \(bu The literal string .QW \fBend\fR , which returns the number of tabs (only valid for .QW "\fIpathname \fBindex\fR" ). .SH "WIDGET COMMAND" .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 | > > > > > > < < < < < < | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | .IP \(bu The literal string .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 \fBforget \fItabid\fR Removes the tab specified by \fItabid\fR, unmaps and unmanages the associated window. .TP \fIpathname \fBhide \fItabid\fR Hides the tab specified by \fItabid\fR. The tab will not be displayed, but the associated window |
︙ | ︙ | |||
147 148 149 150 151 152 153 | Inserts a pane at the specified position. \fIpos\fR is either the string \fBend\fR, an integer index, 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 | < < < < < < | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | Inserts a pane at the specified position. \fIpos\fR is either the string \fBend\fR, an integer index, 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 \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 \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, returns the value of that \fIoption\fR. Otherwise, sets the \fI\-option\fRs to the corresponding \fIvalue\fRs. |
︙ | ︙ |
Changes to doc/ttk_panedwindow.n.
︙ | ︙ | |||
44 45 46 47 48 49 50 | .SH "PANE OPTIONS" The following options may be specified for each pane: .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" | > > | > | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | .SH "PANE OPTIONS" The following options may be specified for each pane: .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" .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 \fIpathname \fBforget \fIpane\fR Removes the specified subpane from the widget. |
︙ | ︙ | |||
102 103 104 105 106 107 108 | Sash positions are further constrained to be between 0 and the total size of the widget. .\" 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. | < < < < < < < < | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | Sash positions are further constrained to be between 0 and the total size of the widget. .\" 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. .SH "VIRTUAL EVENTS" .PP The panedwindow widget generates an \fB<<EnteredChild>>\fR virtual event on LeaveNotify/NotifyInferior events, because Tk does not execute binding scripts for <Leave> events when the pointer crosses from a parent to a child. The panedwindow widget needs to know when that happens. .SH "STYLING OPTIONS" |
︙ | ︙ |
Changes to doc/ttk_progressbar.n.
︙ | ︙ | |||
62 63 64 65 66 67 68 | .OP \-variable variable Variable The name of a global Tcl variable which is linked to the \fB\-value\fR. 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 | < | < < | < < | < | < < | < < < | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | .OP \-variable variable Variable The name of a global Tcl variable which is linked to the \fB\-value\fR. 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 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 \fBstep\fR ?\fIamount\fR? Increments the \fB\-value\fR by \fIamount\fR. \fIamount\fR defaults to 1.0 if omitted. .TP \fIpathName \fBstop\fR Stop autoincrement mode: cancels any recurring timer event initiated by \fIpathName \fBstart\fR. |
︙ | ︙ |
Changes to doc/ttk_radiobutton.n.
︙ | ︙ | |||
33 34 35 36 37 38 39 | when the widget is selected. .OP \-variable variable Variable 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 | | > > | < | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | when the widget is selected. .OP \-variable variable Variable 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 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 string if no \fB\-command\fR is specified. .\" Missing: select, deselect. Useful? |
︙ | ︙ |
Changes to doc/ttk_scale.n.
︙ | ︙ | |||
47 48 49 50 51 52 53 | .OP \-variable variable Variable Specifies the name of a global variable to link to the scale. Whenever the 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 | < | < < > > | < < < | < < < < < < < < < < < < < < < | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | .OP \-variable variable Variable Specifies the name of a global variable to link to the scale. Whenever the 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 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 \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. .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 The class name for a \fBttk::scale\fP is \fBTScale\fP. .PP Dynamic states: \fBactive\fP. .PP \fBTScale\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-background\fP \fIcolor\fP .br \fB\-borderwidth\fP \fIamount\fP .br \fB\-darkcolor\fP \fIcolor\fP |
︙ | ︙ |
Changes to doc/ttk_scrollbar.n.
︙ | ︙ | |||
43 44 45 46 47 48 49 | or \fByview\fR (for vertical scrollbars). .RE .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the scrollbar. .SH "WIDGET COMMAND" .PP | < | < < | > | > < < < < < < < < < < | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | or \fByview\fR (for vertical scrollbars). .RE .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the scrollbar. .SH "WIDGET COMMAND" .PP 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 \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. .SH "INTERNAL COMMANDS" .PP The following widget commands are used internally by the \fBTScrollbar\fP widget class bindings. .TP \fIpathName \fBdelta \fIdeltaX deltaY\fR Returns a real number indicating the fractional change in |
︙ | ︙ |
Changes to doc/ttk_separator.n.
︙ | ︙ | |||
22 23 24 25 26 27 28 | .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the separator. .SH "WIDGET COMMAND" .PP | | | > | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | .SE .SH "WIDGET-SPECIFIC OPTIONS" .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 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 \fBTSeparator\fP styling options configurable with \fBttk::style\fP are: |
︙ | ︙ |
Changes to doc/ttk_sizegrip.n.
︙ | ︙ | |||
19 20 21 22 23 24 25 | by pressing and dragging the grip. .SO ttk_widget \-class \-cursor \-style \-takefocus .SE .SH "WIDGET COMMAND" .PP | | | > | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | by pressing and dragging the grip. .SO ttk_widget \-class \-cursor \-style \-takefocus .SE .SH "WIDGET COMMAND" .PP 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 the built-in grip will just mask the widget. .SH EXAMPLES |
︙ | ︙ |
Changes to doc/ttk_style.n.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ttk::style \- Manipulate style database .SH SYNOPSIS \fBttk::style\fR \fIoption\fR ?\fIargs\fR? .BE .SH NOTES .PP See also the Tcl'2004 conference presentation, | | > > > > > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ttk::style \- Manipulate style database .SH SYNOPSIS \fBttk::style\fR \fIoption\fR ?\fIargs\fR? .BE .SH NOTES .PP See also the Tcl'2004 conference presentation, available at http://tktable.sourceforge.net/tile/tile-tcl2004.pdf .SH DEFINITIONS .PP Each widget is assigned a \fIstyle\fR, which specifies the set of elements making up the widget and how they are arranged, along with dynamic and default settings for element options. 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? Creates a new element in the current theme of type \fItype\fR. The only cross-platform built-in element type is \fIimage\fR |
︙ | ︙ | |||
64 65 66 67 68 69 70 71 72 | \fIstate\fR is a list of state names; if omitted, it defaults to all bits off (the .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. .TP \fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR? | > | > > > > > > > > > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | \fIstate\fR is a list of state names; if omitted, it defaults to all bits off (the .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 (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 ? Creates a new theme. It is an error if \fIthemeName\fR already exists. If \fB\-parent\fR is specified, the new theme will inherit styles, elements, and layouts from the parent theme \fIbasedon\fR. If \fB\-settings\fR is present, \fIscript\fR is evaluated in the context of the new theme as per \fBttk::style theme settings\fR. .TP \fBttk::style theme names\fR Returns a list of all known themes. .TP \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. .RE .SH LAYOUTS |
︙ | ︙ |
Changes to doc/ttk_treeview.n.
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | If set to \fBextended\fR (the default), multiple items may be selected. If \fBbrowse\fR, only a single item will be selected at a time. If \fBnone\fR, the selection will not be changed. .PP Note that application code and tag bindings can set the selection however they wish, regardless of the value of \fB\-selectmode\fR. .RE .OP \-show show Show A list containing zero or more of the following values, specifying which elements of the tree to display. .RS .IP \fBtree\fR Display tree labels in column #0. .IP \fBheadings\fR Display the heading row. .PP | > > > | > > > > > > > > > > > > > > > > < | > > > | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | If set to \fBextended\fR (the default), multiple items may be selected. If \fBbrowse\fR, only a single item will be selected at a time. If \fBnone\fR, the selection will not be changed. .PP Note that application code and tag bindings can set the selection however they wish, regardless of the value of \fB\-selectmode\fR. .RE .OP \-selecttype selectType SelectType Controls how the built-in class bindings manage the selection. One of \fBitem\fR or \fBcell\fR. .OP \-show show Show A list containing zero or more of the following values, specifying which elements of the tree to display. .RS .IP \fBtree\fR Display tree labels in column #0. .IP \fBheadings\fR Display the heading row. .PP The default is \fBtree headings\fR. .PP \fBNOTE:\fR Column #0 always refers to the tree column, even if \fB\-show tree\fR is not specified. .RE .OP \-striped striped Striped Boolean specifying zebra striped item coloring. Note: Striped items uses the \fB\-stripedbackground\fR option if set by the theme or a tag. If not supported by the current theme, it will not show. .OP \-titlecolumns titleColumns TitleColumns Number of display columns at the left that should not be scrolled. The tree column counts, even if \fB\-show tree\fR is not specified. Thus for value N of this option, column #N is the first one that is scrollable. Default is 0. .OP \-titleitems titleItems TitleItems Number of items at the top that should not be vertically scrolled. Default is 0. .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. If the \fIitem\fR is not visible (i.e., if it is a descendant of a closed item or is vertically scrolled offscreen), returns the empty list. If \fIcolumn\fR is specified and is not hidden (by the \fB\-displaycolumns\fR option), returns the bounding box of that cell within \fIitem\fR (even if the cell is horizontally scrolled offscreen). .TP \fIpathname \fBcellselection\fR ?\fIselop arg ...\fR? Manages cell selection. Cell selection is independent from item selection handled by the \fBselection\fR command. A cell is given by a list of two elements, item and column. For the rectangle versions of commands, the cells must be in displayed columns. Any change to \fB\-columns\fR clears the cell selection. A \fIcellList\fR argument may be a single cell or a list of cells. If \fIselop\fR is not specified, returns the list of selected cells. Otherwise, \fIselop\fR is one of the following: .RS .TP \fIpathname \fBcellselection set \fIcellList\fR \fIcellList\fR becomes the new cell selection. .TP \fIpathname \fBcellselection set \fIfirstCell\fR \fIlastCell\fR The rectangle defined becomes the new cell selection. .TP \fIpathname \fBcellselection add \fIcellList\fR Add \fIcellList\fR to the cell selection .TP \fIpathname \fBcellselection add \fIfirstCell\fR \fIlastCell\fR The rectangle defined is added to the cell selection. .TP \fIpathname \fBcellselection remove \fIcellList\fR Remove \fIcellList\fR from the cell selection .TP \fIpathname \fBcellselection remove \fIfirstCell\fR \fIlastCell\fR The rectangle defined is removed from the cell selection. .TP \fIpathname \fBcellselection toggle \fIcellList\fR Toggle the cell selection state of each cell in \fIcellList\fR. .TP \fIpathname \fBcellselection toggle \fIfirstCell\fR \fIlastCell\fR Toggle the cell selection state of each cell in the rectangle defined. .RE .TP \fIpathname \fBchildren \fIitem\fR ?\fInewchildren\fR? If \fInewchildren\fR is not specified, returns the list of children belonging to \fIitem\fR. .RS .PP If \fInewchildren\fR is specified, replaces \fIitem\fR's child list |
︙ | ︙ | |||
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | The following options may be set on each column: .RS .TP \fB\-id \fIname\fR The column name. This is a read-only option. For example, [\fI$pathname \fBcolumn #\fIn \fB\-id\fR] returns the data column associated with display column #\fIn\fR. .TP \fB\-anchor \fIanchor\fR Specifies how the text in this column should be aligned with respect to the cell. \fIAnchor\fR is one of \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. .TP \fB\-minwidth \fIminwidth\fR The minimum width of the column in pixels. The treeview widget will not make the column any smaller than \fB\-minwidth\fR when the widget is resized or the user drags a | > | > > > > | | < < < | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | The following options may be set on each column: .RS .TP \fB\-id \fIname\fR The column name. This is a read-only option. For example, [\fI$pathname \fBcolumn #\fIn \fB\-id\fR] returns the data column associated with display column #\fIn\fR. The tree column has -id \fB#0\fR. .TP \fB\-anchor \fIanchor\fR Specifies how the text in this column should be aligned with respect to the cell. \fIAnchor\fR is one of \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. .TP \fB\-minwidth \fIminwidth\fR The minimum width of the column in pixels. The treeview widget will not make the column any smaller than \fB\-minwidth\fR when the widget is resized or the user drags a heading column separator. Default is 20 pixels. .TP \fB\-separator \fIboolean\fR Specifies whether or not a column separator should be drawn to the right of the column. Default is false. .TP \fB\-stretch \fIboolean\fR Specifies whether or not the column width should be adjusted when the widget is resized or the user drags a heading column separator. \fIBoolean\fR may have any of the forms accepted by \fBTcl_GetBoolean\fR. By default columns are stretchable. .TP \fB\-width \fIwidth\fR The width of the column in pixels. Default is 200 pixels. The specified column width may be changed by Tk in order to honor \fB\-stretch\fR and/or \fB\-minwidth\fR, or when the widget is resized or the user drags a heading column separator. .PP Use \fIpathname column #0\fR to configure the tree column. .RE .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 \fIpathname \fBdetach \fIitemList\fR Unlinks all of the specified items in \fIitemList\fR from the tree. |
︙ | ︙ | |||
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | will return the display column identifier of the heading to left of the separator. .IP tree The tree area. .IP cell A data cell. .RE \fIpathname \fBidentify item \fIx y\fR Returns the item ID of the item at position \fIy\fR. .TP \fIpathname \fBidentify column \fIx y\fR Returns the display column identifier of the cell at position \fIx\fR. The tree column has ID \fB#0\fR. .TP \fIpathname \fBidentify element \fIx y\fR The element at position \fIx,y\fR. .TP \fIpathname \fBidentify row \fIx y\fR Obsolescent synonym for \fIpathname \fBidentify item\fR. .PP See \fBCOLUMN IDENTIFIERS\fR for a discussion of display columns | > > > > > | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | will return the display column identifier of the heading to left of the separator. .IP tree The tree area. .IP cell A data cell. .RE .TP \fIpathname \fBidentify item \fIx y\fR Returns the item ID of the item at position \fIy\fR. .TP \fIpathname \fBidentify column \fIx y\fR Returns the display column identifier of the cell at position \fIx\fR. The tree column has ID \fB#0\fR. .TP \fIpathname \fBidentify cell \fIx y\fR Returns the cell identifier of the cell at position \fIx y\fR. A cell identifier is a list of item ID and column ID. .TP \fIpathname \fBidentify element \fIx y\fR The element at position \fIx,y\fR. .TP \fIpathname \fBidentify row \fIx y\fR Obsolescent synonym for \fIpathname \fBidentify item\fR. .PP See \fBCOLUMN IDENTIFIERS\fR for a discussion of display columns |
︙ | ︙ | |||
268 269 270 271 272 273 274 | .RS .PP \fIpathname \fBinsert\fR returns the item identifier of the newly created item. See \fBITEM OPTIONS\fR for the list of available options. .RE .TP | < < < | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | .RS .PP \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 \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, returns the value of that option. Otherwise, the item's options are updated with the specified values. |
︙ | ︙ | |||
309 310 311 312 313 314 315 316 317 318 319 320 321 322 | \fIpathname \fBsee \fIitem\fR Ensure that \fIitem\fR is visible: sets all of \fIitem\fR's ancestors to \fB\-open true\fR, and scrolls the widget if necessary so that \fIitem\fR is within the visible portion of the tree. .TP \fIpathname \fBselection\fR ?\fIselop itemList\fR? If \fIselop\fR is not specified, returns the list of selected items. Otherwise, \fIselop\fR is one of the following: .RS .TP \fIpathname \fBselection set \fIitemList\fR \fIitemList\fR becomes the new selection. .TP | > > | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | \fIpathname \fBsee \fIitem\fR Ensure that \fIitem\fR is visible: sets all of \fIitem\fR's ancestors to \fB\-open true\fR, and scrolls the widget if necessary so that \fIitem\fR is within the visible portion of the tree. .TP \fIpathname \fBselection\fR ?\fIselop itemList\fR? Manages item selection. Item selection is independent from cell selection handled by the \fBcellselection\fR command. If \fIselop\fR is not specified, returns the list of selected items. Otherwise, \fIselop\fR is one of the following: .RS .TP \fIpathname \fBselection set \fIitemList\fR \fIitemList\fR becomes the new selection. .TP |
︙ | ︙ | |||
334 335 336 337 338 339 340 | With one argument, returns a dictionary of column/value pairs for the specified \fIitem\fR. 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 | < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < < < < < | | > > | | > > > | > > > > | | | | < | | > > > > > > | > > > | > | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | With one argument, returns a dictionary of column/value pairs for the specified \fIitem\fR. 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 \fBtag \fIargs...\fR Manages tags. Tags can be set on items as well as on cells. The set of tags is shared between items and cells. However item tagging is independent from cell tagging (for instance adding a tag on an item does not also add this tag on the cells in that item). Cell tags take precedence over item tags when drawing. The following subcommands are supported: .RS .TP \fIpathName \fBtag add \fItag items\fR Adds the specified \fItag\fR to each of the listed \fIitems\fR. If \fItag\fR is already present for a particular item, then the \fB\-tags\fR for that item are unchanged. .TP \fIpathName \fBtag bind \fItagName \fR?\fIsequence\fR? ?\fIscript\fR? Add a Tk binding script for the event sequence \fIsequence\fR to the tag \fItagName\fR. When an X event is delivered to an item, binding scripts for each of the item's \fB\-tags\fR are evaluated in order as per \fIbindtags(n)\fR. If the event can be associated with a cell (i.e. mouse events) any bindings for the cell's \fB\-tags\fR are evaluated as well. .RS .PP \fB<Key>\fR, \fB<KeyRelease>\fR, and virtual events are sent to the focus item. \fB<Button>\fR, \fB<ButtonRelease>\fR, and \fB<Motion>\fR events are sent to the item under the mouse pointer. No other event types are supported. .PP The binding \fIscript\fR undergoes \fB%\fR-substitutions before evaluation; see \fBbind(n)\fR for details. .RE .TP \fIpathName \fBtag cell \fIsubcmd...\fR Manages tags on individual cells. A \fIcellList\fR argument may be a single cell or a list of cells. .RS .TP \fIpathName \fBtag cell add \fItag cellList\fR Adds the specified \fItag\fR to each of the listed \fIcellList\fR. If \fItag\fR is already present for a particular cell, then the tag list for that cell is unchanged. .TP \fIpathName \fBtag cell has \fItagName\fR ?\fIcell\fR? If \fIcell\fR is specified, returns 1 or 0 depending on whether the specified cell has the named tag. Otherwise, returns a list of all cells which have the specified tag. .TP \fIpathName \fBtag cell remove \fItag\fR ?\fIcellList\fR? Removes the specified \fItag\fR from each of the listed \fIcellList\fR. If \fIcellList\fR is omitted, removes \fItag\fR from each cell in the tree. .RE .TP \fIpathName \fBtag configure \fItagName\fR ?\fIoption\fR? ?\fIvalue option value...\fR? Query or modify the options for the specified \fItagName\fR. If one or more \fIoption/value\fR pairs are specified, sets the value of those options for the specified tag. If a single \fIoption\fR is specified, returns the value of that option (or the empty string if the option has not been specified for \fItagName\fR). With no additional arguments, returns a dictionary of the option settings for \fItagName\fR. See \fBTAG OPTIONS\fR for the list of available options. .TP \fIpathName \fBtag delete \fItagName\fR Deletes all tag information for the \fItagName\fR argument. The command removes the tag from all items and cells in the widget and also deletes any other information associated with the tag, such as bindings and display information. The command returns an empty string. .TP \fIpathName \fBtag has \fItagName\fR ?\fIitem\fR? If \fIitem\fR is specified, returns 1 or 0 depending on whether the specified item has the named tag. Otherwise, returns a list of all items which have the specified tag. .TP \fIpathName \fBtag names\fR Returns a list of all tags used by the widget. .TP \fIpathName \fBtag remove \fItag\fR ?\fIitems\fR? 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 .SH "ITEM OPTIONS" .PP The following item options may be specified for items in the \fBinsert\fR and \fBitem\fR widget commands. .IP \fB\-text\fR The textual label to display for the item in the tree column. .IP \fB\-height\fR The height for the item, in integer multiples of \fB\-rowheight\fP. Default is 1. .IP \fB\-image\fR A Tk image, displayed next to the label in the tree column, placed according to \fB-imageanchor\fR. .IP \fB\-imageanchor\fR Specifies how the \fB-image\fR is displayed relative to the text. Default is \fBw\fR. One of the standard Tk anchor values. .IP \fB\-values\fR The list of values associated with the item. .RS .PP Each item should have the same number of values as the \fB\-columns\fR widget option. If there are fewer values than columns, the remaining values are assumed empty. If there are more values than columns, the extra values are ignored. .RE .IP \fB\-hidden\fR A boolean value indicating whether this item should be displayed (\fB\-hidden false\fR) or hidden (\fB\-hidden true\fR). If a parent is hidden, all its decendants are hidden too. .IP \fB\-open\fR A boolean value indicating whether the item's children should be displayed (\fB\-open true\fR) or hidden (\fB\-open false\fR). .IP \fB\-tags\fR A list of tags associated with this item. .SH "TAG OPTIONS" .PP The following options may be specified on tags: .IP \fB\-foreground\fR Specifies the text foreground color. .IP \fB\-background\fR Specifies the cell or item background color. .IP \fB\-font\fR Specifies the font to use when drawing text. .IP \fB\-image\fR Specifies the cell or item image. .IP \fB\-imageanchor\fR Specifies the cell or item image anchor. .IP \fB\-padding\fR Specifies the cell padding. A data cell will have a default padding of {4 0} .IP \fB\-stripedbackground\fR Specifies the cell or item background color for alternate lines, if \fB\-striped\fR is true. .PP .\" .PP .\" \fI(@@@ TODO: sort out order of precedence for options)\fR .PP Tags on cells have precedence over tags on items. Then, tag priority is decided by the creation order: tags created first receive higher priority. An item's options, like \fB\-image\fR and \fB\-imageanchor\fR, have priority over tags. .SH "IMAGES" The -image option on an item, and on an item tag, controls the image next to the label in the tree column. Other cells can have images through the cell tag -image option. .SH "COLUMN IDENTIFIERS" .PP Column identifiers take any of the following forms: .IP \(bu A symbolic name from the list of \fB\-columns\fR. .IP \(bu An integer \fIn\fR, specifying the \fIn\fRth data column. |
︙ | ︙ | |||
473 474 475 476 477 478 479 | If \fB\-displaycolumns\fR is not set, then data column \fIn\fR is displayed in display column \fB#\fIn+1\fR. Again, \fBcolumn #0 always refers to the tree column\fR. .SH "VIRTUAL EVENTS" .PP The treeview widget generates the following virtual events. .IP <<TreeviewSelect>> | | > > > | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | If \fB\-displaycolumns\fR is not set, then data column \fIn\fR is displayed in display column \fB#\fIn+1\fR. Again, \fBcolumn #0 always refers to the tree column\fR. .SH "VIRTUAL EVENTS" .PP The treeview widget generates the following virtual events. .IP <<TreeviewSelect>> Generated whenever the selection or cellselection changes. It might also be generated when selection is affected but not actually changed. Further, multiple selection changes could happen before events can be processed leading to multiple events with the same visible selection. .IP <<TreeviewOpen>> Generated just before setting the focus item to \fB\-open true\fR. .IP <<TreeviewClose>> Generated just after setting the focus item to \fB\-open false\fR. .PP The \fBfocus\fR and \fBselection\fR widget commands can be used to determine the affected item or items. |
︙ | ︙ | |||
504 505 506 507 508 509 510 | .br \fB\-fieldbackground\fP \fIcolor\fP .br \fB\-font\fP \fIfont\fP .br \fB\-foreground\fP \fIcolor\fP .br | > > | > | > | > > | | < < < > > > | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | .br \fB\-fieldbackground\fP \fIcolor\fP .br \fB\-font\fP \fIfont\fP .br \fB\-foreground\fP \fIcolor\fP .br \fB\-columnseparatorwidth\fP \fIpixels\fP .br \fB\-rowheight\fP \fIpixels\fP .RS This is the standard height for an item. If \fB\-rowheight\fP is not set by the style, it is set by measuring an item and a cell layout with the style's settings. This thus picks up the font and any focus ring or padding from the theme's layout. The \fB\-rowheight\fP may need to be set to make sure that a row is large enough to contain any images. .PP Example of how to set \fB\-rowheight\fP, adapting to a font in a similar way to how the default value is set: .RE .PP .CS ttk::style configure Treeview \\ \-rowheight [expr {[font metrics \fIfont\fP \-linespace] + 2}] .CE .br \fB\-stripedbackground\fP \fIcolor\fP .PP \fBHeading\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-background\fP \fIcolor\fP .br \fB\-font\fP \fIfont\fP |
︙ | ︙ |
Changes to doc/ttk_widget.n.
︙ | ︙ | |||
79 80 81 82 83 84 85 | See also \fB\-justify\fR (for widgets supporting this option). .OP \-compound compound Compound Specifies how to display the image relative to the text, in the case both \fB\-text\fR and \fB\-image\fR are present. If set to the empty string (the default), the rules described in the "Elements" section of \fIttk::intro(n)\fR explain which value is actually used. | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | See also \fB\-justify\fR (for widgets supporting this option). .OP \-compound compound Compound Specifies how to display the image relative to the text, in the case both \fB\-text\fR and \fB\-image\fR are present. If set to the empty string (the default), the rules described in the "Elements" section of \fIttk::intro(n)\fR explain which value is actually used. The other valid values are: .RS .IP text Display text only. .IP image Display image only. .IP center Display text centered on top of image. |
︙ | ︙ | |||
170 171 172 173 174 175 176 | This is a write-only option: setting it changes the widget state, but the \fBstate\fR widget command does not affect the \fB\-state\fR option. .SH COMMANDS .TP \fIpathName \fBcget \fIoption\fR | < < < | > < < > > > | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | This is a write-only option: setting it changes the widget state, 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. If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. .\" 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 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 Returns a new state spec indicating which flags were changed: .CS set changes [\fIpathName \fRstate \fIspec\fR] \fIpathName \fRstate $changes .CE 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 .TP \fIpathName \fBxview\fR |
︙ | ︙ |
Changes to doc/wm.n.
︙ | ︙ | |||
116 117 118 119 120 121 122 | Makes the window content area transparent and turns off the window shadow. For the transparency to be effective, the toplevel background needs to be set to a color with some alpha, e.g. .QW systemTransparent . .PP On X11, the following attributes may be set. These are not supported by all window managers, and will have no effect under older WMs. | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | Makes the window content area transparent and turns off the window shadow. For the transparency to be effective, the toplevel background needs to be set to a color with some alpha, e.g. .QW systemTransparent . .PP On X11, the following attributes may be set. These are not supported by all window managers, and will have no effect under older WMs. .\" See https://www.freedesktop.org/wiki/Specifications/wm-spec/ .TP \fB\-type\fR .VS 8.6 Requests that the window should be interpreted by the window manager as being of the specified type(s). This may cause the window to be decorated in a different way or otherwise managed differently, though exactly what happens is entirely up to the window manager. A list of types may be used, in order of |
︙ | ︙ | |||
402 403 404 405 406 407 408 409 410 411 412 413 414 415 | a group of related windows. The window manager may use this information, for example, to unmap all of the windows in a group when the group's leader is iconified. \fIPathName\fR may be specified as an empty string to remove \fIwindow\fR from any group association. If \fIpathName\fR is specified then the command returns an empty string; otherwise it returns the path name of \fIwindow\fR's current group leader, or an empty string if \fIwindow\fR is not part of any group. .TP \fBwm iconbitmap \fIwindow\fR ?\fIbitmap\fR? . If \fIbitmap\fR is specified, then it names a bitmap in the standard forms accepted by Tk (see the \fBTk_GetBitmap\fR manual entry for details). This bitmap is passed to the window manager to be displayed in \fIwindow\fR's icon, and the command returns an empty string. If | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | a group of related windows. The window manager may use this information, for example, to unmap all of the windows in a group when the group's leader is iconified. \fIPathName\fR may be specified as an empty string to remove \fIwindow\fR from any group association. If \fIpathName\fR is specified then the command returns an empty string; otherwise it returns the path name of \fIwindow\fR's current group leader, or an empty string if \fIwindow\fR is not part of any group. .TP \fBwm iconbadge \fIwindow\fR \fIbadge\fR . Sets a badge for the icon of the \fIwindow\fR. The badge can be a positive integer number, for instance the number of new or unread messages, or an exclamation point denoting attention needed. If the badge is an empty string, the badge image is removed from the application icon. Managing these changes through bindings, such as <FocusIn>, is the responsibility of the developer. .RS .PP On X11, for this command to work, the variable \fB::tk::icons::base_icon($window)\fR must be set to the image that is being used for the window icon of $window. On Windows and X11, the iconphoto images work best at 32x32 or a similar dimension, as the badge images are provided by Tk and drawn to overlay the icon images using native (Windows) API's or Tk rendering. On macOS, the icon badge is rendered by a system API and is not provided by Tk. The icon image itself should be higher-resolution, preferably 512 pixels, to avoid being blurry. .PP The icon badge is intended for display in the Dock (macOS), taskbar (Windows) or app panel (X11). On macOS, the last badge called will be displayed in the Dock, regardless of how many different icon badges may be assigned to different windows. On Windows, the taskbar display depends on whether the taskbar buttons are combined or not (this is an OS setting available to the user): if combined the behavior is the same as on macOS, otherwise each button in the taskbar shows the badge it was assigned. Badge display on macOS is configured in the system preferences. App panel display behavior on X11 will depend on the window manager and/or desktop environment. .RE .TP \fBwm iconbitmap \fIwindow\fR ?\fIbitmap\fR? . If \fIbitmap\fR is specified, then it names a bitmap in the standard forms accepted by Tk (see the \fBTk_GetBitmap\fR manual entry for details). This bitmap is passed to the window manager to be displayed in \fIwindow\fR's icon, and the command returns an empty string. If |
︙ | ︙ | |||
477 478 479 480 481 482 483 | reflected to the titlebar icons. Multiple images are accepted to allow different images sizes (e.g., 16x16 and 32x32) to be provided. The window manager may scale provided icons to an appropriate size. .RS .PP On Windows, the images are packed into a Windows icon structure. This will override an ico specified to \fBwm iconbitmap\fR, and | | | > | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | reflected to the titlebar icons. Multiple images are accepted to allow different images sizes (e.g., 16x16 and 32x32) to be provided. The window manager may scale provided icons to an appropriate size. .RS .PP On Windows, the images are packed into a Windows icon structure. This will override an ico specified to \fBwm iconbitmap\fR, and vice versa. This command sets the taskbar icon for the window. .PP On X, the images are arranged into the _NET_WM_ICON X property, which most modern window managers support. A \fBwm iconbitmap\fR may exist simultaneously. It is recommended to use not more than 2 icons, placing the larger icon first. This command also sets the panel icon for the application if the window manager or desktop environment supports it. .PP On Macintosh, the first image called is loaded into an OSX-native icon format, and becomes the application icon in dialogs, the Dock, and other contexts. At the script level the command will accept only the first image passed in the parameters as support for multiple sizes/resolutions on macOS is outside Tk's scope. Developers should use the largest icon they can support |
︙ | ︙ | |||
603 604 605 606 607 608 609 | as equivalent to \fBprogram\fR. Tk will automatically set the position source to \fBuser\fR when a \fBwm geometry\fR command is invoked, unless the source has been set explicitly to \fBprogram\fR. .TP \fBwm protocol \fIwindow\fR ?\fIname\fR? ?\fIcommand\fR? . | | < | | | < < > > | | | > | | | | > | | < | | | < | > > | > > | > > > > | > > | > > | > | > | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | as equivalent to \fBprogram\fR. Tk will automatically set the position source to \fBuser\fR when a \fBwm geometry\fR command is invoked, unless the source has been set explicitly to \fBprogram\fR. .TP \fBwm protocol \fIwindow\fR ?\fIname\fR? ?\fIcommand\fR? . This command is used to manage window manager protocols. The \fIname\fR argument in the \fBwm protocol\fR command is the name of an atom corresponding to a window manager protocol. Examples include \fBWM_DELETE_WINDOW\fR or \fBWM_SAVE_YOURSELF\fR or \fBWM_TAKE_FOCUS\fR. .RS .PP A \fIwindow manager protocol\fR is a class of messages sent from a window manager to a Tk application outside of the normal event processing system. The main example is the \fBWM_DELETE_WINDOW\fR protocol; these messages are sent when the user clicks the close widget in the title bar of a window. Handlers for window manager protocols are installed with the \fBwm protocol\fR command. As a rule, if no handler has been installed for a protocol by the \fBwm protocol\fR command then all messages of that protocol are ignored. The \fBWM_DELETE_WINDOW\fR protocol is an exception to this rule. At start-up Tk installs a handler for this protocol, which responds by destroying the window. The \fBwm protocol\fR command can be used to replace this default handler by one which responds differently. .RE .RS .PP The list of available window manager protocols depends on the window manager, but all window managers supported by Tk provide \fBWM_DELETE_WINDOW\fR. On the Windows platform, a \fBWM_SAVE_YOURSELF\fR message is sent on user logout or system restart. .RE .RS .PP If both \fIname\fR and \fIcommand\fR are specified, then \fIcommand\fR becomes the handler for the protocol specified by \fIname\fR. The atom for \fIname\fR will be added to \fIwindow\fR's \fBWM_PROTOCOLS\fR property to tell the window manager that the application has a handler for the protocol specified by \fIname\fR, and \fIcommand\fR will be invoked in the future whenever the window manager sends a message of that protocol to the Tk application. In this case the \fBwm protocol\fR command returns an empty string. If \fIname\fR is specified but \fIcommand\fR is not, then the current handler for \fIname\fR is returned, or an empty string if there is no handler defined for \fIname\fR (as a special case, the default handler for \fBWM_DELETE_WINDOW\fR is not returned). If \fIcommand\fR is specified as an empty string then the atom for \fIname\fR is removed from the \fBWM_PROTOCOLS\fR property of \fIwindow\fR and the handler is destroyed; an empty string is returned. Lastly, if neither \fIname\fR nor \fIcommand\fR is specified, the \fBwm protocol\fR command returns a list of all of the protocols for which handlers are currently defined for \fIwindow\fR. .RE .TP \fBwm resizable \fIwindow\fR ?\fIwidth height\fR? . This command controls whether or not the user may interactively resize a top-level window. If \fIwidth\fR and \fIheight\fR are specified, they are boolean values that determine whether the |
︙ | ︙ |
Changes to generic/ks_names.h.
︙ | ︙ | |||
16 17 18 19 20 21 22 | { "Linefeed", 0xFF0A }, { "Clear", 0xFF0B }, { "Return", 0xFF0D }, { "Pause", 0xFF13 }, { "Scroll_Lock", 0xFF14 }, { "Sys_Req", 0xFF15 }, { "Escape", 0xFF1B }, | < < < < < > > > > > > | > > > > > | | > < < < > > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | { "Linefeed", 0xFF0A }, { "Clear", 0xFF0B }, { "Return", 0xFF0D }, { "Pause", 0xFF13 }, { "Scroll_Lock", 0xFF14 }, { "Sys_Req", 0xFF15 }, { "Escape", 0xFF1B }, { "Multi_key", 0xFF20 }, { "Kanji", 0xFF21 }, { "Muhenkan", 0xFF22 }, { "Henkan_Mode", 0xFF23 }, { "Henkan", 0xFF23 }, { "Romaji", 0xFF24 }, { "Hiragana", 0xFF25 }, { "Katakana", 0xFF26 }, { "Hiragana_Katakana", 0xFF27 }, { "Zenkaku", 0xFF28 }, { "Hankaku", 0xFF29 }, { "Zenkaku_Hankaku", 0xFF2A }, { "Touroku", 0xFF2B }, { "Massyo", 0xFF2C }, { "Kana_Lock", 0xFF2D }, { "Kana_Shift", 0xFF2E }, { "Eisu_Shift", 0xFF2F }, { "Eisu_toggle", 0xFF30 }, { "Hangul", 0xFF31 }, { "Hangul_Start", 0xFF32 }, { "Hangul_End", 0xFF33 }, { "Hangul_Hanja", 0xFF34 }, { "Hangul_Jamo", 0xFF35 }, { "Hangul_Romaja", 0xFF36 }, { "Codeinput", 0xFF37 }, { "Hangul_Jeonja", 0xFF38 }, { "Hangul_Banja", 0xFF39 }, { "Hangul_PreHanja", 0xFF3A }, { "Hangul_PostHanja", 0xFF3B }, { "SingleCandidate", 0xFF3C }, { "MultipleCandidate", 0xFF3D }, { "PreviousCandidate", 0xFF3E }, { "Hangul_Special", 0xFF3F }, { "Home", 0xFF50 }, { "Left", 0xFF51 }, { "Up", 0xFF52 }, { "Right", 0xFF53 }, { "Down", 0xFF54 }, { "Prior", 0xFF55 }, { "Page_Up", 0xFF55 }, { "Next", 0xFF56 }, { "Page_Down", 0xFF56 }, { "End", 0xFF57 }, { "Begin", 0xFF58 }, { "Select", 0xFF60 }, { "Print", 0xFF61 }, { "Execute", 0xFF62 }, { "Insert", 0xFF63 }, { "Undo", 0xFF65 }, { "Redo", 0xFF66 }, { "Menu", 0xFF67 }, #ifndef TK_NO_DEPRECATED { "App", 0xFF67 }, #endif { "Find", 0xFF68 }, { "Cancel", 0xFF69 }, { "Help", 0xFF6A }, { "Break", 0xFF6B }, { "Mode_switch", 0xFF7E }, #ifndef TK_NO_DEPRECATED { "script_switch", 0xFF7E }, { "kana_switch", 0xFF7E }, { "Arabic_switch", 0xFF7E }, { "Greek_switch", 0xFF7E }, { "Hebrew_switch", 0xFF7E }, #endif { "Num_Lock", 0xFF7F }, { "KP_Space", 0xFF80 }, { "KP_Tab", 0xFF89 }, { "KP_Enter", 0xFF8D }, { "KP_F1", 0xFF91 }, { "KP_F2", 0xFF92 }, { "KP_F3", 0xFF93 }, |
︙ | ︙ | |||
90 91 92 93 94 95 96 | { "KP_Page_Up", 0xFF9A }, { "KP_Next", 0xFF9B }, { "KP_Page_Down", 0xFF9B }, { "KP_End", 0xFF9C }, { "KP_Begin", 0xFF9D }, { "KP_Insert", 0xFF9E }, { "KP_Delete", 0xFF9F }, | < > | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | { "KP_Page_Up", 0xFF9A }, { "KP_Next", 0xFF9B }, { "KP_Page_Down", 0xFF9B }, { "KP_End", 0xFF9C }, { "KP_Begin", 0xFF9D }, { "KP_Insert", 0xFF9E }, { "KP_Delete", 0xFF9F }, { "KP_Multiply", 0xFFAA }, { "KP_Add", 0xFFAB }, { "KP_Separator", 0xFFAC }, { "KP_Subtract", 0xFFAD }, { "KP_Decimal", 0xFFAE }, { "KP_Divide", 0xFFAF }, { "KP_0", 0xFFB0 }, { "KP_1", 0xFFB1 }, { "KP_2", 0xFFB2 }, { "KP_3", 0xFFB3 }, { "KP_4", 0xFFB4 }, { "KP_5", 0xFFB5 }, { "KP_6", 0xFFB6 }, { "KP_7", 0xFFB7 }, { "KP_8", 0xFFB8 }, { "KP_9", 0xFFB9 }, { "KP_Equal", 0xFFBD }, { "F1", 0xFFBE }, { "F2", 0xFFBF }, { "F3", 0xFFC0 }, { "F4", 0xFFC1 }, { "F5", 0xFFC2 }, { "F6", 0xFFC3 }, { "F7", 0xFFC4 }, |
︙ | ︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | { "Caps_Lock", 0xFFE5 }, { "Shift_Lock", 0xFFE6 }, { "Meta_L", 0xFFE7 }, { "Meta_R", 0xFFE8 }, { "Alt_L", 0xFFE9 }, { "Alt_R", 0xFFEA }, { "Super_L", 0xFFEB }, { "Super_R", 0xFFEC }, { "Hyper_L", 0xFFED }, { "Hyper_R", 0xFFEE }, { "ISO_Lock", 0xFE01 }, { "ISO_Level2_Latch", 0xFE02 }, { "ISO_Level3_Shift", 0xFE03 }, { "ISO_Level3_Latch", 0xFE04 }, { "ISO_Level3_Lock", 0xFE05 }, | > > > > > > > > > > > > > > > > > < < < < > > > | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | { "Caps_Lock", 0xFFE5 }, { "Shift_Lock", 0xFFE6 }, { "Meta_L", 0xFFE7 }, { "Meta_R", 0xFFE8 }, { "Alt_L", 0xFFE9 }, { "Alt_R", 0xFFEA }, { "Super_L", 0xFFEB }, #ifndef TK_NO_DEPRECATED { "Win_L", 0xFFEB }, #endif { "Super_R", 0xFFEC }, #ifndef TK_NO_DEPRECATED { "Win_R", 0xFFEC }, #endif { "Hyper_L", 0xFFED }, { "Hyper_R", 0xFFEE }, { "braille_dot_1", 0xFFF1 }, { "braille_dot_2", 0xFFF2 }, { "braille_dot_3", 0xFFF3 }, { "braille_dot_4", 0xFFF4 }, { "braille_dot_5", 0xFFF5 }, { "braille_dot_6", 0xFFF6 }, { "braille_dot_7", 0xFFF7 }, { "braille_dot_8", 0xFFF8 }, { "braille_dot_9", 0xFFF9 }, { "braille_dot_10", 0xFFFA }, { "Delete", 0xFFFF }, { "ISO_Lock", 0xFE01 }, { "ISO_Level2_Latch", 0xFE02 }, { "ISO_Level3_Shift", 0xFE03 }, { "ISO_Level3_Latch", 0xFE04 }, { "ISO_Level3_Lock", 0xFE05 }, { "ISO_Group_Latch", 0xFE06 }, { "ISO_Group_Lock", 0xFE07 }, { "ISO_Next_Group", 0xFE08 }, { "ISO_Next_Group_Lock", 0xFE09 }, { "ISO_Prev_Group", 0xFE0A }, { "ISO_Prev_Group_Lock", 0xFE0B }, { "ISO_First_Group", 0xFE0C }, { "ISO_First_Group_Lock", 0xFE0D }, { "ISO_Last_Group", 0xFE0E }, { "ISO_Last_Group_Lock", 0xFE0F }, { "ISO_Level5_Shift", 0xFE11 }, { "ISO_Level5_Latch", 0xFE12 }, { "ISO_Level5_Lock", 0xFE13 }, { "ISO_Left_Tab", 0xFE20 }, { "ISO_Move_Line_Up", 0xFE21 }, { "ISO_Move_Line_Down", 0xFE22 }, { "ISO_Partial_Line_Up", 0xFE23 }, { "ISO_Partial_Line_Down", 0xFE24 }, { "ISO_Partial_Space_Left", 0xFE25 }, { "ISO_Partial_Space_Right", 0xFE26 }, |
︙ | ︙ | |||
256 257 258 259 260 261 262 | { "dead_belowcircumflex", 0xFE69 }, { "dead_belowtilde", 0xFE6A }, { "dead_belowbreve", 0xFE6B }, { "dead_belowdiaeresis", 0xFE6C }, { "dead_invertedbreve", 0xFE6D }, { "dead_belowcomma", 0xFE6E }, { "dead_currency", 0xFE6F }, | | > > | > > > > | | > > > > > > > > > > > < < < < < < < < < < < | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | { "dead_belowcircumflex", 0xFE69 }, { "dead_belowtilde", 0xFE6A }, { "dead_belowbreve", 0xFE6B }, { "dead_belowdiaeresis", 0xFE6C }, { "dead_invertedbreve", 0xFE6D }, { "dead_belowcomma", 0xFE6E }, { "dead_currency", 0xFE6F }, { "AccessX_Enable", 0xFE70 }, { "AccessX_Feedback_Enable", 0xFE71 }, { "RepeatKeys_Enable", 0xFE72 }, { "SlowKeys_Enable", 0xFE73 }, { "BounceKeys_Enable", 0xFE74 }, { "StickyKeys_Enable", 0xFE75 }, { "MouseKeys_Enable", 0xFE76 }, { "MouseKeys_Accel_Enable", 0xFE77 }, { "Overlay1_Enable", 0xFE78 }, { "Overlay2_Enable", 0xFE79 }, { "AudibleBell_Enable", 0xFE7A }, { "dead_a", 0xFE80 }, { "dead_A", 0xFE81 }, { "dead_e", 0xFE82 }, { "dead_E", 0xFE83 }, { "dead_i", 0xFE84 }, { "dead_I", 0xFE85 }, { "dead_o", 0xFE86 }, { "dead_O", 0xFE87 }, { "dead_u", 0xFE88 }, { "dead_U", 0xFE89 }, { "dead_small_schwa", 0xFE8A }, { "dead_capital_schwa", 0xFE8B }, { "dead_greek", 0xFE8C }, { "dead_lowline", 0xFE90 }, { "dead_aboveverticalline", 0xFE91 }, { "dead_belowverticalline", 0xFE92 }, { "dead_longsolidusoverlay", 0xFE93 }, { "ch", 0xFEA0 }, { "Ch", 0xFEA1 }, { "CH", 0xFEA2 }, { "c_h", 0xFEA3 }, { "C_h", 0xFEA4 }, { "C_H", 0xFEA5 }, { "First_Virtual_Screen", 0xFED0 }, { "Prev_Virtual_Screen", 0xFED1 }, { "Next_Virtual_Screen", 0xFED2 }, { "Last_Virtual_Screen", 0xFED4 }, { "Terminate_Server", 0xFED5 }, { "Pointer_Left", 0xFEE0 }, { "Pointer_Right", 0xFEE1 }, { "Pointer_Up", 0xFEE2 }, { "Pointer_Down", 0xFEE3 }, { "Pointer_UpLeft", 0xFEE4 }, { "Pointer_UpRight", 0xFEE5 }, { "Pointer_DownLeft", 0xFEE6 }, |
︙ | ︙ | |||
314 315 316 317 318 319 320 | { "Pointer_DblClick4", 0xFEF2 }, { "Pointer_DblClick5", 0xFEF3 }, { "Pointer_Drag_Dflt", 0xFEF4 }, { "Pointer_Drag1", 0xFEF5 }, { "Pointer_Drag2", 0xFEF6 }, { "Pointer_Drag3", 0xFEF7 }, { "Pointer_Drag4", 0xFEF8 }, | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | { "Pointer_DblClick4", 0xFEF2 }, { "Pointer_DblClick5", 0xFEF3 }, { "Pointer_Drag_Dflt", 0xFEF4 }, { "Pointer_Drag1", 0xFEF5 }, { "Pointer_Drag2", 0xFEF6 }, { "Pointer_Drag3", 0xFEF7 }, { "Pointer_Drag4", 0xFEF8 }, { "Pointer_EnableKeys", 0xFEF9 }, { "Pointer_Accelerate", 0xFEFA }, { "Pointer_DfltBtnNext", 0xFEFB }, { "Pointer_DfltBtnPrev", 0xFEFC }, { "Pointer_Drag5", 0xFEFD }, { "space", 0x20 }, #ifndef TK_NO_DEPRECATED { "exclam", 0x21 }, #endif { "quotedbl", 0x22 }, { "numbersign", 0x23 }, { "dollar", 0x24 }, #ifndef TK_NO_DEPRECATED { "percent", 0x25 }, { "ampersand", 0x26 }, { "apostrophe", 0x27 }, { "quoteright", 0x27 }, { "parenleft", 0x28 }, { "parenright", 0x29 }, { "asterisk", 0x2A }, { "plus", 0x2B }, { "comma", 0x2C }, #endif { "minus", 0x2D }, #ifndef TK_NO_DEPRECATED { "period", 0x2E }, { "slash", 0x2F }, { "0", 0x30 }, { "1", 0x31 }, { "2", 0x32 }, { "3", 0x33 }, { "4", 0x34 }, { "5", 0x35 }, { "6", 0x36 }, { "7", 0x37 }, { "8", 0x38 }, { "9", 0x39 }, { "colon", 0x3A }, #endif { "semicolon", 0x3B }, { "less", 0x3C }, #ifndef TK_NO_DEPRECATED { "equal", 0x3D }, #endif { "greater", 0x3E }, #ifndef TK_NO_DEPRECATED { "question", 0x3F }, { "at", 0x40 }, { "A", 0x41 }, { "B", 0x42 }, { "C", 0x43 }, { "D", 0x44 }, { "E", 0x45 }, |
︙ | ︙ | |||
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | { "T", 0x54 }, { "U", 0x55 }, { "V", 0x56 }, { "W", 0x57 }, { "X", 0x58 }, { "Y", 0x59 }, { "Z", 0x5A }, { "bracketleft", 0x5B }, { "backslash", 0x5C }, { "bracketright", 0x5D }, { "asciicircum", 0x5E }, { "underscore", 0x5F }, { "grave", 0x60 }, { "quoteleft", 0x60 }, { "a", 0x61 }, { "b", 0x62 }, { "c", 0x63 }, | > > | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | { "T", 0x54 }, { "U", 0x55 }, { "V", 0x56 }, { "W", 0x57 }, { "X", 0x58 }, { "Y", 0x59 }, { "Z", 0x5A }, #endif { "bracketleft", 0x5B }, { "backslash", 0x5C }, { "bracketright", 0x5D }, #ifndef TK_NO_DEPRECATED { "asciicircum", 0x5E }, { "underscore", 0x5F }, { "grave", 0x60 }, { "quoteleft", 0x60 }, { "a", 0x61 }, { "b", 0x62 }, { "c", 0x63 }, |
︙ | ︙ | |||
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | { "t", 0x74 }, { "u", 0x75 }, { "v", 0x76 }, { "w", 0x77 }, { "x", 0x78 }, { "y", 0x79 }, { "z", 0x7A }, { "braceleft", 0x7B }, { "bar", 0x7C }, { "braceright", 0x7D }, { "asciitilde", 0x7E }, { "nobreakspace", 0xA0 }, { "exclamdown", 0xA1 }, { "cent", 0xA2 }, { "sterling", 0xA3 }, { "currency", 0xA4 }, { "yen", 0xA5 }, { "brokenbar", 0xA6 }, { "section", 0xA7 }, | > > > > > > | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | { "t", 0x74 }, { "u", 0x75 }, { "v", 0x76 }, { "w", 0x77 }, { "x", 0x78 }, { "y", 0x79 }, { "z", 0x7A }, #endif { "braceleft", 0x7B }, #ifndef TK_NO_DEPRECATED { "bar", 0x7C }, #endif { "braceright", 0x7D }, #ifndef TK_NO_DEPRECATED { "asciitilde", 0x7E }, #endif { "nobreakspace", 0xA0 }, #ifndef TK_NO_DEPRECATED { "exclamdown", 0xA1 }, { "cent", 0xA2 }, { "sterling", 0xA3 }, { "currency", 0xA4 }, { "yen", 0xA5 }, { "brokenbar", 0xA6 }, { "section", 0xA7 }, |
︙ | ︙ | |||
546 547 548 549 550 551 552 | { "ograve", 0xF2 }, { "oacute", 0xF3 }, { "ocircumflex", 0xF4 }, { "otilde", 0xF5 }, { "odiaeresis", 0xF6 }, { "division", 0xF7 }, { "oslash", 0xF8 }, | < < < > | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | { "ograve", 0xF2 }, { "oacute", 0xF3 }, { "ocircumflex", 0xF4 }, { "otilde", 0xF5 }, { "odiaeresis", 0xF6 }, { "division", 0xF7 }, { "oslash", 0xF8 }, { "ugrave", 0xF9 }, { "uacute", 0xFA }, { "ucircumflex", 0xFB }, { "udiaeresis", 0xFC }, { "yacute", 0xFD }, { "thorn", 0xFE }, { "ydiaeresis", 0xFF }, #endif /* TK_NO_DEPRECATED */ { "Aogonek", 0x1A1 }, { "breve", 0x1A2 }, { "Lstroke", 0x1A3 }, { "Lcaron", 0x1A5 }, { "Sacute", 0x1A6 }, { "Scaron", 0x1A9 }, { "Scedilla", 0x1AA }, |
︙ | ︙ | |||
676 677 678 679 680 681 682 | { "imacron", 0x3EF }, { "ncedilla", 0x3F1 }, { "omacron", 0x3F2 }, { "kcedilla", 0x3F3 }, { "uogonek", 0x3F9 }, { "utilde", 0x3FD }, { "umacron", 0x3FE }, | < < < < < < < < < < < < < < < < < < < < < < < < < < | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | { "imacron", 0x3EF }, { "ncedilla", 0x3F1 }, { "omacron", 0x3F2 }, { "kcedilla", 0x3F3 }, { "uogonek", 0x3F9 }, { "utilde", 0x3FD }, { "umacron", 0x3FE }, { "OE", 0x13BC }, { "oe", 0x13BD }, { "Ydiaeresis", 0x13BE }, { "overline", 0x47E }, { "kana_fullstop", 0x4A1 }, { "kana_openingbracket", 0x4A2 }, { "kana_closingbracket", 0x4A3 }, |
︙ | ︙ | |||
784 785 786 787 788 789 790 | { "kana_RU", 0x4D9 }, { "kana_RE", 0x4DA }, { "kana_RO", 0x4DB }, { "kana_WA", 0x4DC }, { "kana_N", 0x4DD }, { "voicedsound", 0x4DE }, { "semivoicedsound", 0x4DF }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | { "kana_RU", 0x4D9 }, { "kana_RE", 0x4DA }, { "kana_RO", 0x4DB }, { "kana_WA", 0x4DC }, { "kana_N", 0x4DD }, { "voicedsound", 0x4DE }, { "semivoicedsound", 0x4DF }, { "Arabic_comma", 0x5AC }, { "Arabic_semicolon", 0x5BB }, { "Arabic_question_mark", 0x5BF }, { "Arabic_hamza", 0x5C1 }, { "Arabic_maddaonalef", 0x5C2 }, { "Arabic_hamzaonalef", 0x5C3 }, { "Arabic_hamzaonwaw", 0x5C4 }, { "Arabic_hamzaunderalef", 0x5C5 }, |
︙ | ︙ | |||
864 865 866 867 868 869 870 | { "Arabic_dammatan", 0x5EC }, { "Arabic_kasratan", 0x5ED }, { "Arabic_fatha", 0x5EE }, { "Arabic_damma", 0x5EF }, { "Arabic_kasra", 0x5F0 }, { "Arabic_shadda", 0x5F1 }, { "Arabic_sukun", 0x5F2 }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | { "Arabic_dammatan", 0x5EC }, { "Arabic_kasratan", 0x5ED }, { "Arabic_fatha", 0x5EE }, { "Arabic_damma", 0x5EF }, { "Arabic_kasra", 0x5F0 }, { "Arabic_shadda", 0x5F1 }, { "Arabic_sukun", 0x5F2 }, { "Serbian_dje", 0x6A1 }, { "Macedonia_gje", 0x6A2 }, { "Cyrillic_io", 0x6A3 }, { "Ukrainian_ie", 0x6A4 }, #ifndef TK_NO_DEPRECATED { "Ukranian_je", 0x6A4 }, #endif |
︙ | ︙ | |||
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | { "Cyrillic_CHE", 0x6FE }, { "Cyrillic_HARDSIGN", 0x6FF }, { "Greek_ALPHAaccent", 0x7A1 }, { "Greek_EPSILONaccent", 0x7A2 }, { "Greek_ETAaccent", 0x7A3 }, { "Greek_IOTAaccent", 0x7A4 }, { "Greek_IOTAdieresis", 0x7A5 }, { "Greek_IOTAdiaeresis", 0x7A5 }, { "Greek_IOTAaccentdiaeresis", 0x7A6 }, { "Greek_OMICRONaccent", 0x7A7 }, { "Greek_UPSILONaccent", 0x7A8 }, { "Greek_UPSILONdieresis", 0x7A9 }, { "Greek_UPSILONaccentdieresis", 0x7AA }, { "Greek_OMEGAaccent", 0x7AB }, { "Greek_accentdieresis", 0x7AE }, | > > | 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | { "Cyrillic_CHE", 0x6FE }, { "Cyrillic_HARDSIGN", 0x6FF }, { "Greek_ALPHAaccent", 0x7A1 }, { "Greek_EPSILONaccent", 0x7A2 }, { "Greek_ETAaccent", 0x7A3 }, { "Greek_IOTAaccent", 0x7A4 }, { "Greek_IOTAdieresis", 0x7A5 }, #ifndef TK_NO_DEPRECATED { "Greek_IOTAdiaeresis", 0x7A5 }, #endif { "Greek_IOTAaccentdiaeresis", 0x7A6 }, { "Greek_OMICRONaccent", 0x7A7 }, { "Greek_UPSILONaccent", 0x7A8 }, { "Greek_UPSILONdieresis", 0x7A9 }, { "Greek_UPSILONaccentdieresis", 0x7AA }, { "Greek_OMEGAaccent", 0x7AB }, { "Greek_accentdieresis", 0x7AE }, |
︙ | ︙ | |||
1121 1122 1123 1124 1125 1126 1127 | { "Greek_finalsmallsigma", 0x7F3 }, { "Greek_tau", 0x7F4 }, { "Greek_upsilon", 0x7F5 }, { "Greek_phi", 0x7F6 }, { "Greek_chi", 0x7F7 }, { "Greek_psi", 0x7F8 }, { "Greek_omega", 0x7F9 }, | < | 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | { "Greek_finalsmallsigma", 0x7F3 }, { "Greek_tau", 0x7F4 }, { "Greek_upsilon", 0x7F5 }, { "Greek_phi", 0x7F6 }, { "Greek_chi", 0x7F7 }, { "Greek_psi", 0x7F8 }, { "Greek_omega", 0x7F9 }, { "leftradical", 0x8A1 }, { "topleftradical", 0x8A2 }, { "horizconnector", 0x8A3 }, { "topintegral", 0x8A4 }, { "botintegral", 0x8A5 }, { "vertconnector", 0x8A6 }, { "topleftsqbracket", 0x8A7 }, |
︙ | ︙ | |||
1359 1360 1361 1362 1363 1364 1365 | #endif { "hebrew_resh", 0xCF8 }, { "hebrew_shin", 0xCF9 }, { "hebrew_taw", 0xCFA }, #ifndef TK_NO_DEPRECATED { "hebrew_taf", 0xCFA }, #endif | < | 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 | #endif { "hebrew_resh", 0xCF8 }, { "hebrew_shin", 0xCF9 }, { "hebrew_taw", 0xCFA }, #ifndef TK_NO_DEPRECATED { "hebrew_taf", 0xCFA }, #endif { "Thai_kokai", 0xDA1 }, { "Thai_khokhai", 0xDA2 }, { "Thai_khokhuat", 0xDA3 }, { "Thai_khokhwai", 0xDA4 }, { "Thai_khokhon", 0xDA5 }, { "Thai_khorakhang", 0xDA6 }, { "Thai_ngongu", 0xDA7 }, |
︙ | ︙ | |||
1444 1445 1446 1447 1448 1449 1450 | { "Thai_leksam", 0xDF3 }, { "Thai_leksi", 0xDF4 }, { "Thai_lekha", 0xDF5 }, { "Thai_lekhok", 0xDF6 }, { "Thai_lekchet", 0xDF7 }, { "Thai_lekpaet", 0xDF8 }, { "Thai_lekkao", 0xDF9 }, | < < < < < < < < < < < < < < < < | 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 | { "Thai_leksam", 0xDF3 }, { "Thai_leksi", 0xDF4 }, { "Thai_lekha", 0xDF5 }, { "Thai_lekhok", 0xDF6 }, { "Thai_lekchet", 0xDF7 }, { "Thai_lekpaet", 0xDF8 }, { "Thai_lekkao", 0xDF9 }, { "Hangul_Kiyeog", 0xEA1 }, { "Hangul_SsangKiyeog", 0xEA2 }, { "Hangul_KiyeogSios", 0xEA3 }, { "Hangul_Nieun", 0xEA4 }, { "Hangul_NieunJieuj", 0xEA5 }, { "Hangul_NieunHieuh", 0xEA6 }, { "Hangul_Dikeud", 0xEA7 }, |
︙ | ︙ | |||
1551 1552 1553 1554 1555 1556 1557 | { "Hangul_YeorinHieuh", 0xEF5 }, { "Hangul_AraeA", 0xEF6 }, { "Hangul_AraeAE", 0xEF7 }, { "Hangul_J_PanSios", 0xEF8 }, { "Hangul_J_KkogjiDalrinIeung", 0xEF9 }, { "Hangul_J_YeorinHieuh", 0xEFA }, { "Korean_Won", 0xEFF }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 | { "Hangul_YeorinHieuh", 0xEF5 }, { "Hangul_AraeA", 0xEF6 }, { "Hangul_AraeAE", 0xEF7 }, { "Hangul_J_PanSios", 0xEF8 }, { "Hangul_J_KkogjiDalrinIeung", 0xEF9 }, { "Hangul_J_YeorinHieuh", 0xEFA }, { "Korean_Won", 0xEFF }, { "XF86ModeLock", 0x1008FF01 }, { "XF86MonBrightnessUp", 0x1008FF02 }, { "XF86MonBrightnessDown", 0x1008FF03 }, { "XF86KbdLightOnOff", 0x1008FF04 }, { "XF86KbdBrightnessUp", 0x1008FF05 }, { "XF86KbdBrightnessDown", 0x1008FF06 }, { "XF86MonBrightnessCycle", 0x1008FF07 }, |
︙ | ︙ | |||
2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 | { "XF86TouchpadOff", 0x1008FFB1 }, { "XF86AudioMicMute", 0x1008FFB2 }, { "XF86Keyboard", 0x1008FFB3 }, { "XF86WWAN", 0x1008FFB4 }, { "XF86RFKill", 0x1008FFB5 }, { "XF86AudioPreset", 0x1008FFB6 }, { "XF86RotationLockToggle", 0x1008FFB7 }, { "XF86Switch_VT_1", 0x1008FE01 }, { "XF86Switch_VT_2", 0x1008FE02 }, { "XF86Switch_VT_3", 0x1008FE03 }, { "XF86Switch_VT_4", 0x1008FE04 }, { "XF86Switch_VT_5", 0x1008FE05 }, { "XF86Switch_VT_6", 0x1008FE06 }, { "XF86Switch_VT_7", 0x1008FE07 }, { "XF86Switch_VT_8", 0x1008FE08 }, { "XF86Switch_VT_9", 0x1008FE09 }, { "XF86Switch_VT_10", 0x1008FE0A }, { "XF86Switch_VT_11", 0x1008FE0B }, { "XF86Switch_VT_12", 0x1008FE0C }, { "XF86Ungrab", 0x1008FE20 }, { "XF86ClearGrab", 0x1008FE21 }, { "XF86Next_VMode", 0x1008FE22 }, { "XF86Prev_VMode", 0x1008FE23 }, { "XF86LogWindowTree", 0x1008FE24 }, { "XF86LogGrabInfo", 0x1008FE25 }, { "SunFA_Grave", 0x1005FF00 }, { "SunFA_Circum", 0x1005FF01 }, { "SunFA_Tilde", 0x1005FF02 }, { "SunFA_Acute", 0x1005FF03 }, { "SunFA_Diaeresis", 0x1005FF04 }, { "SunFA_Cedilla", 0x1005FF05 }, { "SunF36", 0x1005FF10 }, | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 | { "XF86TouchpadOff", 0x1008FFB1 }, { "XF86AudioMicMute", 0x1008FFB2 }, { "XF86Keyboard", 0x1008FFB3 }, { "XF86WWAN", 0x1008FFB4 }, { "XF86RFKill", 0x1008FFB5 }, { "XF86AudioPreset", 0x1008FFB6 }, { "XF86RotationLockToggle", 0x1008FFB7 }, { "XF86FullScreen", 0x1008FFB8 }, { "XF86Switch_VT_1", 0x1008FE01 }, { "XF86Switch_VT_2", 0x1008FE02 }, { "XF86Switch_VT_3", 0x1008FE03 }, { "XF86Switch_VT_4", 0x1008FE04 }, { "XF86Switch_VT_5", 0x1008FE05 }, { "XF86Switch_VT_6", 0x1008FE06 }, { "XF86Switch_VT_7", 0x1008FE07 }, { "XF86Switch_VT_8", 0x1008FE08 }, { "XF86Switch_VT_9", 0x1008FE09 }, { "XF86Switch_VT_10", 0x1008FE0A }, { "XF86Switch_VT_11", 0x1008FE0B }, { "XF86Switch_VT_12", 0x1008FE0C }, { "XF86Ungrab", 0x1008FE20 }, { "XF86ClearGrab", 0x1008FE21 }, { "XF86Next_VMode", 0x1008FE22 }, { "XF86Prev_VMode", 0x1008FE23 }, { "XF86LogWindowTree", 0x1008FE24 }, { "XF86LogGrabInfo", 0x1008FE25 }, { "XF86BrightnessAuto", 0x100810F4 }, { "XF86DisplayOff", 0x100810F5 }, { "XF86Info", 0x10081166 }, { "XF86AspectRatio", 0x10081177 }, { "XF86DVD", 0x10081185 }, { "XF86Audio", 0x10081188 }, { "XF86ChannelUp", 0x10081192 }, { "XF86ChannelDown", 0x10081193 }, { "XF86Break", 0x1008119B }, { "XF86VideoPhone", 0x100811A0 }, { "XF86ZoomReset", 0x100811A4 }, { "XF86Editor", 0x100811A6 }, { "XF86GraphicsEditor", 0x100811A8 }, { "XF86Presentation", 0x100811A9 }, { "XF86Database", 0x100811AA }, { "XF86Voicemail", 0x100811AC }, { "XF86Addressbook", 0x100811AD }, { "XF86DisplayToggle", 0x100811AF }, { "XF86SpellCheck", 0x100811B0 }, { "XF86ContextMenu", 0x100811B6 }, { "XF86MediaRepeat", 0x100811B7 }, { "XF8610ChannelsUp", 0x100811B8 }, { "XF8610ChannelsDown", 0x100811B9 }, { "XF86Images", 0x100811BA }, { "XF86NotificationCenter", 0x100811BC }, { "XF86PickupPhone", 0x100811BD }, { "XF86HangupPhone", 0x100811BE }, { "XF86Fn", 0x100811D0 }, { "XF86Fn_Esc", 0x100811D1 }, { "XF86FnRightShift", 0x100811E5 }, { "XF86Numeric0", 0x10081200 }, { "XF86Numeric1", 0x10081201 }, { "XF86Numeric2", 0x10081202 }, { "XF86Numeric3", 0x10081203 }, { "XF86Numeric4", 0x10081204 }, { "XF86Numeric5", 0x10081205 }, { "XF86Numeric6", 0x10081206 }, { "XF86Numeric7", 0x10081207 }, { "XF86Numeric8", 0x10081208 }, { "XF86Numeric9", 0x10081209 }, { "XF86NumericStar", 0x1008120A }, { "XF86NumericPound", 0x1008120B }, { "XF86NumericA", 0x1008120C }, { "XF86NumericB", 0x1008120D }, { "XF86NumericC", 0x1008120E }, { "XF86NumericD", 0x1008120F }, { "XF86CameraFocus", 0x10081210 }, { "XF86WPSButton", 0x10081211 }, { "XF86CameraZoomIn", 0x10081215 }, { "XF86CameraZoomOut", 0x10081216 }, { "XF86CameraUp", 0x10081217 }, { "XF86CameraDown", 0x10081218 }, { "XF86CameraLeft", 0x10081219 }, { "XF86CameraRight", 0x1008121A }, { "XF86AttendantOn", 0x1008121B }, { "XF86AttendantOff", 0x1008121C }, { "XF86AttendantToggle", 0x1008121D }, { "XF86LightsToggle", 0x1008121E }, { "XF86ALSToggle", 0x10081230 }, { "XF86Buttonconfig", 0x10081240 }, { "XF86Taskmanager", 0x10081241 }, { "XF86Journal", 0x10081242 }, { "XF86ControlPanel", 0x10081243 }, { "XF86AppSelect", 0x10081244 }, { "XF86Screensaver", 0x10081245 }, { "XF86VoiceCommand", 0x10081246 }, { "XF86Assistant", 0x10081247 }, { "XF86EmojiPicker", 0x10081249 }, { "XF86Dictate", 0x1008124A }, { "XF86BrightnessMin", 0x10081250 }, { "XF86BrightnessMax", 0x10081251 }, { "XF86KbdInputAssistPrev", 0x10081260 }, { "XF86KbdInputAssistNext", 0x10081261 }, { "XF86KbdInputAssistPrevgroup", 0x10081262 }, { "XF86KbdInputAssistNextgroup", 0x10081263 }, { "XF86KbdInputAssistAccept", 0x10081264 }, { "XF86KbdInputAssistCancel", 0x10081265 }, { "XF86RightUp", 0x10081266 }, { "XF86RightDown", 0x10081267 }, { "XF86LeftUp", 0x10081268 }, { "XF86LeftDown", 0x10081269 }, { "XF86RootMenu", 0x1008126A }, { "XF86MediaTopMenu", 0x1008126B }, { "XF86Numeric11", 0x1008126C }, { "XF86Numeric12", 0x1008126D }, { "XF86AudioDesc", 0x1008126E }, { "XF863DMode", 0x1008126F }, { "XF86NextFavorite", 0x10081270 }, { "XF86StopRecord", 0x10081271 }, { "XF86PauseRecord", 0x10081272 }, { "XF86VOD", 0x10081273 }, { "XF86Unmute", 0x10081274 }, { "XF86FastReverse", 0x10081275 }, { "XF86SlowReverse", 0x10081276 }, { "XF86Data", 0x10081277 }, { "XF86OnScreenKeyboard", 0x10081278 }, { "XF86PrivacyScreenToggle", 0x10081279 }, { "XF86SelectiveScreenshot", 0x1008127A }, { "XF86Macro1", 0x10081290 }, { "XF86Macro2", 0x10081291 }, { "XF86Macro3", 0x10081292 }, { "XF86Macro4", 0x10081293 }, { "XF86Macro5", 0x10081294 }, { "XF86Macro6", 0x10081295 }, { "XF86Macro7", 0x10081296 }, { "XF86Macro8", 0x10081297 }, { "XF86Macro9", 0x10081298 }, { "XF86Macro10", 0x10081299 }, { "XF86Macro11", 0x1008129A }, { "XF86Macro12", 0x1008129B }, { "XF86Macro13", 0x1008129C }, { "XF86Macro14", 0x1008129D }, { "XF86Macro15", 0x1008129E }, { "XF86Macro16", 0x1008129F }, { "XF86Macro17", 0x100812A0 }, { "XF86Macro18", 0x100812A1 }, { "XF86Macro19", 0x100812A2 }, { "XF86Macro20", 0x100812A3 }, { "XF86Macro21", 0x100812A4 }, { "XF86Macro22", 0x100812A5 }, { "XF86Macro23", 0x100812A6 }, { "XF86Macro24", 0x100812A7 }, { "XF86Macro25", 0x100812A8 }, { "XF86Macro26", 0x100812A9 }, { "XF86Macro27", 0x100812AA }, { "XF86Macro28", 0x100812AB }, { "XF86Macro29", 0x100812AC }, { "XF86Macro30", 0x100812AD }, { "XF86MacroRecordStart", 0x100812B0 }, { "XF86MacroRecordStop", 0x100812B1 }, { "XF86MacroPresetCycle", 0x100812B2 }, { "XF86MacroPreset1", 0x100812B3 }, { "XF86MacroPreset2", 0x100812B4 }, { "XF86MacroPreset3", 0x100812B5 }, { "XF86KbdLcdMenu1", 0x100812B8 }, { "XF86KbdLcdMenu2", 0x100812B9 }, { "XF86KbdLcdMenu3", 0x100812BA }, { "XF86KbdLcdMenu4", 0x100812BB }, { "XF86KbdLcdMenu5", 0x100812BC }, { "SunFA_Grave", 0x1005FF00 }, { "SunFA_Circum", 0x1005FF01 }, { "SunFA_Tilde", 0x1005FF02 }, { "SunFA_Acute", 0x1005FF03 }, { "SunFA_Diaeresis", 0x1005FF04 }, { "SunFA_Cedilla", 0x1005FF05 }, { "SunF36", 0x1005FF10 }, |
︙ | ︙ |
Changes to generic/nanosvg.h.
︙ | ︙ | |||
29 30 31 32 33 34 35 | #ifndef NANOSVG_H #define NANOSVG_H #ifdef __cplusplus extern "C" { #endif | | < > | < > | < > | | < > | | < > | | < > | > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #ifndef NANOSVG_H #define NANOSVG_H #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. */ /* Example Usage: // Load SVG NSVGimage* image; image = nsvgParseFromFile("test.svg", "px", 96); printf("size: %f x %f\n", image->width, image->height); |
︙ | ︙ | |||
81 82 83 84 85 86 87 | #define NANOSVG_realloc realloc #endif #ifndef NANOSVG_free #define NANOSVG_free free #endif | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | #define NANOSVG_realloc realloc #endif #ifndef NANOSVG_free #define NANOSVG_free free #endif /* 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) #define fabsf(a) (float)fabs(a) #define acosf(a) (float)acos(a) #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 */ #if defined(_MSC_VER) && (_MSC_VER == 1400) #define fabsf(a) (float)fabs(a) #endif enum NSVGpaintType { NSVG_PAINT_NONE = 0, NSVG_PAINT_COLOR = 1, |
︙ | ︙ | |||
156 157 158 159 160 161 162 | unsigned int color; NSVGgradient* gradient; }; } NSVGpaint; typedef struct NSVGpath { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < > | | | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | unsigned int color; NSVGgradient* gradient; }; } 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. */ } 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. */ } 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. */ } NSVGimage; /* 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. */ NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi); /* Deletes list of paths. */ NANOSVG_SCOPE void nsvgDelete(NSVGimage* image); #ifdef __cplusplus } #endif #ifdef NANOSVG_IMPLEMENTATION #include <string.h> #include <stdlib.h> #include <stdio.h> #include <math.h> #define NSVG_PI (3.14159265358979323846264338327f) #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 #define NSVG_ALIGN_MEET 1 #define NSVG_ALIGN_SLICE 2 #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 */ #ifdef __cplusplus #define NSVG_INLINE inline #else #define NSVG_INLINE #endif #if !defined(strtoll) /* old MSVC versions do not have strtoll() */ #define strtoll _strtoi64 #endif #else #define NSVG_INLINE inline #endif |
︙ | ︙ | |||
255 256 257 258 259 260 261 | return c >= '0' && c <= '9'; } 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; } | | | | | | | | | | | | | | | | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | return c >= '0' && c <= '9'; } 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 */ #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 */ while (*s && nsvg__isspace(*s)) s++; if (!*s) return; if (contentCb) (*contentCb)(ud, s); } static void nsvg__parseElement(char* s, void (*startelCb)(void* ud, const char* el, const char** attr), void (*endelCb)(void* ud, const char* el), void* ud) { const char* attr[NSVG_XML_MAX_ATTRIBS]; int nattr = 0; char* cbname; int start = 0; int end = 0; char quote; /* Skip white space after the '<' */ while (*s && nsvg__isspace(*s)) s++; /* Check if the tag is end tag */ if (*s == '/') { s++; end = 1; } else { start = 1; } /* Skip comments, data and preprocessor stuff. */ if (!*s || *s == '?' || *s == '!') return; /* Get tag name */ cbname = s; while (*s && !nsvg__isspace(*s)) s++; if (*s) { *s++ = '\0'; } /* Get attribs */ while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) { char* name = NULL; char* value = NULL; /* 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. */ while (*s && !nsvg__isspace(*s) && *s != '=') s++; if (*s) { *s++ = '\0'; } /* 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. */ value = s; while (*s && *s != quote) s++; if (*s) { *s++ = '\0'; } /* Store only well formed attributes */ if (name && value) { attr[nattr++] = name; attr[nattr++] = value; } } /* List terminator */ attr[nattr++] = 0; attr[nattr++] = 0; /* Call callbacks. */ if (start && startelCb) (*startelCb)(ud, cbname, attr); if (end && endelCb) (*endelCb)(ud, cbname); } NANOSVG_SCOPE int nsvg__parseXML(char* input, void (*startelCb)(void* ud, const char* el, const char** attr), void (*endelCb)(void* ud, const char* el), void (*contentCb)(void* ud, const char* s), void* ud) { char* s = input; char* mark = s; int state = NSVG_XML_CONTENT; while (*s) { if (*s == '<' && state == NSVG_XML_CONTENT) { /* 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. */ *s++ = '\0'; nsvg__parseContent(mark, contentCb, ud); nsvg__parseElement(mark, startelCb, endelCb, ud); mark = s; state = NSVG_XML_CONTENT; } else { s++; |
︙ | ︙ | |||
611 612 613 614 615 616 617 | int i, j, count; double roots[2], a, b, c, b2ac, t, v; float* v0 = &curve[0]; float* v1 = &curve[2]; float* v2 = &curve[4]; float* v3 = &curve[6]; | | | | | | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | int i, j, count; double roots[2], a, b, c, b2ac, t, v; float* v0 = &curve[0]; float* v1 = &curve[2]; float* v2 = &curve[4]; float* v3 = &curve[6]; /* 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. */ if (nsvg__ptInBounds(v1, bounds) && nsvg__ptInBounds(v2, bounds)) return; /* 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; if (fabs(a) < NSVG_EPSILON) { if (fabs(b) > NSVG_EPSILON) { |
︙ | ︙ | |||
664 665 666 667 668 669 670 | if (p == NULL) goto error; memset(p, 0, sizeof(NSVGparser)); p->image = (NSVGimage*)NANOSVG_malloc(sizeof(NSVGimage)); if (p->image == NULL) goto error; memset(p->image, 0, sizeof(NSVGimage)); | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | if (p == NULL) goto error; memset(p, 0, sizeof(NSVGparser)); p->image = (NSVGimage*)NANOSVG_malloc(sizeof(NSVGimage)); if (p->image == NULL) goto error; memset(p->image, 0, sizeof(NSVGimage)); /* 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; p->attr[0].fillOpacity = 1; p->attr[0].strokeOpacity = 1; |
︙ | ︙ | |||
850 851 852 853 854 855 856 | case NSVG_UNITS_PX: return c.value; case NSVG_UNITS_PT: return c.value / 72.0f * p->dpi; 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; | | | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | case NSVG_UNITS_PX: return c.value; case NSVG_UNITS_PT: return c.value / 72.0f * p->dpi; 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_PERCENT: return orig + c.value / 100.0f * length; default: return c.value; } return c.value; } static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id) |
︙ | ︙ | |||
884 885 886 887 888 889 890 | float ox, oy, sw, sh, sl; int nstops = 0; int refIter; data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; | | | | | | | | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | float ox, oy, sw, sh, sl; int nstops = 0; int refIter; data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; /* 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) { stops = ref->stops; nstops = ref->nstops; break; } nextRef = nsvg__findGradientData(p, ref->ref); if (nextRef == ref) break; /* prevent infite loops on malformed data */ ref = nextRef; refIter++; 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. */ if (data->units == NSVG_OBJECT_SPACE) { ox = localBounds[0]; oy = localBounds[1]; sw = localBounds[2] - localBounds[0]; sh = localBounds[3] - localBounds[1]; } else { ox = nsvg__actualOrigX(p); oy = nsvg__actualOrigY(p); sw = nsvg__actualWidth(p); sh = nsvg__actualHeight(p); } sl = sqrtf(sw*sw + sh*sh) / sqrtf(2.0f); if (data->type == NSVG_PAINT_LINEAR_GRADIENT) { 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 */ 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; } else { float cx, cy, fx, fy, r; 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 */ 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; } |
︙ | ︙ | |||
1026 1027 1028 1029 1030 1031 1032 | shape->miterLimit = attr->miterLimit; shape->fillRule = attr->fillRule; shape->opacity = attr->opacity; shape->paths = p->plist; p->plist = NULL; | | | | | | | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 | shape->miterLimit = attr->miterLimit; shape->fillRule = attr->fillRule; shape->opacity = attr->opacity; shape->paths = p->plist; p->plist = NULL; /* 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) { shape->bounds[0] = nsvg__minf(shape->bounds[0], path->bounds[0]); 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 */ 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; shape->fill.color |= (unsigned int)(attr->fillOpacity*255) << 24; } else if (attr->hasFill == 2) { float inv[6], localBounds[4]; nsvg__xformInverse(inv, attr->xform); nsvg__getLocalBounds(localBounds, shape, inv); shape->fill.gradient = nsvg__createGradient(p, attr->fillGradient, localBounds, &shape->fill.type); if (shape->fill.gradient == NULL) { shape->fill.type = NSVG_PAINT_NONE; } } /* 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; shape->stroke.color |= (unsigned int)(attr->strokeOpacity*255) << 24; } else if (attr->hasStroke == 2) { float inv[6], localBounds[4]; nsvg__xformInverse(inv, attr->xform); nsvg__getLocalBounds(localBounds, shape, inv); 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 */ shape->flags = ((attr->visible & NSVG_VIS_DISPLAY) && (attr->visible & NSVG_VIS_VISIBLE) ? NSVG_FLAGS_VISIBLE : 0x00); /* Add to tail */ if (p->image->shapes == NULL) p->image->shapes = shape; else p->shapesTail->next = shape; p->shapesTail = shape; return; |
︙ | ︙ | |||
1101 1102 1103 1104 1105 1106 1107 | if (p->npts < 4) return; if (closed) nsvg__lineTo(p, p->pts[0], p->pts[1]); | | | | | 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | if (p->npts < 4) return; if (closed) nsvg__lineTo(p, p->pts[0], p->pts[1]); /* 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; memset(path, 0, sizeof(NSVGpath)); 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. */ 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 */ 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]; path->bounds[1] = bounds[1]; path->bounds[2] = bounds[2]; |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | error: if (path != NULL) { if (path->pts != NULL) NANOSVG_free(path->pts); NANOSVG_free(path); } } | | | | | | | | | | | | | | | | | | | | < < < < < < | < > | < < > > | < < < < | > > > > > | > > > > > | | > > > > > | > > > > > > > > > | > > > > > > > > > > > > > > > | < > | > > > > > > | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 | error: if (path != NULL) { 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. */ static double nsvg__atof(const char* s) { char* cur = (char*)s; char* end = NULL; double res = 0.0, sign = 1.0; #if defined(_MSC_VER) && (_MSC_VER == 1200) __int64 intPart = 0, fracPart = 0; #else long long intPart = 0, fracPart = 0; #endif char hasIntPart = 0, hasFracPart = 0; /* Parse optional sign */ if (*cur == '+') { cur++; } else if (*cur == '-') { sign = -1; cur++; } /* Parse integer part */ if (nsvg__isdigit(*cur)) { /* Parse digit sequence */ #if defined(_MSC_VER) && (_MSC_VER == 1200) intPart = strtol(cur, &end, 10); #else intPart = strtoll(cur, &end, 10); #endif if (cur != end) { res = (double)intPart; hasIntPart = 1; cur = end; } } /* Parse fractional part. */ if (*cur == '.') { cur++; /* Skip '.' */ if (nsvg__isdigit(*cur)) { /* Parse digit sequence */ #if defined(_MSC_VER) && (_MSC_VER == 1200) fracPart = strtol(cur, &end, 10); #else fracPart = strtoll(cur, &end, 10); #endif if (cur != end) { res += (double)fracPart / pow(10.0, (double)(end - cur)); hasFracPart = 1; cur = end; } } } /* A valid number should have integer or fractional part. */ if (!hasIntPart && !hasFracPart) return 0.0; /* Parse optional exponent */ if (*cur == 'e' || *cur == 'E') { int expPart = 0; cur++; /* skip 'E' */ expPart = strtol(cur, &end, 10); /* Parse digit sequence with sign */ if (cur != end) { res *= pow(10.0, (double)expPart); } } return res * sign; } static const char* nsvg__parseNumber(const char* s, char* it, const int size) { const int last = size-1; int i = 0; /* sign */ if (*s == '-' || *s == '+') { if (i < last) it[i++] = *s; s++; } /* integer part */ while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } if (*s == '.') { /* decimal point */ if (i < last) it[i++] = *s; s++; /* fraction part */ while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } } /* exponent */ if (*s == 'e' || *s == 'E') { if (i < last) it[i++] = *s; s++; if (*s == '-' || *s == '+') { if (i < last) it[i++] = *s; s++; } while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } } it[i] = '\0'; return s; } static const char* nsvg__getNextPathItem(const char* s, char* it) { it[0] = '\0'; /* 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 */ it[0] = *s++; it[1] = '\0'; return s; } return s; } static unsigned int nsvg__parseColorHex(const char* str) { unsigned int r=0, g=0, b=0; if (sscanf(str, "#%2x%2x%2x", &r, &g, &b) == 3 ) /* 2 digit hex */ return NSVG_RGB(r, g, b); if (sscanf(str, "#%1x%1x%1x", &r, &g, &b) == 3 ) /* 1 digit hex, e.g. #abc -> 0xccbbaa */ return NSVG_RGB(r*17, g*17, b*17); /* same effect as (r<<4|r), (g<<4|g), .. */ return NSVG_RGB(128, 128, 128); } /* * Parse rgb color. The pointer 'str' must point at "rgb(" (4+ characters). * This function returns gray (rgb(128, 128, 128) == '#808080') on parse errors * for backwards compatibility. Note: other image viewers return black instead. */ static unsigned int nsvg__parseColorRGB(const char* str) { int i; unsigned int rgbi[3]; float rgbf[3]; /* try decimal integers first */ if (sscanf(str, "rgb(%u, %u, %u)", &rgbi[0], &rgbi[1], &rgbi[2]) != 3) { /* integers failed, try percent values (float, locale independent) */ const char delimiter[3] = {',', ',', ')'}; str += 4; /* skip "rgb(" */ for (i = 0; i < 3; i++) { while (*str && (nsvg__isspace(*str))) str++; /* skip leading spaces */ if (*str == '+') str++; /* skip '+' (don't allow '-') */ if (!*str) break; rgbf[i] = nsvg__atof(str); /* * Note 1: it would be great if nsvg__atof() returned how many * bytes it consumed but it doesn't. We need to skip the number, * the '%' character, spaces, and the delimiter ',' or ')'. * * Note 2: The following code does not allow values like "33.%", * i.e. a decimal point w/o fractional part, but this is consistent * with other image viewers, e.g. firefox, chrome, eog, gimp. */ while (*str && nsvg__isdigit(*str)) str++; /* skip integer part */ if (*str == '.') { str++; if (!nsvg__isdigit(*str)) break; /* error: no digit after '.' */ while (*str && nsvg__isdigit(*str)) str++; /* skip fractional part */ } if (*str == '%') str++; else break; while (nsvg__isspace(*str)) str++; if (*str == delimiter[i]) str++; else break; } if (i == 3) { rgbi[0] = roundf(rgbf[0] * 2.55f); rgbi[1] = roundf(rgbf[1] * 2.55f); rgbi[2] = roundf(rgbf[2] * 2.55f); } else { rgbi[0] = rgbi[1] = rgbi[2] = 128; } } /* clip values as the CSS spec requires */ for (i = 0; i < 3; i++) { if (rgbi[i] > 255) rgbi[i] = 255; } return NSVG_RGB(rgbi[0], rgbi[1], rgbi[2]); } typedef struct NSVGNamedColor { const char* name; unsigned int color; } NSVGNamedColor; |
︙ | ︙ | |||
1539 1540 1541 1542 1543 1544 1545 | else if (units[0] == 'e' && units[1] == 'x') return NSVG_UNITS_EX; return NSVG_UNITS_USER; } static int nsvg__isCoordinate(const char* s) { | | | | | 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 | else if (units[0] == 'e' && units[1] == 'x') return NSVG_UNITS_EX; return NSVG_UNITS_USER; } static int nsvg__isCoordinate(const char* s) { /* optional sign */ if (*s == '-' || *s == '+') s++; /* must have at least one digit, or start by a dot */ return (nsvg__isdigit(*s) || *s == '.'); } static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str) { NSVGcoordinate coord = {0, NSVG_UNITS_USER}; char units[32]=""; sscanf(str, "%f%s", &coord.value, units); |
︙ | ︙ | |||
1719 1720 1721 1722 1723 1724 1725 | nsvg__xformPremultiply(xform, t); } } static void nsvg__parseUrl(char* id, const char* str) { int i = 0; | | | | | | | | | | | | 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 | nsvg__xformPremultiply(xform, t); } } static void nsvg__parseUrl(char* id, const char* str) { int i = 0; str += 4; /* "url("; */ if (*str && *str == '#') str++; while (i < 63 && *str && *str != ')') { id[i] = *str++; i++; } id[i] = '\0'; } static char nsvg__parseLineCap(const char* str) { if (strcmp(str, "butt") == 0) 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. */ return NSVG_CAP_BUTT; } static char nsvg__parseLineJoin(const char* str) { if (strcmp(str, "miter") == 0) 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. */ 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. */ 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 */ while (*s && (nsvg__isspace(*s) || *s == ',')) s++; /* Advance until whitespace, comma or end. */ while (*s && (!nsvg__isspace(*s) && *s != ',')) { if (n < 63) it[n++] = *s; s++; } it[n++] = '\0'; return s; } static int nsvg__parseStrokeDashArray(NSVGparser* p, const char* str, float* strokeDashArray) { char item[64]; int count = 0, i; float sum = 0.0f; /* Handle "none" */ if (str[0] == 'n') return 0; /* 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))); } |
︙ | ︙ | |||
1818 1819 1820 1821 1822 1823 1824 | if (!attr) return 0; 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; | | | 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 | if (!attr) return 0; 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 */ } else if (strcmp(name, "visibility") == 0) { if (strcmp(value, "hidden") == 0) { attr->visible &= ~NSVG_VIS_VISIBLE; } else if (strcmp(value, "visible") == 0) { attr->visible |= NSVG_VIS_VISIBLE; } |
︙ | ︙ | |||
1910 1911 1912 1913 1914 1915 1916 | int n; str = start; while (str < end && *str != ':') ++str; val = str; | | | 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 | int n; str = start; while (str < end && *str != ':') ++str; val = str; /* Right Trim */ while (str > start && (*str == ':' || nsvg__isspace(*str))) --str; ++str; n = (int)(str - start); if (n > 511) n = 511; if (n) memcpy(name, start, n); name[n] = 0; |
︙ | ︙ | |||
1935 1936 1937 1938 1939 1940 1941 | static void nsvg__parseStyle(NSVGparser* p, const char* str) { const char* start; const char* end; while (*str) { | | | | 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 | static void nsvg__parseStyle(NSVGparser* p, const char* str) { const char* start; const char* end; while (*str) { /* Left Trim */ while(*str && nsvg__isspace(*str)) ++str; start = str; while(*str && *str != ';') ++str; end = str; /* Right Trim */ while (end > start && (*end == ';' || nsvg__isspace(*end))) --end; ++end; nsvg__parseNameValue(p, start, end); if (*str) ++str; } } |
︙ | ︙ | |||
2116 2117 2118 2119 2120 2121 2122 | } else { cx = args[0]; cy = args[1]; x2 = args[2]; y2 = args[3]; } | | | 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | } else { cx = args[0]; cy = args[1]; x2 = args[2]; y2 = args[3]; } /* 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); nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2); |
︙ | ︙ | |||
2149 2150 2151 2152 2153 2154 2155 | x2 = args[0]; y2 = args[1]; } cx = 2*x1 - *cpx2; cy = 2*y1 - *cpy2; | | | 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 | x2 = args[0]; y2 = args[1]; } cx = 2*x1 - *cpx2; cy = 2*y1 - *cpy2; /* 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); nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2); |
︙ | ︙ | |||
2181 2182 2183 2184 2185 2186 2187 | if (r < -1.0f) r = -1.0f; if (r > 1.0f) r = 1.0f; 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) { | | | | | | | | | | | | | | | | | | | | | | | > > > > > | | | | 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 | if (r < -1.0f) r = -1.0f; if (r > 1.0f) r = 1.0f; 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/) */ 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]; 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 */ y1 = *cpy; if (rel) { /* end point */ x2 = *cpx + args[5]; y2 = *cpy + args[6]; } else { x2 = args[5]; y2 = args[6]; } 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 */ 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' */ 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' */ 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) s = sqrtf(sa / sb); if (fa == fs) s = -s; cxp = s * rx * y1p / ry; cyp = s * -ry * x1p / rx; /* 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. */ 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 */ /* 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. */ 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. */ ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f); hda = (da / (float)ndivs) / 2.0f; /* Fix for ticket #179: division by 0: avoid cotangens around 0 (infinite) */ if ((hda < 1e-3f) && (hda > -1e-3f)) hda *= 0.5f; else hda = (1.0f - cosf(hda)) / sinf(hda); kappa = fabsf(4.0f / 3.0f * hda); if (da < 0.0f) kappa = -kappa; 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 */ if (i > 0) nsvg__cubicBezTo(p, px+ptanx,py+ptany, x-tanx, y-tany, x, y); px = x; py = y; ptanx = tanx; ptany = tany; } |
︙ | ︙ | |||
2340 2341 2342 2343 2344 2345 2346 | if (nargs < 10) args[nargs++] = (float)nsvg__atof(item); if (nargs >= rargs) { switch (cmd) { case 'm': case 'M': nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0); | | | | 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 | if (nargs < 10) args[nargs++] = (float)nsvg__atof(item); 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. */ cmd = (cmd == 'm') ? 'l' : 'L'; rargs = nsvg__getArgsPerElement(cmd); cpx2 = cpx; cpy2 = cpy; initPoint = 1; break; case 'l': case 'L': |
︙ | ︙ | |||
2396 2397 2398 2399 2400 2401 2402 | break; } nargs = 0; } } else { cmd = item[0]; if (cmd == 'M' || cmd == 'm') { | | | | | | | | | | | 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 | break; } nargs = 0; } } else { cmd = item[0]; if (cmd == 'M' || cmd == 'm') { /* Commit path. */ if (p->npts > 0) nsvg__addPath(p, closedFlag); /* 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). */ cmd = '\0'; } if (cmd == 'Z' || cmd == 'z') { closedFlag = 1; /* Commit path. */ if (p->npts > 0) { /* 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. */ nsvg__resetPath(p); nsvg__moveTo(p, cpx, cpy); closedFlag = 0; nargs = 0; } rargs = nsvg__getArgsPerElement(cmd); if (rargs == -1) { /* Command not recognized */ cmd = '\0'; rargs = 0; } } } /* Commit path. */ if (p->npts) nsvg__addPath(p, closedFlag); } nsvg__addShape(p); } static void nsvg__parseRect(NSVGparser* p, const char** attr) { float x = 0.0f; float y = 0.0f; float w = 0.0f; float h = 0.0f; 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])) { if (strcmp(attr[i], "x") == 0) x = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p)); if (strcmp(attr[i], "y") == 0) y = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p)); |
︙ | ︙ | |||
2476 2477 2478 2479 2480 2481 2482 | if (rx < 0.00001f || ry < 0.0001f) { 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 { | | | 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 | if (rx < 0.00001f || ry < 0.0001f) { 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 */ 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); nsvg__lineTo(p, x+rx, y+h); nsvg__cubicBezTo(p, x+rx*(1-NSVG_KAPPA90), y+h, x, y+h-ry*(1-NSVG_KAPPA90), x, y+h-ry); |
︙ | ︙ | |||
2633 2634 2635 2636 2637 2638 2639 | p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "height") == 0) { 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) { | | | | | | 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 | p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "height") == 0) { 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 */ p->alignType = NSVG_ALIGN_NONE; } else { /* 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 */ 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 */ p->alignType = NSVG_ALIGN_MEET; if (strstr(attr[i + 1], "slice") != 0) p->alignType = NSVG_ALIGN_SLICE; } } } } |
︙ | ︙ | |||
2745 2746 2747 2748 2749 2750 2751 | curAttr->stopColor = 0; curAttr->stopOpacity = 1.0f; for (i = 0; attr[i]; i += 2) { nsvg__parseAttr(p, attr[i], attr[i + 1]); } | | | | 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 | curAttr->stopColor = 0; curAttr->stopOpacity = 1.0f; for (i = 0; attr[i]; i += 2) { nsvg__parseAttr(p, attr[i], attr[i + 1]); } /* 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 */ idx = grad->nstops-1; for (i = 0; i < grad->nstops-1; i++) { if (curAttr->stopOffset < grad->stops[i].offset) { idx = i; break; } } |
︙ | ︙ | |||
2777 2778 2779 2780 2781 2782 2783 | } static void nsvg__startElement(void* ud, const char* el, const char** attr) { NSVGparser* p = (NSVGparser*)ud; if (p->defsFlag) { | | | | 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 | } 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 */ 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) { nsvg__parseGradientStop(p, attr); } return; } 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. */ return; nsvg__pushAttr(p); nsvg__parsePath(p, attr); nsvg__popAttr(p); } else if (strcmp(el, "rect") == 0) { nsvg__pushAttr(p); nsvg__parseRect(p, attr); |
︙ | ︙ | |||
2945 2946 2947 2948 2949 2950 2951 | static float nsvg__viewAlign(float content, float container, int type) { if (type == NSVG_ALIGN_MIN) return 0; else if (type == NSVG_ALIGN_MAX) return container - content; | | | 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 | static float nsvg__viewAlign(float content, float container, int type) { if (type == NSVG_ALIGN_MIN) return 0; else if (type == NSVG_ALIGN_MAX) return container - content; /* mid */ return (container - content) * 0.5f; } static void nsvg__scaleGradient(NSVGgradient* grad, float tx, float ty, float sx, float sy) { float t[6]; nsvg__xformSetTranslation(t, tx, ty); |
︙ | ︙ | |||
2967 2968 2969 2970 2971 2972 2973 | { NSVGshape* shape; NSVGpath* path; float tx, ty, sx, sy, us, bounds[4], t[6], avgs; int i; float* pt; | | | 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 | { NSVGshape* shape; NSVGpath* path; float tx, ty, sx, sy, us, bounds[4], t[6], avgs; int i; float* pt; /* 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; } else { p->viewMinx = bounds[0]; |
︙ | ︙ | |||
2995 2996 2997 2998 2999 3000 3001 | if (p->image->height == 0) p->image->height = p->viewHeight; 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; | | | | | | | 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 | if (p->image->height == 0) p->image->height = p->viewHeight; 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 */ us = 1.0f / nsvg__convertToPixels(p, nsvg__coord(1.0f, nsvg__parseUnits(units)), 0.0f, 1.0f); /* Fix aspect ratio */ if (p->alignType == NSVG_ALIGN_MEET) { /* 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 */ 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 */ 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; shape->bounds[1] = (shape->bounds[1] + ty) * sy; shape->bounds[2] = (shape->bounds[2] + tx) * sx; |
︙ | ︙ | |||
3064 3065 3066 3067 3068 3069 3070 | if (p == NULL) { return NULL; } p->dpi = dpi; nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); | | | 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 | if (p == NULL) { return NULL; } p->dpi = dpi; nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); /* Scale to viewBox */ nsvg__scaleToViewbox(p, units); ret = p->image; p->image = NULL; nsvg__deleteParser(p); |
︙ | ︙ | |||
3091 3092 3093 3094 3095 3096 3097 | if (!fp) goto error; fseek(fp, 0, SEEK_END); 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; | | | 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 | if (!fp) goto error; fseek(fp, 0, SEEK_END); 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. */ fclose(fp); image = nsvgParse(data, units, dpi); NANOSVG_free(data); return image; error: |
︙ | ︙ | |||
3123 3124 3125 3126 3127 3128 3129 | NANOSVG_free(shape); shape = snext; } NANOSVG_free(image); } #endif | > > | 3163 3164 3165 3166 3167 3168 3169 3170 3171 | NANOSVG_free(shape); shape = snext; } NANOSVG_free(image); } #endif #endif /* NANOSVG_H */ |
Changes to generic/nanosvgrast.h.
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * by Sean Barrett - http://nothings.org/ * */ #ifndef NANOSVGRAST_H #define NANOSVGRAST_H #ifdef __cplusplus extern "C" { #endif #ifndef NANOSVG_SCOPE #define NANOSVG_SCOPE #endif | > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | * by Sean Barrett - http://nothings.org/ * */ #ifndef NANOSVGRAST_H #define NANOSVGRAST_H #include "nanosvg.h" #ifdef __cplusplus extern "C" { #endif #ifndef NANOSVG_SCOPE #define NANOSVG_SCOPE #endif |
︙ | ︙ | |||
55 56 57 58 59 60 61 | struct NSVGrasterizer* rast = nsvgCreateRasterizer(); // Allocate memory for image unsigned char* img = malloc(w*h*4); // Rasterize nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4); */ | | | | | | | | | | | > | < < > > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | struct NSVGrasterizer* rast = nsvgCreateRasterizer(); // Allocate memory for image unsigned char* img = malloc(w*h*4); // Rasterize nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4); */ /* 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 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. */ NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*); #ifdef __cplusplus } #endif #ifdef NANOSVGRAST_IMPLEMENTATION #include <math.h> #include <stdlib.h> #include <string.h> #define NSVG__SUBSAMPLES 5 #define NSVG__FIXSHIFT 10 #define NSVG__FIX (1 << NSVG__FIXSHIFT) #define NSVG__FIXMASK (NSVG__FIX-1) #define NSVG__MEMPAGE_SIZE 1024 |
︙ | ︙ | |||
198 199 200 201 202 203 204 | NANOSVG_free(r); } static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur) { NSVGmemPage *newp; | | | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | NANOSVG_free(r); } static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur) { NSVGmemPage *newp; /* If using existing chain, return the next page in chain */ if (cur != NULL && cur->next != NULL) { return cur->next; } /* Alloc new page */ newp = (NSVGmemPage*)NANOSVG_malloc(sizeof(NSVGmemPage)); if (newp == NULL) return NULL; memset(newp, 0, sizeof(NSVGmemPage)); /* Add to linked list */ if (cur != NULL) cur->next = newp; else r->pages = newp; return newp; } |
︙ | ︙ | |||
298 299 300 301 302 303 304 | r->npoints2 = r->npoints; } static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float y1) { NSVGedge* e; | | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | r->npoints2 = r->npoints; } static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float y1) { NSVGedge* e; /* Skip horizontal edges */ if (y0 == y1) return; if (r->nedges+1 > r->cedges) { r->cedges = r->cedges > 0 ? r->cedges * 2 : 64; r->edges = (NSVGedge*)NANOSVG_realloc(r->edges, sizeof(NSVGedge) * r->cedges); if (r->edges == NULL) return; |
︙ | ︙ | |||
384 385 386 387 388 389 390 | static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale) { int i, j; NSVGpath* path; for (path = shape->paths; path != NULL; path = path->next) { r->npoints = 0; | | | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale) { int i, j; NSVGpath* path; for (path = shape->paths; path != NULL; path = path->next) { r->npoints = 0; /* 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 */ nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0); /* 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); } } enum NSVGpointFlags { |
︙ | ︙ | |||
615 616 617 618 619 620 621 | int divs = (int)ceilf(arc / da); if (divs < 2) divs = 2; return divs; } static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints, int closed, int lineJoin, int lineCap, float lineWidth) { | | | | | | | 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | int divs = (int)ceilf(arc / da); if (divs < 2) divs = 2; 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. */ 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 */ if (closed) { /* Looping */ p0 = &points[npoints-1]; p1 = &points[0]; s = 0; e = npoints; } else { /* Add cap */ p0 = &points[0]; p1 = &points[1]; s = 1; e = npoints-1; } if (closed) { nsvg__initClosed(&left, &right, p0, p1, lineWidth); firstLeft = left; firstRight = right; } else { /* 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); else if (lineCap == NSVG_CAP_SQUARE) nsvg__squareCap(r, &left, &right, p0, dx, dy, lineWidth, 0); |
︙ | ︙ | |||
667 668 669 670 671 672 673 | } else { nsvg__straightJoin(r, &left, &right, p1, lineWidth); } p0 = p1++; } if (closed) { | | | | | | | | | | | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | } else { nsvg__straightJoin(r, &left, &right, p1, lineWidth); } p0 = p1++; } if (closed) { /* 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 */ 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); else if (lineCap == NSVG_CAP_SQUARE) nsvg__squareCap(r, &right, &left, p1, -dx, -dy, lineWidth, 1); else if (lineCap == NSVG_CAP_ROUND) nsvg__roundCap(r, &right, &left, p1, -dx, -dy, lineWidth, ncap, 1); } } static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoin) { int i, j; 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 */ p0->dx = p1->x - p0->x; p0->dy = p1->y - p0->y; p0->len = nsvg__normalize(&p0->dx, &p0->dy); /* Advance */ p0 = p1++; } /* 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 */ 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; if (s2 > 600.0f) { s2 = 600.0f; } p1->dmx *= s2; p1->dmy *= s2; } /* Clear flags, but keep the corner. */ p1->flags = (p1->flags & NSVG_PT_CORNER) ? NSVG_PT_CORNER : 0; /* 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. */ 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; } } p0 = p1++; |
︙ | ︙ | |||
752 753 754 755 756 757 758 | NSVGpoint* p0, *p1; float miterLimit = shape->miterLimit; int lineJoin = shape->strokeLineJoin; int lineCap = shape->strokeLineCap; float lineWidth = shape->strokeWidth * scale; for (path = shape->paths; path != NULL; path = path->next) { | | | | | | | | | | | | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | NSVGpoint* p0, *p1; float miterLimit = shape->miterLimit; int lineJoin = shape->strokeLineJoin; int lineCap = shape->strokeLineCap; float lineWidth = shape->strokeWidth * scale; for (path = shape->paths; path != NULL; path = path->next) { /* 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); } if (r->npoints < 2) continue; closed = path->closed; /* 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]; closed = 1; } if (shape->strokeDashCount > 0) { int idash = 0, dashState = 1; float totalDist = 0, dashLen, allDashLen, dashOffset; NSVGpoint cur; if (closed) nsvg__appendPathPoint(r, r->points[0]); /* Duplicate points -> points2. */ nsvg__duplicatePoints(r); r->npoints = 0; cur = r->points2[0]; nsvg__appendPathPoint(r, cur); /* 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 */ dashOffset = fmodf(shape->strokeDashOffset, allDashLen); if (dashOffset < 0.0f) dashOffset += allDashLen; while (dashOffset > shape->strokeDashArray[idash]) { dashOffset -= shape->strokeDashArray[idash]; idash = (idash + 1) % shape->strokeDashCount; } dashLen = (shape->strokeDashArray[idash] - dashOffset) * scale; for (j = 1; j < r->npoints2; ) { 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 */ 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 */ if (r->npoints > 1 && dashState) { nsvg__prepareStroke(r, miterLimit, lineJoin); nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth); } /* Advance dash pattern */ dashState = !dashState; idash = (idash+1) % shape->strokeDashCount; dashLen = shape->strokeDashArray[idash] * scale; /* Restart */ cur.x = x; cur.y = y; cur.flags = NSVG_PT_CORNER; totalDist = 0.0f; r->npoints = 0; nsvg__appendPathPoint(r, cur); } else { totalDist += dist; cur = r->points2[j]; nsvg__appendPathPoint(r, cur); j++; } } /* 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); } } |
︙ | ︙ | |||
867 868 869 870 871 872 873 | static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float startPoint) { NSVGactiveEdge* z; float dxdy; if (r->freelist != NULL) { | | | | | | | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float startPoint) { NSVGactiveEdge* z; float dxdy; if (r->freelist != NULL) { /* Restore from freelist. */ z = r->freelist; r->freelist = z->next; } else { /* 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 */ 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->ey = e->y1; z->next = 0; z->dir = e->dir; return z; } |
︙ | ︙ | |||
906 907 908 909 910 911 912 | { int i = x0 >> NSVG__FIXSHIFT; int j = x1 >> NSVG__FIXSHIFT; if (i < *xmin) *xmin = i; if (j > *xmax) *xmax = j; if (i < len && j >= 0) { if (i == j) { | | | | | | | | | | > | | | | | | | | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | { int i = x0 >> NSVG__FIXSHIFT; 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 */ scanline[i] = (unsigned char)(scanline[i] + ((x1 - x0) * maxWeight >> NSVG__FIXSHIFT)); } else { 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 */ if (j < len) /* add antialiasing for x1 */ scanline[j] = (unsigned char)(scanline[j] + (((x1 & NSVG__FIXMASK) * maxWeight) >> NSVG__FIXSHIFT)); else j = len; /* clip */ 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 */ static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, char fillRule) { /* non-zero winding fill */ int x0 = 0, w = 0; if (fillRule == NSVG_FILLRULE_NONZERO) { /* Non-zero */ while (e != NULL) { if (w == 0) { /* 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 (w == 0) nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax); } e = e->next; } } else if (fillRule == NSVG_FILLRULE_EVENODD) { /* Even-odd */ while (e != NULL) { if (w == 0) { /* 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); } e = e->next; } } } static float nsvg__clampf(float a, float mn, float mx) { return a < mn ? mn : (a > mx ? mx : a); } static unsigned int nsvg__RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { return ((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16) | ((unsigned int)a << 24); } static unsigned int nsvg__lerpRGBA(unsigned int c0, unsigned int c1, float u) { int iu = (int)(nsvg__clampf(u, 0.0f, 1.0f) * 256.0f); int r = (((c0) & 0xff)*(256-iu) + (((c1) & 0xff)*iu)) >> 8; int g = (((c0>>8) & 0xff)*(256-iu) + (((c1>>8) & 0xff)*iu)) >> 8; |
︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | cb = (cache->colors[0] >> 16) & 0xff; ca = (cache->colors[0] >> 24) & 0xff; for (i = 0; i < count; i++) { int r,g,b; int a = nsvg__div255((int)cover[0] * ca); int ia = 255 - a; | | | | | | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | cb = (cache->colors[0] >> 16) & 0xff; ca = (cache->colors[0] >> 24) & 0xff; for (i = 0; i < count; i++) { int r,g,b; int a = nsvg__div255((int)cover[0] * ca); int ia = 255 - a; /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); /* 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]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; dst[2] = (unsigned char)b; dst[3] = (unsigned char)a; cover++; dst += 4; } } else if (cache->type == NSVG_PAINT_LINEAR_GRADIENT) { /* 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; fx = ((float)x - tx) / scale; fy = ((float)y - ty) / scale; |
︙ | ︙ | |||
1052 1053 1054 1055 1056 1057 1058 | cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; | | | | | | | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); /* 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]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; dst[2] = (unsigned char)b; dst[3] = (unsigned char)a; 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) */ float fx, fy, dx, gx, gy, gd; float* t = cache->xform; int i, cr, cg, cb, ca; unsigned int c; fx = ((float)x - tx) / scale; fy = ((float)y - ty) / scale; |
︙ | ︙ | |||
1099 1100 1101 1102 1103 1104 1105 | cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; | | | | 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); /* 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]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; |
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 | } 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; | | | | | | | | | | | | | | | | | | | | 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | } 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 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 */ 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 */ while (*step) { NSVGactiveEdge *z = *step; if (z->ey <= scany) { *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 */ } } /* resort the list if needed */ for (;;) { int changed = 0; step = &active; while (*step && (*step)->next) { if ((*step)->x > (*step)->next->x) { NSVGactiveEdge* t = *step; NSVGactiveEdge* q = t->next; t->next = q->next; q->next = t; *step = q; changed = 1; } 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 */ 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 */ if (active == NULL) { active = z; } else if (z->x < active->x) { /* insert at front */ z->next = active; active = z; } else { /* 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 */ z->next = p->next; p->next = z; } } e++; } /* now process all active edges in non-zero fashion */ if (active != NULL) nsvg__fillActiveEdges(r->scanline, r->width, active, maxWeight, &xmin, &xmax, fillRule); } /* 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); } } } static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int stride) { int x,y; /* 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) { row[0] = (unsigned char)(r*255/a); row[1] = (unsigned char)(g*255/a); row[2] = (unsigned char)(b*255/a); } row += 4; } } /* 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) { if (x-1 > 0 && row[-1] != 0) { r += row[-4]; |
︙ | ︙ | |||
1407 1408 1409 1410 1411 1412 1413 | if (shape->fill.type != NSVG_PAINT_NONE) { nsvg__resetPool(r); r->freelist = NULL; r->nedges = 0; nsvg__flattenShape(r, shape, scale); | | | > | | | | | > | | > > | 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 | if (shape->fill.type != NSVG_PAINT_NONE) { nsvg__resetPool(r); r->freelist = NULL; r->nedges = 0; nsvg__flattenShape(r, shape, scale); /* 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 */ if (r->nedges != 0) qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); /* 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) { nsvg__resetPool(r); r->freelist = NULL; r->nedges = 0; nsvg__flattenShapeStroke(r, shape, scale); /* dumpEdges(r, "edge.svg"); */ /* 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 */ if (r->nedges != 0) qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); /* 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); } } nsvg__unpremultiplyAlpha(dst, w, h, stride); r->bitmap = NULL; r->width = 0; r->height = 0; r->stride = 0; } #endif #endif /* NANOSVGRAST_H */ |
Changes to generic/tk.decls.
1 2 3 4 5 6 7 | # tk.decls -- # # This file contains the declarations for all supported public # functions that are exported by the Tk library via the stubs table. # This file is used to generate the tkDecls.h, tkPlatDecls.h, # tkStub.c, and tkPlatStub.c files. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # tk.decls -- # # This file contains the declarations for all supported public # functions that are exported by the Tk library via the stubs table. # This file is used to generate the tkDecls.h, tkPlatDecls.h, # tkStub.c, and tkPlatStub.c files. # # Copyright © 1998-2000 Ajuba Solutions. # Copyright © 2007 Daniel A. Steffen <[email protected]> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. library tk # Define the tk interface with 3 sub interfaces: |
︙ | ︙ | |||
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | declare 278 { void Tk_SendVirtualEvent(Tk_Window tkwin, const char *eventName, Tcl_Obj *detail) } declare 279 { Tcl_Obj *Tk_FontGetDescription(Tk_Font tkfont) } # Define the platform specific public Tk interface. These functions are # only available on the designated platform. interface tkPlat ################################ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | declare 278 { void Tk_SendVirtualEvent(Tk_Window tkwin, const char *eventName, Tcl_Obj *detail) } declare 279 { Tcl_Obj *Tk_FontGetDescription(Tk_Font tkfont) } # TIP#529 declare 280 { void Tk_CreatePhotoImageFormatVersion3( const Tk_PhotoImageFormatVersion3 *formatPtr) } # TIP#606 declare 281 { void Tk_DrawHighlightBorder(Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable) } declare 282 { void Tk_SetMainMenubar(Tcl_Interp *interp, Tk_Window tkwin, const char *menuName) } declare 283 { void Tk_SetWindowMenubar(Tcl_Interp *interp, Tk_Window tkwin, const char *oldMenuName, const char *menuName) } declare 284 { void Tk_ClipDrawableToRect(Display *display, Drawable d, int x, int y, int width, int height) } declare 285 { Tcl_Obj *Tk_GetSystemDefault(Tk_Window tkwin, const char *dbName, const char *className) } declare 286 { int Tk_UseWindow(Tcl_Interp *interp, Tk_Window tkwin, const char *string) } declare 287 { void Tk_MakeContainer(Tk_Window tkwin) } declare 288 { Tk_Window Tk_GetOtherWindow(Tk_Window tkwin) } declare 289 { void Tk_Get3DBorderColors(Tk_3DBorder border, XColor *bgColorPtr, XColor *darkColorPtr, XColor *lightColorPtr) } declare 290 { Window Tk_MakeWindow(Tk_Window tkwin, Window parent) } # Define the platform specific public Tk interface. These functions are # only available on the designated platform. interface tkPlat ################################ |
︙ | ︙ |
Changes to generic/tk.h.
︙ | ︙ | |||
64 65 66 67 68 69 70 | * You may also need to update some of these files when the numbers change for * the version of Tcl that this release of Tk is compiled against. */ #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 7 #define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE | | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | * You may also need to update some of these files when the numbers change for * the version of Tcl that this release of Tk is compiled against. */ #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 7 #define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE #define TK_RELEASE_SERIAL 6 #define TK_VERSION "8.7" #define TK_PATCH_LEVEL "8.7a6" /* * A special definition used to allow this header file to be included from * windows or mac resource files so that they can obtain version information. * RC_INVOKED is defined by default by the windows RC tool and manually set * for macintosh. * |
︙ | ︙ | |||
90 91 92 93 94 95 96 | # pragma GCC diagnostic ignored "-Wc++-compat" #endif # include <X11/Xlib.h> # ifdef MAC_OSX_TK # include <X11/X.h> # endif #endif | < < | < | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | # pragma GCC diagnostic ignored "-Wc++-compat" #endif # include <X11/Xlib.h> # ifdef MAC_OSX_TK # include <X11/X.h> # endif #endif #include <stddef.h> #ifdef BUILD_tk #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT #else # ifndef TCL_STORAGE_CLASS # define TCL_STORAGE_CLASS DLLIMPORT |
︙ | ︙ | |||
167 168 169 170 171 172 173 | TK_OPTION_JUSTIFY, TK_OPTION_ANCHOR, TK_OPTION_SYNONYM, TK_OPTION_PIXELS, TK_OPTION_WINDOW, TK_OPTION_END, TK_OPTION_CUSTOM, | | > | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | TK_OPTION_JUSTIFY, TK_OPTION_ANCHOR, TK_OPTION_SYNONYM, TK_OPTION_PIXELS, TK_OPTION_WINDOW, TK_OPTION_END, TK_OPTION_CUSTOM, TK_OPTION_STYLE, TK_OPTION_INDEX } Tk_OptionType; /* * Structures of the following type are used by widgets to specify their * configuration options. Typically each widget has a static array of these * structures, where each element of the array describes a single * configuration option. The array is passed to Tk_CreateOptionTable. |
︙ | ︙ | |||
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | #define TK_NOTIFY_SHARE 20 /* * Enumerated type for describing a point by which to anchor something: */ typedef enum { TK_ANCHOR_N, TK_ANCHOR_NE, TK_ANCHOR_E, TK_ANCHOR_SE, TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, TK_ANCHOR_CENTER } Tk_Anchor; /* * Enumerated type for describing a style of justification: */ typedef enum { TK_JUSTIFY_LEFT, TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER } Tk_Justify; /* * The following structure is used by Tk_GetFontMetrics() to return * information about the properties of a Tk_Font. */ | > > | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | #define TK_NOTIFY_SHARE 20 /* * Enumerated type for describing a point by which to anchor something: */ typedef enum { TK_ANCHOR_NULL = -1, TK_ANCHOR_N, TK_ANCHOR_NE, TK_ANCHOR_E, TK_ANCHOR_SE, TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, TK_ANCHOR_CENTER } Tk_Anchor; /* * Enumerated type for describing a style of justification: */ typedef enum { TK_JUSTIFY_NULL = -1, TK_JUSTIFY_LEFT, TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER } Tk_Justify; /* * The following structure is used by Tk_GetFontMetrics() to return * information about the properties of a Tk_Font. */ |
︙ | ︙ | |||
833 834 835 836 837 838 839 | unsigned long dummy7; /* dirtyAtts */ unsigned int flags; char *dummy8; /* handlerList */ #if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8) XIC dummy9; /* inputContext */ #endif /* TK_USE_INPUT_METHODS */ ClientData *dummy10; /* tagPtr */ | > | | > > > > | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | unsigned long dummy7; /* dirtyAtts */ unsigned int flags; char *dummy8; /* handlerList */ #if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8) XIC dummy9; /* inputContext */ #endif /* TK_USE_INPUT_METHODS */ ClientData *dummy10; /* tagPtr */ #if TCL_MAJOR_VERSION > 8 size_t dummy11; /* numTags */ size_t dummy12; /* optionLevel */ #else int dummy11; int dummy12; #endif char *dummy13; /* selHandlerList */ char *dummy14; /* geomMgrPtr */ ClientData dummy15; /* geomData */ int reqWidth, reqHeight; int internalBorderLeft; char *dummy16; /* wmInfoPtr */ char *dummy17; /* classProcPtr */ |
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 | Tk_Item *itemPtr, int argc, char **argv); typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, int beforeThis, char *string); typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, char *indexString, int *indexPtr); #else typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas, | | | | | 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | Tk_Item *itemPtr, int argc, char **argv); typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, int beforeThis, char *string); typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, char *indexString, int *indexPtr); #else typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[], int flags); typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); #if TCL_MAJOR_VERSION > 8 typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, size_t beforeThis, Tcl_Obj *string); typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Obj *indexString, size_t *indexPtr); #else typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, |
︙ | ︙ | |||
1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 | Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); typedef int (Tk_ImageFileWriteProc) (Tcl_Interp *interp, const char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); #endif /* USE_OLD_IMAGE */ /* * The following structure represents a particular file format for storing * images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image * files of that format to be recognized and read into a photo image. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 | Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); typedef int (Tk_ImageFileWriteProc) (Tcl_Interp *interp, const char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); #endif /* USE_OLD_IMAGE */ /* * The following alternate definitions are used with the Tk8.7 file format * supporting a metadata dict, internal dstring and close file flag */ typedef struct Tk_PhotoImageFormatVersion3 Tk_PhotoImageFormatVersion3; typedef int (Tk_ImageFileMatchProcVersion3) (Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *format, Tcl_Obj *metadataIn, int *widthPtr, int *heightPtr, Tcl_Obj *metadataOut); typedef int (Tk_ImageStringMatchProcVersion3) (Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *format, Tcl_Obj *metadataIn, int *widthPtr, int *heightPtr, Tcl_Obj *metadataOut); typedef int (Tk_ImageFileReadProcVersion3) (Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *format, Tcl_Obj *metadataIn, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY, Tcl_Obj *metadataOut); typedef int (Tk_ImageStringReadProcVersion3) (Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *format, Tcl_Obj *metadataIn, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY, Tcl_Obj *metadataOut); typedef int (Tk_ImageFileWriteProcVersion3) (Tcl_Interp *interp, const char *fileName, Tcl_Obj *format, Tcl_Obj *metadataIn, Tk_PhotoImageBlock *blockPtr); typedef int (Tk_ImageStringWriteProcVersion3) (Tcl_Interp *interp, Tcl_Obj *format, Tcl_Obj *metadataIn, Tk_PhotoImageBlock *blockPtr); /* * The following structure represents a particular file format for storing * images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image * files of that format to be recognized and read into a photo image. */ |
︙ | ︙ | |||
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 | * representation of the data in a photo * image.*/ struct Tk_PhotoImageFormat *nextPtr; /* Next in list of all photo image formats * currently known. Filled in by Tk, not by * image format handler. */ }; /* *---------------------------------------------------------------------- * * Procedure prototypes and structures used for managing styles: * *---------------------------------------------------------------------- | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 | * representation of the data in a photo * image.*/ struct Tk_PhotoImageFormat *nextPtr; /* Next in list of all photo image formats * currently known. Filled in by Tk, not by * image format handler. */ }; /* * The following structure is the same plus added support for the metadata * structure. */ struct Tk_PhotoImageFormatVersion3 { const char *name; /* Name of image file format */ Tk_ImageFileMatchProcVersion3 *fileMatchProc; /* Procedure to call to determine whether an * image file matches this format. */ Tk_ImageStringMatchProcVersion3 *stringMatchProc; /* Procedure to call to determine whether the * data in a string matches this format. */ Tk_ImageFileReadProcVersion3 *fileReadProc; /* Procedure to call to read data from an * image file into a photo image. */ Tk_ImageStringReadProcVersion3 *stringReadProc; /* Procedure to call to read data from a * string into a photo image. */ Tk_ImageFileWriteProcVersion3 *fileWriteProc; /* Procedure to call to write data from a * photo image to a file. */ Tk_ImageStringWriteProcVersion3 *stringWriteProc; /* Procedure to call to obtain a string * representation of the data in a photo * image.*/ struct Tk_PhotoImageFormatVersion3 *nextPtr; /* Next in list of all photo image formats * currently known. Filled in by Tk, not by * image format handler. */ }; /* *---------------------------------------------------------------------- * * Procedure prototypes and structures used for managing styles: * *---------------------------------------------------------------------- |
︙ | ︙ |
Changes to generic/tk3d.c.
1 2 3 4 5 6 | /* * tk3d.c -- * * This module provides procedures to draw borders in the * three-dimensional Motif style. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * tk3d.c -- * * This module provides procedures to draw borders in the * three-dimensional Motif style. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tk3d.h" /* * The following table defines the string values for reliefs, which are used * by Tk_GetReliefFromObj. */ const char *const tkReliefStrings[] = { "flat", "groove", "raised", "ridge", "solid", "sunken", NULL }; /* * Forward declarations for functions defined in this file: */ |
︙ | ︙ | |||
619 620 621 622 623 624 625 | int Tk_GetReliefFromObj( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Obj *objPtr, /* The object we are trying to get the value * from. */ int *resultPtr) /* Where to place the answer. */ { | | | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | int Tk_GetReliefFromObj( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Obj *objPtr, /* The object we are trying to get the value * from. */ int *resultPtr) /* Where to place the answer. */ { return Tcl_GetIndexFromObjStruct(interp, objPtr, tkReliefStrings, sizeof(char *), "relief", 0, resultPtr); } /* *---------------------------------------------------------------------- * * Tk_GetRelief -- |
︙ | ︙ | |||
1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 | Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(borderPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } return resultPtr; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(borderPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } return resultPtr; } /* *-------------------------------------------------------------- * * Tk_Get3BorderColors -- * * Given a Tk_3DBorder determine its 3 colors. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void Tk_Get3DBorderColors( Tk_3DBorder border, XColor *bgColorPtr, XColor *darkColorPtr, XColor *lightColorPtr) { if (bgColorPtr) { *bgColorPtr = *((TkBorder *)border)->bgColorPtr; } if (darkColorPtr) { *darkColorPtr = *((TkBorder *) border)->darkColorPtr; } if (lightColorPtr) { *lightColorPtr = *((TkBorder *) border)->lightColorPtr; } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tk3d.h.
1 2 3 4 5 | /* * tk3d.h -- * * Declarations of types and functions shared by the 3d border module. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tk3d.h -- * * Declarations of types and functions shared by the 3d border module. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TK3D #define _TK3D |
︙ | ︙ |
Changes to generic/tkArgv.c.
1 2 3 4 5 6 | /* * tkArgv.c -- * * This file contains a function that handles table-based argv-argc * parsing. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkArgv.c -- * * This file contains a function that handles table-based argv-argc * parsing. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to generic/tkArray.h.
1 2 3 4 5 6 7 | /* * tkArray.h -- * * An array is a sequence of items, stored in a contiguous memory region. * Random access to any item is very fast. New items can be either appended * or prepended. An array may be traversed in the forward or backward direction. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkArray.h -- * * An array is a sequence of items, stored in a contiguous memory region. * Random access to any item is very fast. New items can be either appended * or prepended. An array may be traversed in the forward or backward direction. * * Copyright © 2018-2019 Gregor Cramer. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ /* * Note that this file will not be included in header files, it is the purpose |
︙ | ︙ |
Changes to generic/tkAtom.c.
1 2 3 4 5 6 7 8 | /* * tkAtom.c -- * * This file manages a cache of X Atoms in order to avoid interactions * with the X server. It's much like the Xmu routines, except it has a * cleaner interface (caller doesn't have to provide permanent storage * for atom names, for example). * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkAtom.c -- * * This file manages a cache of X Atoms in order to avoid interactions * with the X server. It's much like the Xmu routines, except it has a * cleaner interface (caller doesn't have to provide permanent storage * for atom names, for example). * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to generic/tkBind.c.
1 2 3 4 5 6 | /* * tkBind.c -- * * This file provides functions that associate Tcl commands with X events * or sequences of X events. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkBind.c -- * * This file provides functions that associate Tcl commands with X events * or sequences of X events. * * Copyright © 1989-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1998 Scriptics Corporation. * Copyright © 2018-2019 Gregor Cramer. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkDList.h" |
︙ | ︙ | |||
328 329 330 331 332 333 334 | * Compute memory size of struct PatSeq with given pattern size. * The caller must be sure that pattern size is greater than zero. */ #define PATSEQ_MEMSIZE(numPats) (sizeof(PatSeq) + (numPats - 1)*sizeof(TkPattern)) /* * Constants that define how close together two events must be in milliseconds | | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | * Compute memory size of struct PatSeq with given pattern size. * The caller must be sure that pattern size is greater than zero. */ #define PATSEQ_MEMSIZE(numPats) (sizeof(PatSeq) + (numPats - 1)*sizeof(TkPattern)) /* * Constants that define how close together two events must be in milliseconds * or pixels to be considered close in space or time. */ #define NEARBY_PIXELS 5 #define NEARBY_MS 500 /* * The following structure is used in the nameTable of a virtual event table |
︙ | ︙ | |||
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | #define MULT_CLICKS (DOUBLE|TRIPLE|QUADRUPLE) static const ModInfo modArray[] = { {"Control", ControlMask, 0}, {"Shift", ShiftMask, 0}, {"Lock", LockMask, 0}, {"Meta", META_MASK, 0}, {"M", META_MASK, 0}, {"Alt", ALT_MASK, 0}, {"Extended", EXTENDED_MASK, 0}, {"B1", Button1Mask, 0}, {"Button1", Button1Mask, 0}, {"B2", Button2Mask, 0}, {"Button2", Button2Mask, 0}, {"B3", Button3Mask, 0}, | > > | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | #define MULT_CLICKS (DOUBLE|TRIPLE|QUADRUPLE) static const ModInfo modArray[] = { {"Control", ControlMask, 0}, {"Shift", ShiftMask, 0}, {"Lock", LockMask, 0}, {"Meta", META_MASK, 0}, #ifndef TK_NO_DEPRECATED {"M", META_MASK, 0}, #endif {"Alt", ALT_MASK, 0}, {"Extended", EXTENDED_MASK, 0}, {"B1", Button1Mask, 0}, {"Button1", Button1Mask, 0}, {"B2", Button2Mask, 0}, {"Button2", Button2Mask, 0}, {"B3", Button3Mask, 0}, |
︙ | ︙ | |||
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | {"Button7", Button7Mask, 0}, {"B8", Button8Mask, 0}, {"Button8", Button8Mask, 0}, {"B9", Button9Mask, 0}, {"Button9", Button9Mask, 0}, {"Mod1", Mod1Mask, 0}, {"M1", Mod1Mask, 0}, {"Command", Mod1Mask, 0}, {"Mod2", Mod2Mask, 0}, {"M2", Mod2Mask, 0}, {"Option", Mod2Mask, 0}, {"Mod3", Mod3Mask, 0}, {"M3", Mod3Mask, 0}, {"Mod4", Mod4Mask, 0}, {"M4", Mod4Mask, 0}, {"Mod5", Mod5Mask, 0}, {"M5", Mod5Mask, 0}, {"Double", 0, DOUBLE}, {"Triple", 0, TRIPLE}, {"Quadruple", 0, QUADRUPLE}, {"Any", 0, 0}, /* Ignored: historical relic */ | > > > > > > > > > > > > | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | {"Button7", Button7Mask, 0}, {"B8", Button8Mask, 0}, {"Button8", Button8Mask, 0}, {"B9", Button9Mask, 0}, {"Button9", Button9Mask, 0}, {"Mod1", Mod1Mask, 0}, {"M1", Mod1Mask, 0}, #ifdef MAC_OSX_TK {"Command", Mod1Mask, 0}, #elif defined (_WIN32) {"Command", ControlMask, 0}, #else {"Command", META_MASK, 0}, #endif {"Mod2", Mod2Mask, 0}, {"M2", Mod2Mask, 0}, #ifdef MAC_OSX_TK {"Option", Mod2Mask, 0}, #else {"Option", ALT_MASK, 0}, #endif {"Mod3", Mod3Mask, 0}, {"M3", Mod3Mask, 0}, {"Num", Mod3Mask, 0}, {"Mod4", Mod4Mask, 0}, {"Fn", Mod4Mask, 0}, {"M4", Mod4Mask, 0}, {"Mod5", Mod5Mask, 0}, {"M5", Mod5Mask, 0}, {"Double", 0, DOUBLE}, {"Triple", 0, TRIPLE}, {"Quadruple", 0, QUADRUPLE}, {"Any", 0, 0}, /* Ignored: historical relic */ |
︙ | ︙ | |||
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | * This is necessary because X doesn't report up events unless you also ask * for down events. Also, X doesn't report button state in motion events * unless you've asked about button events. */ static const EventInfo eventArray[] = { {"Key", KeyPress, KeyPressMask}, {"KeyPress", KeyPress, KeyPressMask}, {"KeyRelease", KeyRelease, KeyPressMask|KeyReleaseMask}, {"Button", ButtonPress, ButtonPressMask}, {"ButtonPress", ButtonPress, ButtonPressMask}, {"ButtonRelease", ButtonRelease, ButtonPressMask|ButtonReleaseMask}, {"Motion", MotionNotify, ButtonPressMask|PointerMotionMask}, {"Enter", EnterNotify, EnterWindowMask}, {"Leave", LeaveNotify, LeaveWindowMask}, {"FocusIn", FocusIn, FocusChangeMask}, {"FocusOut", FocusOut, FocusChangeMask}, {"Expose", Expose, ExposureMask}, | > > > > | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | * This is necessary because X doesn't report up events unless you also ask * for down events. Also, X doesn't report button state in motion events * unless you've asked about button events. */ static const EventInfo eventArray[] = { {"Key", KeyPress, KeyPressMask}, #ifndef TK_NO_DEPRECATED {"KeyPress", KeyPress, KeyPressMask}, #endif {"KeyRelease", KeyRelease, KeyPressMask|KeyReleaseMask}, {"Button", ButtonPress, ButtonPressMask}, #ifndef TK_NO_DEPRECATED {"ButtonPress", ButtonPress, ButtonPressMask}, #endif {"ButtonRelease", ButtonRelease, ButtonPressMask|ButtonReleaseMask}, {"Motion", MotionNotify, ButtonPressMask|PointerMotionMask}, {"Enter", EnterNotify, EnterWindowMask}, {"Leave", LeaveNotify, LeaveWindowMask}, {"FocusIn", FocusIn, FocusChangeMask}, {"FocusOut", FocusOut, FocusChangeMask}, {"Expose", Expose, ExposureMask}, |
︙ | ︙ | |||
744 745 746 747 748 749 750 | void TkpDumpPS(const PatSeq *psPtr); void TkpDumpPSList(const PSList *psList); #endif /* * Some useful helper functions. */ | | | | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | void TkpDumpPS(const PatSeq *psPtr); void TkpDumpPSList(const PSList *psList); #endif /* * Some useful helper functions. */ #if SUPPORT_DEBUGGING static int BindCount = 0; /* Can be set or queried from Tcl through 'event debug' subcommand. Otherwise not used. */ #endif static unsigned Max(unsigned a, unsigned b) { return a < b ? b : a; } static int Abs(int n) { return n < 0 ? -n : n; } static int IsOdd(int n) { return n & 1; } static int TestNearbyTime(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY_MS; } |
︙ | ︙ | |||
798 799 800 801 802 803 804 805 806 807 808 809 810 811 | return (button > 3) ? (button + 4) : button; } static Time CurrentTimeInMilliSecs(void) { Tcl_Time now; Tcl_GetTime(&now); return ((Time) now.sec)*1000 + ((Time) now.usec)/1000; } static Info GetInfo( const PatSeq *psPtr, | > | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | return (button > 3) ? (button + 4) : button; } static Time CurrentTimeInMilliSecs(void) { Tcl_Time now; Tcl_GetTime(&now); return ((Time) now.sec)*1000 + ((Time) now.usec)/1000; } static Info GetInfo( const PatSeq *psPtr, |
︙ | ︙ | |||
2990 2991 2992 2993 2994 2995 2996 | snprintf(numStorage, sizeof(numStorage), "%" TCL_LL_MODIFIER "u", unumber); \ string = numStorage; \ } while (1) { char numStorage[TCL_INTEGER_SPACE]; const char *string; | | | | 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 | snprintf(numStorage, sizeof(numStorage), "%" TCL_LL_MODIFIER "u", unumber); \ string = numStorage; \ } while (1) { char numStorage[TCL_INTEGER_SPACE]; const char *string; long long number; /* signed */ unsigned long long unumber; /* unsigned */ /* * Find everything up to the next % character and append it to the * result string. */ for (string = before; *string && *string != '%'; ++string) |
︙ | ︙ | |||
3339 3340 3341 3342 3343 3344 3345 | int index, i; char *name; const char *event; Tk_Window tkwin; TkBindInfo bindInfo; VirtualEventTable *vetPtr; | | > > > > > | > > > > > < < < < < < < < < < | 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 | int index, i; char *name; const char *event; Tk_Window tkwin; TkBindInfo bindInfo; VirtualEventTable *vetPtr; static const char *const optionStrings[] = { "add", #if SUPPORT_DEBUGGING "debug", #endif "delete", "generate", "info", NULL }; enum options { EVENT_ADD, #if SUPPORT_DEBUGGING EVENT_DEBUG, #endif EVENT_DELETE, EVENT_GENERATE, EVENT_INFO }; assert(clientData); if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct( interp, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } tkwin = (Tk_Window) clientData; bindInfo = ((TkWindow *) tkwin)->mainPtr->bindInfo; vetPtr = &bindInfo->virtualEventTable; |
︙ | ︙ | |||
3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 | for (i = 3; i < objc; ++i) { event = Tcl_GetString(objv[i]); if (!CreateVirtualEvent(interp, vetPtr, name, event)) { return TCL_ERROR; } } break; case EVENT_DELETE: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "virtual ?sequence ...?"); return TCL_ERROR; } name = Tcl_GetString(objv[2]); if (objc == 3) { | > > > > > > > > > > > > > > > > | 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 | for (i = 3; i < objc; ++i) { event = Tcl_GetString(objv[i]); if (!CreateVirtualEvent(interp, vetPtr, name, event)) { return TCL_ERROR; } } break; #if SUPPORT_DEBUGGING case EVENT_DEBUG: if (objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "debug number"); return TCL_ERROR; } if (objc < 3) { Tcl_SetObjResult(interp, Tcl_NewIntObj(BindCount)); return TCL_OK; } if (Tcl_GetIntFromObj(interp, objv[2], &BindCount) != TCL_OK) { return TCL_ERROR; } return TCL_OK; #endif case EVENT_DELETE: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "virtual ?sequence ...?"); return TCL_ERROR; } name = Tcl_GetString(objv[2]); if (objc == 3) { |
︙ | ︙ | |||
3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 | synch = 1; warp = 0; pos = TCL_QUEUE_TAIL; for (i = 2; i < (unsigned) objc; i += 2) { Tcl_Obj *optionPtr, *valuePtr; int badOpt = 0; int index; optionPtr = objv[i]; valuePtr = objv[i + 1]; if (Tcl_GetIndexFromObjStruct(interp, optionPtr, fieldStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { | > > > > > | 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 | synch = 1; warp = 0; pos = TCL_QUEUE_TAIL; for (i = 2; i < (unsigned) objc; i += 2) { Tcl_Obj *optionPtr, *valuePtr; #if defined(_MSC_VER) /* Work around MSVC compiler optimization bug, see [d93c8175fd]. */ volatile int badOpt = 0; #else int badOpt = 0; #endif int index; optionPtr = objv[i]; valuePtr = objv[i + 1]; if (Tcl_GetIndexFromObjStruct(interp, optionPtr, fieldStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { |
︙ | ︙ | |||
5236 5237 5238 5239 5240 5241 5242 | */ KeySym TkStringToKeysym( const char *name) /* Name of a keysym. */ { #ifdef REDO_KEYSYM_LOOKUP | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | | 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 | */ KeySym TkStringToKeysym( const char *name) /* Name of a keysym. */ { #ifdef REDO_KEYSYM_LOOKUP Tcl_HashEntry *hPtr; #endif /* REDO_KEYSYM_LOOKUP */ int keysym; size_t len = TkUtfToUniChar(name, &keysym); if (name[len] == '\0') { if (!Tcl_UniCharIsPrint(keysym)) { /* This form not supported */ } else if ((unsigned)(keysym - 0x21) <= 0x5D) { return keysym; } else if ((unsigned)(keysym - 0xA1) <= 0x5E) { return keysym; } else if (keysym == 0x20AC) { return 0x20AC; } else { return keysym + 0x1000000; } } #ifdef REDO_KEYSYM_LOOKUP if ((name[0] == 'U') && ((unsigned)(name[1] - '0') <= 9)) { char *p = (char *)name + 1; keysym = strtol(p, &p, 16); if ((p >= name + 5) && (p <= name + 9) && !*p && (keysym >= 0x20) && ((unsigned)(keysym - 0x7F) > 0x20)) { if ((unsigned)(keysym - 0x21) <= 0x5D) { return keysym; } else if ((unsigned)(keysym - 0xA1) <= 0x5E) { return keysym; } else if (keysym == 0x20AC) { return keysym; } return keysym + 0x1000000; } } #endif #ifdef REDO_KEYSYM_LOOKUP hPtr = Tcl_FindHashEntry(&keySymTable, name); if (hPtr) { return (KeySym) Tcl_GetHashValue(hPtr); } if (((unsigned)(name[0]-1) < 0x7F) && !name[1]) { keysym = (unsigned char) name[0]; if (TkKeysymToString(keysym)) { return keysym; } } #endif /* REDO_KEYSYM_LOOKUP */ assert(name); |
︙ | ︙ | |||
5276 5277 5278 5279 5280 5281 5282 | */ const char * TkKeysymToString( KeySym keysym) { #ifdef REDO_KEYSYM_LOOKUP | | > > > > > > > > > > > > > > > > > > > > > > > > < < < | 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 | */ const char * TkKeysymToString( KeySym keysym) { #ifdef REDO_KEYSYM_LOOKUP Tcl_HashEntry *hPtr; #endif if ((unsigned)(keysym - 0x21) <= 0x5D) { keysym += 0x1000000; } else if ((unsigned)(keysym - 0xA1) <= 0x5E) { keysym += 0x1000000; } else if (keysym == 0x20AC) { keysym += 0x1000000; } if ((keysym >= 0x1000020) && (keysym <= 0x110FFFF) && ((unsigned)(keysym - 0x100007F) > 0x20)) { char buf[10]; if (Tcl_UniCharIsPrint(keysym-0x1000000)) { buf[TkUniCharToUtf(keysym - 0x1000000, buf)] = '\0'; } else if (keysym >= 0x1010000) { sprintf(buf, "U%08X", (int)(keysym - 0x1000000)); } else { sprintf(buf, "U%04X", (int)(keysym - 0x1000000)); } return Tk_GetUid(buf); } #ifdef REDO_KEYSYM_LOOKUP hPtr = Tcl_FindHashEntry(&nameTable, INT2PTR(keysym)); if (hPtr) { return (const char *)Tcl_GetHashValue(hPtr); } #endif /* REDO_KEYSYM_LOOKUP */ return XKeysymToString(keysym); } /* *---------------------------------------------------------------------- * * TkpGetBindingXEvent -- |
︙ | ︙ |
Changes to generic/tkBitmap.c.
1 2 3 4 5 6 7 | /* * tkBitmap.c -- * * This file maintains a database of read-only bitmaps for the Tk * toolkit. This allows bitmaps to be shared between widgets and also * avoids interactions with the X server. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkBitmap.c -- * * This file maintains a database of read-only bitmaps for the Tk * toolkit. This allows bitmaps to be shared between widgets and also * avoids interactions with the X server. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | * or NULL if unavailable. */ { Tcl_Interp *dummy; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* | | | 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | * or NULL if unavailable. */ { Tcl_Interp *dummy; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * First initialize the data in the ThreadSpecificData structure, if * needed. */ if (!tsdPtr->initialized) { tsdPtr->initialized = 1; dummy = Tcl_CreateInterp(); Tcl_InitHashTable(&tsdPtr->predefBitmapTable, TCL_STRING_KEYS); |
︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | } /* *---------------------------------------------------------------------- * * TkGetBitmapPredefTable -- * | | | 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | } /* *---------------------------------------------------------------------- * * TkGetBitmapPredefTable -- * * This function is used by tkMacOSXBitmap.c to access the thread-specific * predefBitmap table that maps from the names of the predefined bitmaps * to data associated with those bitmaps. It is required because the * table is allocated in thread-local storage and is not visible outside * this file. * Results: * Returns a pointer to the predefined bitmap hash table for the current |
︙ | ︙ |
Changes to generic/tkButton.c.
1 2 3 4 5 6 7 | /* * tkButton.c -- * * This module implements a collection of button-like widgets for the Tk * toolkit. The widgets implemented include buttons, checkbuttons, * radiobuttons, and labels. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkButton.c -- * * This module implements a collection of button-like widgets for the Tk * toolkit. The widgets implemented include buttons, checkbuttons, * radiobuttons, and labels. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkButton.h" |
︙ | ︙ | |||
25 26 27 28 29 30 31 | * Class names for buttons, indexed by one of the type values defined in * tkButton.h. */ static const char *const classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"}; /* | | < < < < < < < < < | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | * Class names for buttons, indexed by one of the type values defined in * tkButton.h. */ static const char *const classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"}; /* * The following table defines the legal values for the -default/-state options. * It is used together with the "enum defaultValue/state" declarations in tkButton.h. */ const char *const tkStateStrings[] = { "active", "disabled", "normal", NULL }; /* * The following table defines the legal values for the -compound option. * It is used with the "enum compound" declaration in tkButton.h */ const char *const tkCompoundStrings[] = { "bottom", "center", "left", "none", "right", "top", NULL }; char tkDefButtonHighlightWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_HIGHLIGHT_WIDTH; char tkDefButtonPadx[TCL_INTEGER_SPACE] = DEF_BUTTON_PADX; char tkDefButtonPady[TCL_INTEGER_SPACE] = DEF_BUTTON_PADY; char tkDefButtonBorderWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_BORDER_WIDTH; |
︙ | ︙ | |||
87 88 89 90 91 92 93 | {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", | | | | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0, tkCompoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_LABEL_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0, DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefLabelHighlightWidth, offsetof(TkButton, highlightWidthPtr), offsetof(TkButton, highlightWidth), 0, 0, 0}, |
︙ | ︙ | |||
130 131 132 133 134 135 136 | {TK_OPTION_PIXELS, "-pady", "padY", "Pad", tkDefLabelPady, offsetof(TkButton, padYPtr), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state), | | | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | {TK_OPTION_PIXELS, "-pady", "padY", "Pad", tkDefLabelPady, offsetof(TkButton, padYPtr), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state), TK_OPTION_ENUM_VAR, tkStateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_LABEL_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; |
︙ | ︙ | |||
175 176 177 178 179 180 181 | {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", | | | | | | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0, tkCompoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", DEF_BUTTON_DEFAULT, TCL_INDEX_NONE, offsetof(TkButton, defaultState), TK_OPTION_ENUM_VAR, tkStateStrings, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_BUTTON_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0, DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, offsetof(TkButton, highlightWidthPtr), offsetof(TkButton, highlightWidth), 0, 0, 0}, |
︙ | ︙ | |||
231 232 233 234 235 236 237 | DEF_BUTTON_REPEAT_DELAY, TCL_INDEX_NONE, offsetof(TkButton, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", DEF_BUTTON_REPEAT_INTERVAL, TCL_INDEX_NONE, offsetof(TkButton, repeatInterval), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state), | | | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | DEF_BUTTON_REPEAT_DELAY, TCL_INDEX_NONE, offsetof(TkButton, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", DEF_BUTTON_REPEAT_INTERVAL, TCL_INDEX_NONE, offsetof(TkButton, repeatInterval), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state), TK_OPTION_ENUM_VAR, tkStateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; |
︙ | ︙ | |||
276 277 278 279 280 281 282 | {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", | | | | | | | | | | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0, tkCompoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_CHKRAD_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0, DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, offsetof(TkButton, highlightWidthPtr), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", DEF_BUTTON_INDICATOR, TCL_INDEX_NONE, offsetof(TkButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief", DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, offRelief), 0, 0, 0}, {TK_OPTION_STRING, "-offvalue", "offValue", "Value", DEF_BUTTON_OFF_VALUE, offsetof(TkButton, offValuePtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-onvalue", "onValue", "Value", DEF_BUTTON_ON_VALUE, offsetof(TkButton, onValuePtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief", DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", tkDefLabelPadx, offsetof(TkButton, padXPtr), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", tkDefLabelPady, offsetof(TkButton, padYPtr), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectcolor", "selectColor", "Background", DEF_BUTTON_SELECT_COLOR, TCL_INDEX_NONE, offsetof(TkButton, selectBorder), TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0}, {TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage", DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state), TK_OPTION_ENUM_VAR, tkStateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage", DEF_BUTTON_IMAGE, offsetof(TkButton, tristateImagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue", DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", DEF_CHECKBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), |
︙ | ︙ | |||
389 390 391 392 393 394 395 | {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", | | | | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0, tkCompoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_CHKRAD_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0, DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, offsetof(TkButton, highlightWidthPtr), offsetof(TkButton, highlightWidth), 0, 0, 0}, |
︙ | ︙ | |||
446 447 448 449 450 451 452 | DEF_BUTTON_SELECT_COLOR, TCL_INDEX_NONE, offsetof(TkButton, selectBorder), TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0}, {TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage", DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state), | | | | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | DEF_BUTTON_SELECT_COLOR, TCL_INDEX_NONE, offsetof(TkButton, selectBorder), TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0}, {TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage", DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state), TK_OPTION_ENUM_VAR, tkStateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage", DEF_BUTTON_IMAGE, offsetof(TkButton, tristateImagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue", DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0}, {TK_OPTION_STRING, "-value", "value", "Value", DEF_BUTTON_VALUE, offsetof(TkButton, onValuePtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", DEF_RADIOBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, |
︙ | ︙ | |||
683 684 685 686 687 688 689 | butPtr->display = Tk_Display(tkwin); butPtr->interp = interp; butPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin), ButtonWidgetObjCmd, butPtr, ButtonCmdDeletedProc); butPtr->type = type; butPtr->optionTable = optionTable; butPtr->textPtr = NULL; | | | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | butPtr->display = Tk_Display(tkwin); butPtr->interp = interp; butPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin), ButtonWidgetObjCmd, butPtr, ButtonCmdDeletedProc); butPtr->type = type; butPtr->optionTable = optionTable; butPtr->textPtr = NULL; butPtr->underline = INT_MIN; butPtr->textVarNamePtr = NULL; butPtr->bitmap = None; butPtr->imagePtr = NULL; butPtr->image = NULL; butPtr->selectImagePtr = NULL; butPtr->selectImage = NULL; butPtr->tristateImagePtr = NULL; |
︙ | ︙ | |||
1622 1623 1624 1625 1626 1627 1628 | * If the variable is being unset, then just re-establish the trace unless * the whole interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { butPtr->flags &= ~(SELECTED | TRISTATED); if (!Tcl_InterpDeleted(interp)) { | | | | 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 | * If the variable is being unset, then just re-establish the trace unless * the whole interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { butPtr->flags &= ~(SELECTED | TRISTATED); if (!Tcl_InterpDeleted(interp)) { void *probe = NULL; do { probe = Tcl_VarTraceInfo(interp, Tcl_GetString(butPtr->selVarNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, probe); if (probe == (void *)butPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * selVarNamePtr, which means it is not unset and not |
︙ | ︙ | |||
1741 1742 1743 1744 1745 1746 1747 | if (!Tcl_InterpDeleted(interp) && butPtr->textVarNamePtr != NULL) { /* * An unset trace on some variable brought us here, but is it * the variable we have stored in butPtr->textVarNamePtr ? */ | | | | 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | if (!Tcl_InterpDeleted(interp) && butPtr->textVarNamePtr != NULL) { /* * An unset trace on some variable brought us here, but is it * the variable we have stored in butPtr->textVarNamePtr ? */ void *probe = NULL; do { probe = Tcl_VarTraceInfo(interp, Tcl_GetString(butPtr->textVarNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonTextVarProc, probe); if (probe == (void *)butPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * textVarNamePtr, which means it is not unset and not |
︙ | ︙ |
Changes to generic/tkButton.h.
1 2 3 4 5 6 | /* * tkButton.h -- * * Declarations of types and functions used to implement button-like * widgets. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkButton.h -- * * Declarations of types and functions used to implement button-like * widgets. * * Copyright © 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKBUTTON #define _TKBUTTON |
︙ | ︙ | |||
63 64 65 66 67 68 69 | /* * Information about what's in the button. */ Tcl_Obj *textPtr; /* Value of -text option: specifies text to * display in button. */ int underline; /* Value of -underline option: specifies index | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | /* * Information about what's in the button. */ Tcl_Obj *textPtr; /* Value of -text option: specifies text to * display in button. */ int underline; /* Value of -underline option: specifies index * of character to underline. INT_MIN means don't * underline anything. */ Tcl_Obj *textVarNamePtr; /* Value of -textvariable option: specifies * name of variable or NULL. If non-NULL, * button displays the contents of this * variable. */ Pixmap bitmap; /* Value of -bitmap option. If not None, * specifies bitmap to display and text and |
︙ | ︙ |
Changes to generic/tkCanvArc.c.
1 2 3 4 5 | /* * tkCanvArc.c -- * * This file implements arc items for canvas widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkCanvArc.c -- * * This file implements arc items for canvas widgets. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ |
Changes to generic/tkCanvBmap.c.
1 2 3 4 5 | /* * tkCanvBmap.c -- * * This file implements bitmap items for canvas widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkCanvBmap.c -- * * This file implements bitmap items for canvas widgets. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
536 537 538 539 540 541 542 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; | | | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; default: x -= width/2; y -= height/2; break; } /* * Store the information in the item header. |
︙ | ︙ | |||
941 942 943 944 945 946 947 | case TK_ANCHOR_N: x -= width/2.0; y -= height; break; case TK_ANCHOR_NE: x -= width; y -= height; break; case TK_ANCHOR_E: x -= width; y -= height/2.0; break; case TK_ANCHOR_SE: x -= width; break; case TK_ANCHOR_S: x -= width/2.0; break; case TK_ANCHOR_SW: break; case TK_ANCHOR_W: y -= height/2.0; break; | | | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | case TK_ANCHOR_N: x -= width/2.0; y -= height; break; case TK_ANCHOR_NE: x -= width; y -= height; break; case TK_ANCHOR_E: x -= width; y -= height/2.0; break; case TK_ANCHOR_SE: x -= width; break; case TK_ANCHOR_S: x -= width/2.0; break; case TK_ANCHOR_SW: break; case TK_ANCHOR_W: y -= height/2.0; break; default: x -= width/2.0; y -= height/2.0; break; } /* * Make our working space. */ psObj = Tcl_NewObj(); |
︙ | ︙ |
Changes to generic/tkCanvImg.c.
1 2 3 4 5 | /* * tkCanvImg.c -- * * This file implements image items for canvas widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkCanvImg.c -- * * This file implements image items for canvas widgets. * * Copyright © 1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
70 71 72 73 74 75 76 | * Prototypes for functions defined in this file: */ static void ImageChangedProc(ClientData clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static int ImageCoords(Tcl_Interp *interp, | | | | | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | * Prototypes for functions defined in this file: */ static void ImageChangedProc(ClientData clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static int ImageCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static int ImageToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double ImageToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *coordPtr); static int ImageToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void ComputeImageBbox(Tk_Canvas canvas, ImageItem *imgPtr); static int ConfigureImage(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[], int flags); static int CreateImage(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static void DeleteImage(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayImage(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static void RotateImage(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); |
︙ | ︙ | |||
487 488 489 490 491 492 493 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; | | | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; default: x -= width/2; y -= height/2; break; } /* * Store the information in the item header. |
︙ | ︙ | |||
743 744 745 746 747 748 749 | case TK_ANCHOR_N: x -= width/2.0; y -= height; break; case TK_ANCHOR_NE: x -= width; y -= height; break; case TK_ANCHOR_E: x -= width; y -= height/2.0; break; case TK_ANCHOR_SE: x -= width; break; case TK_ANCHOR_S: x -= width/2.0; break; case TK_ANCHOR_SW: break; case TK_ANCHOR_W: y -= height/2.0; break; | | | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | case TK_ANCHOR_N: x -= width/2.0; y -= height; break; case TK_ANCHOR_NE: x -= width; y -= height; break; case TK_ANCHOR_E: x -= width; y -= height/2.0; break; case TK_ANCHOR_SE: x -= width; break; case TK_ANCHOR_S: x -= width/2.0; break; case TK_ANCHOR_SW: break; case TK_ANCHOR_W: y -= height/2.0; break; default: x -= width/2.0; y -= height/2.0; break; } if (!prepass) { Tcl_Obj *psObj = Tcl_GetObjResult(interp); if (Tcl_IsShared(psObj)) { psObj = Tcl_DuplicateObj(psObj); |
︙ | ︙ |
Changes to generic/tkCanvLine.c.
1 2 3 4 5 | /* * tkCanvLine.c -- * * This file implements line items for canvas widgets. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkCanvLine.c -- * * This file implements line items for canvas widgets. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
956 957 958 959 960 961 962 | Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Line item to be modified. */ TkSizeT beforeThis, /* Index before which new coordinates are to * be inserted. */ Tcl_Obj *obj) /* New coordinates to be inserted. */ { LineItem *linePtr = (LineItem *) itemPtr; | | > > > > > > > > | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Line item to be modified. */ TkSizeT beforeThis, /* Index before which new coordinates are to * be inserted. */ Tcl_Obj *obj) /* New coordinates to be inserted. */ { LineItem *linePtr = (LineItem *) itemPtr; int length, oriNumPoints, objc, nbInsPoints, i; double *newCoordPtr, *coordPtr; Tk_State state = itemPtr->state; Tcl_Obj **objv; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK) || !objc || objc&1) { return; } oriNumPoints = linePtr->numPoints; length = 2*linePtr->numPoints; nbInsPoints = objc / 2; if (beforeThis == TCL_INDEX_NONE) { beforeThis = 0; } if (beforeThis + 1 > (TkSizeT)length + 1) { beforeThis = length; } /* * With arrows, the end points of the line are adjusted so that a thick * line doesn't stick out past the arrowheads (see ConfigureArrows). */ if (linePtr->firstArrowPtr != NULL) { linePtr->coordPtr[0] = linePtr->firstArrowPtr[0]; linePtr->coordPtr[1] = linePtr->firstArrowPtr[1]; } if (linePtr->lastArrowPtr != NULL) { linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1]; |
︙ | ︙ | |||
997 998 999 1000 1001 1002 1003 | &newCoordPtr[i + beforeThis]) != TCL_OK) { Tcl_ResetResult(Canvas(canvas)->interp); ckfree(newCoordPtr); return; } } | | | > > < > | | > | | | | > > > > > | | | > > > > > | | | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | | 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 | &newCoordPtr[i + beforeThis]) != TCL_OK) { Tcl_ResetResult(Canvas(canvas)->interp); ckfree(newCoordPtr); return; } } for (i=(int)beforeThis; i<length; i++) { newCoordPtr[i+objc] = linePtr->coordPtr[i]; } if (linePtr->coordPtr) { ckfree(linePtr->coordPtr); } linePtr->coordPtr = newCoordPtr; length += objc ; linePtr->numPoints = length / 2; if ((length > 3) && (state != TK_STATE_HIDDEN)) { /* * This is some optimizing code that will result that only the part of * the line that changed (and the objects that are overlapping with * that part) need to be redrawn. A special flag is set that instructs * the general canvas code not to redraw the whole object. If this * flag is not set, the canvas will do the redrawing, otherwise I have * to do it here. * Rationale for the optimization code can be found in Tk ticket * [5fb8145997]. */ itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW; /* * Include one point at left of the left insert position, and one * point at right of the right insert position. */ beforeThis -= 2; objc += 4; if (linePtr->smooth) { if (!strcmp(linePtr->smooth->name, "true")) { /* * Quadratic Bezier splines. A second point must be included at * each side of the insert position. */ beforeThis -= 2; objc += 4; /* * Moreover, if the insert position is the first or last point * of the line, include a third point. */ if ((int)beforeThis == -4) { objc += 2; } if ((int)beforeThis + 4 == length - (objc - 8)) { beforeThis -= 2; objc += 2; } } else if (!strcmp(linePtr->smooth->name, "raw")) { /* * Cubic Bezier splines. See details in ticket [5fb8145997]. */ if (((oriNumPoints - 1) % 3) || (nbInsPoints % 3)) { /* * No optimization for "degenerate" lines or when inserting * something else than a multiple of 3 points. */ itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } else { beforeThis -= (int)beforeThis % 6; objc += 4; } } else { /* * Custom smoothing method. No optimization is possible. */ itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } } if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) { if ((int)beforeThis < 0) { beforeThis = 0; } if ((int)beforeThis + objc > length) { objc = length - (int)beforeThis; } itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[beforeThis]; itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[beforeThis+1]; if ((linePtr->firstArrowPtr != NULL) && ((int)beforeThis < 2)) { /* * Include old first arrow. */ for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkIncludePoint(itemPtr, coordPtr); } } if ((linePtr->lastArrowPtr != NULL) && ((int)beforeThis+objc >= length)) { /* * Include old last arrow. */ for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkIncludePoint(itemPtr, coordPtr); } } coordPtr = linePtr->coordPtr + beforeThis; for (i=0; i<objc; i+=2) { TkIncludePoint(itemPtr, coordPtr); coordPtr += 2; } } } if (linePtr->firstArrowPtr != NULL) { ckfree(linePtr->firstArrowPtr); linePtr->firstArrowPtr = NULL; } if (linePtr->lastArrowPtr != NULL) { ckfree(linePtr->lastArrowPtr); linePtr->lastArrowPtr = NULL; } if (linePtr->arrow != ARROWS_NONE) { ConfigureArrows(canvas, linePtr); } if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) { double width; int intWidth; if ((linePtr->firstArrowPtr != NULL) && ((int)beforeThis < 2)) { /* * Include new first arrow. */ for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkIncludePoint(itemPtr, coordPtr); } } if ((linePtr->lastArrowPtr != NULL) && ((int)beforeThis+objc >= length)) { /* * Include new last arrow. */ for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkIncludePoint(itemPtr, coordPtr); } } |
︙ | ︙ | |||
1149 1150 1151 1152 1153 1154 1155 | LineDeleteCoords( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Item in which to delete characters. */ TkSizeT first, /* Index of first character to delete. */ TkSizeT last) /* Index of last character to delete. */ { LineItem *linePtr = (LineItem *) itemPtr; | | > > | | > > > > > > > | > > > > > | > | > | > > > > > > > | | > > > > | | > > > | | | > > > > > > > > > > > > > > > | | | > > > > > > > > > > > > > > > | > > | | 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 | LineDeleteCoords( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Item in which to delete characters. */ TkSizeT first, /* Index of first character to delete. */ TkSizeT last) /* Index of last character to delete. */ { LineItem *linePtr = (LineItem *) itemPtr; int count, i, first1, last1, nbDelPoints; int oriNumPoints = linePtr->numPoints; int canOptimize = 1; int length = 2*linePtr->numPoints; double *coordPtr; Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } first &= -2; /* If odd, make it even. */ last &= -2; if ((int)first < 0) { first = 0; } if ((int)last >= length) { last = length - 2; } if ((int)first > (int)last) { return; } /* * With arrows, the end points of the line are adjusted so that a thick * line doesn't stick out past the arrowheads (see ConfigureArrows). */ if (linePtr->firstArrowPtr != NULL) { linePtr->coordPtr[0] = linePtr->firstArrowPtr[0]; linePtr->coordPtr[1] = linePtr->firstArrowPtr[1]; } if (linePtr->lastArrowPtr != NULL) { linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1]; } first1 = first; last1 = last; nbDelPoints = (last - first) / 2 + 1; /* * Include one point at left of the left delete position, and one * point at right of the right delete position. */ first1 -= 2; last1 += 2; if (linePtr->smooth) { if (!strcmp(linePtr->smooth->name, "true")) { /* * Quadratic Bezier splines. A second point must be included at * each side of the delete position. */ first1 -= 2; last1 += 2; /* * If the delete position is the first or last point of the line, * include a third point. */ if (first1 == -4) { last1 += 2; } if (last1 - 4 == length - 2) { first1 -= 2; } } else if (!strcmp(linePtr->smooth->name, "raw")) { /* * Cubic Bezier splines. See details in ticket [5fb8145997]. */ if (((oriNumPoints - 1) % 3) || (nbDelPoints % 3)) { /* * No optimization for "degenerate" lines or when deleting * something else than a multiple of 3 points. */ canOptimize = 0; } else { first1 -= first1 % 6; last1 = last + 6 - last % 6; } } else { /* * Custom smoothing method. No optimization is possible. */ canOptimize = 0; } } if (first1 < 0) { first1 = 0; } if (last1 >= length) { last1 = length - 2; } if (canOptimize && ((first1 >= 2) || (last1 < length-2))) { /* * This is some optimizing code that will result that only the part of * the line that changed (and the objects that are overlapping with * that part) need to be redrawn. A special flag is set that instructs * the general canvas code not to redraw the whole object. If this * flag is set, the redrawing has to be done here, otherwise the * general Canvas code will take care of it. * Rationale for the optimization code can be found in Tk ticket * [5fb8145997]. */ itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW; itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[first1]; itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[first1+1]; if ((linePtr->firstArrowPtr != NULL) && (first1 < 2)) { /* * Include old first arrow. */ for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkIncludePoint(itemPtr, coordPtr); } } if ((linePtr->lastArrowPtr != NULL) && (last1 >= length - 2)) { /* * Include old last arrow. */ for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkIncludePoint(itemPtr, coordPtr); |
︙ | ︙ | |||
1255 1256 1257 1258 1259 1260 1261 | if (linePtr->arrow != ARROWS_NONE) { ConfigureArrows(canvas, linePtr); } if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) { double width; int intWidth; | | | | | 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | if (linePtr->arrow != ARROWS_NONE) { ConfigureArrows(canvas, linePtr); } if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) { double width; int intWidth; if ((linePtr->firstArrowPtr != NULL) && (first1 < 2)) { /* * Include new first arrow. */ for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkIncludePoint(itemPtr, coordPtr); } } if ((linePtr->lastArrowPtr != NULL) && (last1 >= length - 2)) { /* * Include new last arrow. */ for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkIncludePoint(itemPtr, coordPtr); } } |
︙ | ︙ | |||
1744 1745 1746 1747 1748 1749 1750 | TkSizeT *indexPtr) /* Where to store converted index. */ { TkSizeT idx, length; LineItem *linePtr = (LineItem *) itemPtr; const char *string; (void)canvas; | | | | 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 | TkSizeT *indexPtr) /* Where to store converted index. */ { TkSizeT idx, length; LineItem *linePtr = (LineItem *) itemPtr; const char *string; (void)canvas; if (TCL_OK == TkGetIntForIndex(obj, 2*linePtr->numPoints - 1, 1, &idx)) { if (idx == TCL_INDEX_NONE) { idx = 0; } else if (idx > (2*(TkSizeT)linePtr->numPoints)) { idx = 2*linePtr->numPoints; } else { idx &= (TkSizeT)-2; /* If index is odd, make it even. */ } *indexPtr = idx; return TCL_OK; } string = Tcl_GetStringFromObj(obj, &length); if (string[0] == '@') { int i; double x, y, bestDist, dist, *coordPtr; char *end; const char *p; |
︙ | ︙ | |||
1932 1933 1934 1935 1936 1937 1938 | char *recordPtr, /* Pointer to item record in which to store * arrow information. */ TkSizeT offset) /* Offset of shape information in widget * record. */ { LineItem *linePtr = (LineItem *) recordPtr; double a, b, c; | | | 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 | char *recordPtr, /* Pointer to item record in which to store * arrow information. */ TkSizeT offset) /* Offset of shape information in widget * record. */ { LineItem *linePtr = (LineItem *) recordPtr; double a, b, c; TkSizeT argc; const char **argv = NULL; if ((size_t)offset != offsetof(LineItem, arrowShapeA)) { Tcl_Panic("ParseArrowShape received bogus offset"); } if (Tcl_SplitList(interp, (char *) value, &argc, &argv) != TCL_OK) { |
︙ | ︙ |
Changes to generic/tkCanvPoly.c.
1 2 3 4 5 | /* * tkCanvPoly.c -- * * This file implements polygon items for canvas widgets. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkCanvPoly.c -- * * This file implements polygon items for canvas widgets. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1998-2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 | Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Line item to be modified. */ TkSizeT beforeThis, /* Index before which new coordinates are to * be inserted. */ Tcl_Obj *obj) /* New coordinates to be inserted. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; | | > > | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Line item to be modified. */ TkSizeT beforeThis, /* Index before which new coordinates are to * be inserted. */ Tcl_Obj *obj) /* New coordinates to be inserted. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int length, oriNumPoints, objc, nbInsPoints, i; Tcl_Obj **objv; double *newCoordPtr; Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK) || !objc || objc&1) { return; } oriNumPoints = polyPtr->numPoints - polyPtr->autoClosed; length = 2*(polyPtr->numPoints - polyPtr->autoClosed); nbInsPoints = objc / 2; while ((int)beforeThis > length) { beforeThis -= length; } while ((int)beforeThis < 0) { beforeThis += length; } newCoordPtr = (double *)ckalloc(sizeof(double) * (length + 2 + objc)); |
︙ | ︙ | |||
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 | /* * This is some optimizing code that will result that only the part of * the polygon that changed (and the objects that are overlapping with * that part) need to be redrawn. A special flag is set that instructs * the general canvas code not to redraw the whole object. If this * flag is not set, the canvas will do the redrawing, otherwise I have * to do it here. */ double width; int j; itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW; /* * The header elements that normally are used for the bounding box, * are now used to calculate the bounding box for only the part that * has to be redrawn. That doesn't matter, because afterwards the * bounding box has to be re-calculated anyway. */ itemPtr->x1 = itemPtr->x2 = (int) polyPtr->coordPtr[beforeThis]; itemPtr->y1 = itemPtr->y2 = (int) polyPtr->coordPtr[beforeThis+1]; beforeThis -= 2; objc += 4; if (polyPtr->smooth) { | > > > > > > > > > | | | > > > > > | > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 | /* * This is some optimizing code that will result that only the part of * the polygon that changed (and the objects that are overlapping with * that part) need to be redrawn. A special flag is set that instructs * the general canvas code not to redraw the whole object. If this * flag is not set, the canvas will do the redrawing, otherwise I have * to do it here. * Rationale for the optimization code can be found in Tk ticket * [5fb8145997]. */ double width; int j; itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW; /* * The header elements that normally are used for the bounding box, * are now used to calculate the bounding box for only the part that * has to be redrawn. That doesn't matter, because afterwards the * bounding box has to be re-calculated anyway. */ itemPtr->x1 = itemPtr->x2 = (int) polyPtr->coordPtr[beforeThis]; itemPtr->y1 = itemPtr->y2 = (int) polyPtr->coordPtr[beforeThis+1]; beforeThis -= 2; objc += 4; if (polyPtr->smooth) { if (!strcmp(polyPtr->smooth->name, "true")) { /* * Quadratic Bezier splines. */ beforeThis -= 2; objc += 4; } else if (!strcmp(polyPtr->smooth->name, "raw")) { /* * Cubic Bezier splines. */ if ((oriNumPoints % 3) || (nbInsPoints % 3)) { /* * No optimization for "degenerate" polygons or when inserting * something else than a multiple of 3 points. */ itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } else { beforeThis -= abs((int)beforeThis) % 6; objc += 4; } } else { /* * Custom smoothing method. No optimization is possible. */ itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } } if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) { /* * Be careful; beforeThis could now be negative */ for (i=(int)beforeThis; i<(int)beforeThis+objc; i+=2) { j = i; if (j < 0) { j += length; } else if (j >= length) { j -= length; } TkIncludePoint(itemPtr, polyPtr->coordPtr+j); } width = polyPtr->outline.width; if (Canvas(canvas)->currentItemPtr == itemPtr) { if (polyPtr->outline.activeWidth > width) { width = polyPtr->outline.activeWidth; } } else if (state == TK_STATE_DISABLED) { if (polyPtr->outline.disabledWidth > 0.0) { width = polyPtr->outline.disabledWidth; } } itemPtr->x1 -= (int) width; itemPtr->y1 -= (int) width; itemPtr->x2 += (int) width; itemPtr->y2 += (int) width; Tk_CanvasEventuallyRedraw(canvas, itemPtr->x1, itemPtr->y1, itemPtr->x2, itemPtr->y2); } } ComputePolygonBbox(canvas, polyPtr); } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 | PolygonItem *polyPtr = (PolygonItem *) itemPtr; const char *string; TkSizeT count = 2*(polyPtr->numPoints - polyPtr->autoClosed); if (TCL_OK == TkGetIntForIndex(obj, (INT_MAX - 1) - ((INT_MAX) % count), 1, &idx)) { if (idx == TCL_INDEX_NONE) { idx = 0; } else { idx = (idx & (TkSizeT)-2) % count; } *indexPtr = idx; return TCL_OK; } | > > | | 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 | PolygonItem *polyPtr = (PolygonItem *) itemPtr; const char *string; TkSizeT count = 2*(polyPtr->numPoints - polyPtr->autoClosed); if (TCL_OK == TkGetIntForIndex(obj, (INT_MAX - 1) - ((INT_MAX) % count), 1, &idx)) { if (idx == TCL_INDEX_NONE) { idx = 0; } else if (idx >= INT_MAX - ((INT_MAX) % count)) { idx = count; } else { idx = (idx & (TkSizeT)-2) % count; } *indexPtr = idx; return TCL_OK; } string = Tcl_GetStringFromObj(obj, &length); if (string[0] == '@') { int i; double x, y, bestDist, dist, *coordPtr; char *end; const char *p; |
︙ | ︙ |
Changes to generic/tkCanvPs.c.
1 2 3 4 5 6 7 | /* * tkCanvPs.c -- * * This module provides Postscript output support for canvases, including * the "postscript" widget command plus a few utility functions used for * generating Postscript. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkCanvPs.c -- * * This module provides Postscript output support for canvases, including * the "postscript" widget command plus a few utility functions used for * generating Postscript. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
281 282 283 284 285 286 287 | } switch (psInfo.pageAnchor) { case TK_ANCHOR_NW: case TK_ANCHOR_W: case TK_ANCHOR_SW: deltaX = 0; break; | < < < < < > > > < < < < < > > > | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | } switch (psInfo.pageAnchor) { case TK_ANCHOR_NW: case TK_ANCHOR_W: case TK_ANCHOR_SW: deltaX = 0; break; case TK_ANCHOR_NE: case TK_ANCHOR_E: case TK_ANCHOR_SE: deltaX = -psInfo.width; break; default: deltaX = -psInfo.width/2; break; } switch (psInfo.pageAnchor) { case TK_ANCHOR_NW: case TK_ANCHOR_N: case TK_ANCHOR_NE: deltaY = - psInfo.height; break; case TK_ANCHOR_SW: case TK_ANCHOR_S: case TK_ANCHOR_SE: deltaY = 0; break; default: deltaY = -psInfo.height/2; break; } if (psInfo.colorMode == NULL) { psInfo.colorLevel = 2; } else { length = strlen(psInfo.colorMode); if (strncmp(psInfo.colorMode, "monochrome", length) == 0) { |
︙ | ︙ | |||
899 900 901 902 903 904 905 906 907 908 909 910 911 912 | XGetGeometry(Tk_Display(tkwin), bitmap, &dummyRoot, (int *) &dummyX, (int *) &dummyY, (unsigned int *) &totalWidth, (unsigned int *) &totalHeight, &dummyBorderwidth, &dummyDepth); imagePtr = XGetImage(Tk_Display(tkwin), bitmap, 0, 0, totalWidth, totalHeight, 1, XYPixmap); Tcl_AppendToObj(psObj, "<", -1); mask = 0x80; value = 0; charsInLine = 0; lastX = startX + width - 1; lastY = startY + height - 1; for (y = lastY; y >= startY; y--) { | > > > > > > > > > > > > | 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | XGetGeometry(Tk_Display(tkwin), bitmap, &dummyRoot, (int *) &dummyX, (int *) &dummyY, (unsigned int *) &totalWidth, (unsigned int *) &totalHeight, &dummyBorderwidth, &dummyDepth); imagePtr = XGetImage(Tk_Display(tkwin), bitmap, 0, 0, totalWidth, totalHeight, 1, XYPixmap); if (!imagePtr) { /* * The XGetImage() function is apparently not implemented on this * system. Just skip the pixels, the Postscript will still be * syntactically correct. */ Tcl_AppendToObj(psObj, "<>", -1); return; } Tcl_AppendToObj(psObj, "<", -1); mask = 0x80; value = 0; charsInLine = 0; lastX = startX + width - 1; lastY = startY + height - 1; for (y = lastY; y >= startY; y--) { |
︙ | ︙ |
Changes to generic/tkCanvText.c.
1 2 3 4 5 | /* * tkCanvText.c -- * * This file implements text items for canvas widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkCanvText.c -- * * This file implements text items for canvas widgets. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
49 50 51 52 53 54 55 | Pixmap stipple; /* Stipple bitmap for text, or None. */ Pixmap activeStipple; /* Stipple bitmap for text, or None. */ Pixmap disabledStipple; /* Stipple bitmap for text, or None. */ char *text; /* Text for item (malloc-ed). */ int width; /* Width of lines for word-wrap, pixels. Zero * means no word-wrap. */ int underline; /* Index of character to put underline beneath | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | Pixmap stipple; /* Stipple bitmap for text, or None. */ Pixmap activeStipple; /* Stipple bitmap for text, or None. */ Pixmap disabledStipple; /* Stipple bitmap for text, or None. */ char *text; /* Text for item (malloc-ed). */ int width; /* Width of lines for word-wrap, pixels. Zero * means no word-wrap. */ int underline; /* Index of character to put underline beneath * or INT_MIN for no underlining. */ double angle; /* What angle, in degrees, to draw the text * at. */ /* * Fields whose values are derived from the current values of the * configuration settings above. */ |
︙ | ︙ | |||
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | }; static const Tk_CustomOption tagsOption = { TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE) }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activefill", NULL, NULL, NULL, offsetof(TextItem, activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, NULL, offsetof(TextItem, activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | }; static const Tk_CustomOption tagsOption = { TkCanvasTagsParseProc, TkCanvasTagsPrintProc, NULL }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE) }; static int UnderlineParseProc( ClientData dummy, /* Not used.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ TkSizeT offset) /* Offset into item (ignored). */ { int *underlinePtr = (int *) (widgRec + offset); Tcl_Obj obj; int code; TkSizeT underline; (void)dummy; (void)tkwin; if (value == NULL || *value == 0) { *underlinePtr = INT_MIN; /* No underline */ return TCL_OK; } obj.refCount = 1; obj.bytes = (char *)value; obj.length = strlen(value); obj.typePtr = NULL; code = TkGetIntForIndex(&obj, TCL_INDEX_END, 0, &underline); if (code == TCL_OK) { if (underline == TCL_INDEX_NONE) { underline = INT_MIN; } else if ((size_t)underline > (size_t)TCL_INDEX_END>>1) { underline++; } else if (underline >= INT_MAX) { underline = INT_MAX; } *underlinePtr = underline; } else { Tcl_AppendResult(interp, "bad index \"", value, "\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", NULL); } return code; } const char * UnderlinePrintProc( ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ TkSizeT offset, /* Pointer to record for item. */ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { int underline = *(int *)(widgRec + offset); char *p; (void)dummy; (void)tkwin; if (underline == INT_MIN) { #if !defined(TK_NO_DEPRECATED) && TK_MAJOR_VERSION < 9 p = (char *)"-1"; #else p = (char *)""; #endif *freeProcPtr = TCL_STATIC; return p; } else if (underline == INT_MAX) { p = (char *)"end+1"; *freeProcPtr = TCL_STATIC; return p; } else if (underline == -1) { p = (char *)"end"; *freeProcPtr = TCL_STATIC; return p; } p = (char *)ckalloc(32); if (underline < 0) { sprintf(p, "end%d", underline); } else { sprintf(p, "%d", underline); } *freeProcPtr = TCL_DYNAMIC; return p; } static const Tk_CustomOption underlineOption = { UnderlineParseProc, UnderlinePrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activefill", NULL, NULL, NULL, offsetof(TextItem, activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, NULL, offsetof(TextItem, activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, |
︙ | ︙ | |||
119 120 121 122 123 124 125 | NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, NULL, offsetof(TextItem, stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_STRING, "-text", NULL, NULL, "", offsetof(TextItem, text), 0, NULL}, | | | | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, NULL, offsetof(TextItem, stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_STRING, "-text", NULL, NULL, "", offsetof(TextItem, text), 0, NULL}, {TK_CONFIG_CUSTOM, "-underline", NULL, NULL, NULL, offsetof(TextItem, underline), TK_CONFIG_NULL_OK, &underlineOption}, {TK_CONFIG_PIXELS, "-width", NULL, NULL, "0", offsetof(TextItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: */ static void ComputeTextBbox(Tk_Canvas canvas, TextItem *textPtr); static int ConfigureText(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, Tcl_Obj *const objv[], int flags); static int CreateText(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static void DeleteText(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayCanvText(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static TkSizeT GetSelText(Tk_Canvas canvas, Tk_Item *itemPtr, TkSizeT offset, char *buffer, TkSizeT maxBytes); static int GetTextIndex(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Obj *obj, TkSizeT *indexPtr); static void ScaleText(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void SetTextCursor(Tk_Canvas canvas, Tk_Item *itemPtr, TkSizeT index); static int TextCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static void TextDeleteChars(Tk_Canvas canvas, Tk_Item *itemPtr, TkSizeT first, TkSizeT last); static void TextInsert(Tk_Canvas canvas, Tk_Item *itemPtr, TkSizeT beforeThis, Tcl_Obj *obj); static int TextToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double TextToPoint(Tk_Canvas canvas, |
︙ | ︙ | |||
260 261 262 263 264 265 266 | textPtr->tkfont = NULL; textPtr->justify = TK_JUSTIFY_LEFT; textPtr->stipple = None; textPtr->activeStipple = None; textPtr->disabledStipple = None; textPtr->text = NULL; textPtr->width = 0; | | | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | textPtr->tkfont = NULL; textPtr->justify = TK_JUSTIFY_LEFT; textPtr->stipple = None; textPtr->activeStipple = None; textPtr->disabledStipple = None; textPtr->text = NULL; textPtr->width = 0; textPtr->underline = INT_MIN; textPtr->angle = 0.0; textPtr->numChars = 0; textPtr->numBytes = 0; textPtr->textLayout = NULL; textPtr->actualWidth = 0; textPtr->drawOrigin[0] = textPtr->drawOrigin[1] = 0.0; |
︙ | ︙ | |||
561 562 563 564 565 566 567 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteText( | | < | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteText( TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { TextItem *textPtr = (TextItem *) itemPtr; if (textPtr->color != NULL) { Tk_FreeColor(textPtr->color); } if (textPtr->activeColor != NULL) { Tk_FreeColor(textPtr->activeColor); } |
︙ | ︙ | |||
629 630 631 632 633 634 635 | static void ComputeTextBbox( Tk_Canvas canvas, /* Canvas that contains item. */ TextItem *textPtr) /* Item whose bbox is to be recomputed. */ { Tk_CanvasTextInfo *textInfoPtr; | | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | static void ComputeTextBbox( Tk_Canvas canvas, /* Canvas that contains item. */ TextItem *textPtr) /* Item whose bbox is to be recomputed. */ { Tk_CanvasTextInfo *textInfoPtr; int width, height, fudge, i; Tk_State state = textPtr->header.state; double x[4], y[4], dx[4], dy[4], sinA, cosA, tmp; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } |
︙ | ︙ | |||
651 652 653 654 655 656 657 | } /* * Use overall geometry information to compute the top-left corner of the * bounding box for the text item. */ | < < | | | < | | < < < | | | | < | < < < | | | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | } /* * Use overall geometry information to compute the top-left corner of the * bounding box for the text item. */ for (i=0 ; i<4 ; i++) { dx[i] = dy[i] = 0.0; } switch (textPtr->anchor) { case TK_ANCHOR_NW: case TK_ANCHOR_N: case TK_ANCHOR_NE: break; case TK_ANCHOR_SW: case TK_ANCHOR_S: case TK_ANCHOR_SE: for (i=0 ; i<4 ; i++) { dy[i] = -height; } break; default: for (i=0 ; i<4 ; i++) { dy[i] = -height / 2; } break; } switch (textPtr->anchor) { case TK_ANCHOR_NW: case TK_ANCHOR_W: case TK_ANCHOR_SW: break; case TK_ANCHOR_NE: case TK_ANCHOR_E: case TK_ANCHOR_SE: for (i=0 ; i<4 ; i++) { dx[i] = -width; } break; default: for (i=0 ; i<4 ; i++) { dx[i] = -width / 2; } break; } textPtr->actualWidth = width; sinA = textPtr->sine; |
︙ | ︙ | |||
1016 1017 1018 1019 1020 1021 1022 | TextItem *textPtr = (TextItem *) itemPtr; int byteIndex, charsAdded; TkSizeT byteCount; char *newStr, *text; const char *string; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; | | | 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 | TextItem *textPtr = (TextItem *) itemPtr; int byteIndex, charsAdded; TkSizeT byteCount; char *newStr, *text; const char *string; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; string = Tcl_GetStringFromObj(obj, &byteCount); text = textPtr->text; if (index == TCL_INDEX_NONE) { index = 0; } if (index + 1 > textPtr->numChars + 1) { |
︙ | ︙ | |||
1395 1396 1397 1398 1399 1400 1401 | } else if (idx > textPtr->numChars) { idx = textPtr->numChars; } *indexPtr = idx; return TCL_OK; } | | | 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 | } else if (idx > textPtr->numChars) { idx = textPtr->numChars; } *indexPtr = idx; return TCL_OK; } string = Tcl_GetStringFromObj(obj, &length); c = string[0]; if ((c == 'i') && (strncmp(string, "insert", length) == 0)) { *indexPtr = textPtr->insertPos; } else if ((c == 's') && (length >= 5) && (strncmp(string, "sel.first", length) == 0)) { |
︙ | ︙ | |||
1641 1642 1643 1644 1645 1646 1647 | if (stipple != None) { Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendPrintfToObj(psObj, "/StippleText {\n %s} bind def\n", Tcl_GetString(Tcl_GetObjResult(interp))); } | < | < > | 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 | if (stipple != None) { Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendPrintfToObj(psObj, "/StippleText {\n %s} bind def\n", Tcl_GetString(Tcl_GetObjResult(interp))); } switch (textPtr->anchor) { case TK_ANCHOR_NW: x = 0; y = 0; break; case TK_ANCHOR_N: x = 1; y = 0; break; case TK_ANCHOR_NE: x = 2; y = 0; break; case TK_ANCHOR_E: x = 2; y = 1; break; case TK_ANCHOR_SE: x = 2; y = 2; break; case TK_ANCHOR_S: x = 1; y = 2; break; case TK_ANCHOR_SW: x = 0; y = 2; break; case TK_ANCHOR_W: x = 0; y = 1; break; default: x = 1; y = 1; break; } switch (textPtr->justify) { case TK_JUSTIFY_CENTER: justify = "0.5"; break; case TK_JUSTIFY_RIGHT: justify = "1"; break; default: justify = "0"; break; } Tk_GetFontMetrics(textPtr->tkfont, &fm); Tcl_AppendPrintfToObj(psObj, "%.15g %.15g %.15g [\n", textPtr->angle, textPtr->x, Tk_CanvasPsY(canvas, textPtr->y)); Tcl_ResetResult(interp); |
︙ | ︙ |
Changes to generic/tkCanvUtil.c.
1 2 3 4 5 6 | /* * tkCanvUtil.c -- * * This file contains a collection of utility functions used by the * implementations of various canvas item types. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkCanvUtil.c -- * * This file contains a collection of utility functions used by the * implementations of various canvas item types. * * Copyright © 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
407 408 409 410 411 412 413 | Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option (list of tag names). */ char *widgRec, /* Pointer to record for item. */ TkSizeT offset) /* Offset into item (ignored). */ { Tk_Item *itemPtr = (Tk_Item *) widgRec; | | | | | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option (list of tag names). */ char *widgRec, /* Pointer to record for item. */ TkSizeT offset) /* Offset into item (ignored). */ { Tk_Item *itemPtr = (Tk_Item *) widgRec; TkSizeT argc, i; const char **argv; Tk_Uid *newPtr; (void)dummy; (void)tkwin; (void)offset; /* * Break the value up into the individual tag names. */ if (Tcl_SplitList(interp, value, &argc, &argv) != TCL_OK) { return TCL_ERROR; } /* * Make sure that there's enough space in the item to hold the tag names. */ if (itemPtr->tagSpace < argc) { newPtr = (Tk_Uid *)ckalloc(argc * sizeof(Tk_Uid)); for (i = itemPtr->numTags - 1; i != TCL_INDEX_NONE; i--) { newPtr[i] = itemPtr->tagPtr[i]; } if (itemPtr->tagPtr != itemPtr->staticTagSpace) { ckfree(itemPtr->tagPtr); } itemPtr->tagPtr = newPtr; itemPtr->tagSpace = argc; |
︙ | ︙ | |||
770 771 772 773 774 775 776 | */ if (methods == NULL) { methods = InitSmoothMethods(interp); } /* | | | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | */ if (methods == NULL) { methods = InitSmoothMethods(interp); } /* * Backward compatibility hack. */ if (strncmp(value, "bezier", length) == 0) { smooth = &tkBezierSmoothMethod; } /* |
︙ | ︙ |
Changes to generic/tkCanvWind.c.
1 2 3 4 5 | /* * tkCanvWind.c -- * * This file implements window items for canvas widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkCanvWind.c -- * * This file implements window items for canvas widgets. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
514 515 516 517 518 519 520 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; | | | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; default: x -= width/2; y -= height/2; break; } /* * Store the information in the item header. |
︙ | ︙ | |||
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | (void)regionY; (void)regionWidth; (void)regionHeight; if (winItemPtr->tkwin == NULL) { return; } if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } /* * A drawable of None is used by the canvas UnmapNotify handler * to indicate that we should no longer display ourselves. */ if (state == TK_STATE_HIDDEN || drawable == None) { if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) { Tk_UnmapWindow(winItemPtr->tkwin); } else { Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin); } return; } Tk_CanvasWindowCoords(canvas, (double) winItemPtr->header.x1, (double) winItemPtr->header.y1, &x, &y); width = winItemPtr->header.x2 - winItemPtr->header.x1; height = winItemPtr->header.y2 - winItemPtr->header.y1; | > > > > | 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | (void)regionY; (void)regionWidth; (void)regionHeight; if (winItemPtr->tkwin == NULL) { return; } Tcl_Preserve(canvas); if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } /* * A drawable of None is used by the canvas UnmapNotify handler * to indicate that we should no longer display ourselves. */ if (state == TK_STATE_HIDDEN || drawable == None) { if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) { Tk_UnmapWindow(winItemPtr->tkwin); } else { Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin); } Tcl_Release(canvas); return; } Tk_CanvasWindowCoords(canvas, (double) winItemPtr->header.x1, (double) winItemPtr->header.y1, &x, &y); width = winItemPtr->header.x2 - winItemPtr->header.x1; height = winItemPtr->header.y2 - winItemPtr->header.y1; |
︙ | ︙ | |||
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | if (((x + width) <= 0) || ((y + height) <= 0) || (x >= Tk_Width(canvasTkwin)) || (y >= Tk_Height(canvasTkwin))) { if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) { Tk_UnmapWindow(winItemPtr->tkwin); } else { Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin); } return; } /* * Reposition and map the window (but in different ways depending on * whether the canvas is the window's parent). */ if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) { if ((x != Tk_X(winItemPtr->tkwin)) || (y != Tk_Y(winItemPtr->tkwin)) || (width != Tk_Width(winItemPtr->tkwin)) || (height != Tk_Height(winItemPtr->tkwin))) { Tk_MoveResizeWindow(winItemPtr->tkwin, x, y, width, height); } | > > > | > > > | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | if (((x + width) <= 0) || ((y + height) <= 0) || (x >= Tk_Width(canvasTkwin)) || (y >= Tk_Height(canvasTkwin))) { if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) { Tk_UnmapWindow(winItemPtr->tkwin); } else { Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin); } Tcl_Release(canvas); return; } /* * Reposition and map the window (but in different ways depending on * whether the canvas is the window's parent). */ if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) { if ((x != Tk_X(winItemPtr->tkwin)) || (y != Tk_Y(winItemPtr->tkwin)) || (width != Tk_Width(winItemPtr->tkwin)) || (height != Tk_Height(winItemPtr->tkwin))) { Tk_MoveResizeWindow(winItemPtr->tkwin, x, y, width, height); } if (winItemPtr->tkwin) { Tk_MapWindow(winItemPtr->tkwin); } } else { Tk_MaintainGeometry(winItemPtr->tkwin, canvasTkwin, x, y, width, height); } Tcl_Release(canvas); } /* *-------------------------------------------------------------- * * WinItemToPoint -- * |
︙ | ︙ | |||
822 823 824 825 826 827 828 | case TK_ANCHOR_N: x -= width/2.0; y -= height; break; case TK_ANCHOR_NE: x -= width; y -= height; break; case TK_ANCHOR_E: x -= width; y -= height/2.0; break; case TK_ANCHOR_SE: x -= width; break; case TK_ANCHOR_S: x -= width/2.0; break; case TK_ANCHOR_SW: break; case TK_ANCHOR_W: y -= height/2.0; break; | | | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | case TK_ANCHOR_N: x -= width/2.0; y -= height; break; case TK_ANCHOR_NE: x -= width; y -= height; break; case TK_ANCHOR_E: x -= width; y -= height/2.0; break; case TK_ANCHOR_SE: x -= width; break; case TK_ANCHOR_S: x -= width/2.0; break; case TK_ANCHOR_SW: break; case TK_ANCHOR_W: y -= height/2.0; break; default: x -= width/2.0; y -= height/2.0; break; } return CanvasPsWindow(interp, tkwin, canvas, x, y, width, height); } static int CanvasPsWindow( |
︙ | ︙ |
Changes to generic/tkCanvas.c.
1 2 3 4 5 6 7 | /* * tkCanvas.c -- * * This module implements canvas widgets for the Tk toolkit. A canvas * displays a background and a collection of graphical objects such as * rectangles, lines, and texts. * | | | | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * tkCanvas.c -- * * This module implements canvas widgets for the Tk toolkit. A canvas * displays a background and a collection of graphical objects such as * rectangles, lines, and texts. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" #include "default.h" #include "tkPort.h" #ifdef MAC_OSX_TK #include "tkMacOSXInt.h" #endif /* * See tkCanvas.h for key data structures used to implement canvases. */ /* * The structure defined below is used to keep track of a tag search in |
︙ | ︙ | |||
212 213 214 215 216 217 218 | static Tcl_ThreadDataKey dataKey; static SearchUids * GetStaticUids(void); /* * Prototypes for functions defined later in this file: */ | | | | | | | | | | | | | | | | | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | static Tcl_ThreadDataKey dataKey; static SearchUids * GetStaticUids(void); /* * Prototypes for functions defined later in this file: */ static void CanvasBindProc(void *clientData, XEvent *eventPtr); static void CanvasBlinkProc(void *clientData); static void CanvasCmdDeletedProc(void *clientData); static void CanvasDoEvent(TkCanvas *canvasPtr, XEvent *eventPtr); static void CanvasEventProc(void *clientData, XEvent *eventPtr); static TkSizeT CanvasFetchSelection(void *clientData, TkSizeT offset, char *buffer, TkSizeT maxBytes); static Tk_Item * CanvasFindClosest(TkCanvas *canvasPtr, double coords[2]); static void CanvasFocusProc(TkCanvas *canvasPtr, int gotFocus); static void CanvasLostSelection(void *clientData); static void CanvasSelectTo(TkCanvas *canvasPtr, Tk_Item *itemPtr, TkSizeT index); static void CanvasSetOrigin(TkCanvas *canvasPtr, int xOrigin, int yOrigin); static void CanvasUpdateScrollbars(TkCanvas *canvasPtr); static int CanvasWidgetCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); static void CanvasWorldChanged(void *instanceData); static int ConfigureCanvas(Tcl_Interp *interp, TkCanvas *canvasPtr, int objc, Tcl_Obj *const *objv, int flags); static void DefaultRotateImplementation(TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians); static void DestroyCanvas(void *memPtr); static int DrawCanvas(Tcl_Interp *interp, void *clientData, Tk_PhotoHandle photohandle, int subsample, int zoom); static void DisplayCanvas(void *clientData); static void DoItem(Tcl_Obj *accumObj, Tk_Item *itemPtr, Tk_Uid tag); static void EventuallyRedrawItem(TkCanvas *canvasPtr, Tk_Item *itemPtr); static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, int objc, Tcl_Obj *const *objv, Tcl_Obj *newTagObj, int first, TagSearch **searchPtrPtr); static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr, Tcl_Obj *const *objv, Tk_Uid uid, int enclosed); static double GridAlign(double coord, double spacing); static const char** TkGetStringsFromObjs(int objc, Tcl_Obj *const *objv); static void InitCanvas(void); static void PickCurrentItem(TkCanvas *canvasPtr, XEvent *eventPtr); static Tcl_Obj * ScrollFractions(int screen1, int screen2, int object1, int object2); static int RelinkItems(TkCanvas *canvasPtr, Tcl_Obj *tag, Tk_Item *prevPtr, TagSearch **searchPtrPtr); static void TagSearchExprInit(TagSearchExpr **exprPtrPtr); |
︙ | ︙ | |||
595 596 597 598 599 600 601 | DefaultRotateImplementation( TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians) { | > | | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | DefaultRotateImplementation( TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians) { TkSizeT i, objc; int ok = 1; Tcl_Obj **objv, **newObjv; double *coordv; double s = sin(angleRadians); double c = cos(angleRadians); Tcl_Interp *interp = canvasPtr->interp; /* |
︙ | ︙ | |||
675 676 677 678 679 680 681 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_CanvasObjCmd( | | | | | | | | 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_CanvasObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; TkCanvas *canvasPtr; Tk_Window newWin; if (typeList == NULL) { InitCanvas(); } if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } newWin = Tk_CreateWindowFromPath(interp,tkwin,Tcl_GetString(objv[1]),NULL); if (newWin == NULL) { return TCL_ERROR; } /* * Initialize fields that won't be initialized by ConfigureCanvas, or * which ConfigureCanvas expects to have reasonable values (e.g. resource |
︙ | ︙ | |||
791 792 793 794 795 796 797 | CanvasEventProc, canvasPtr); Tk_CreateEventHandler(canvasPtr->tkwin, KeyPressMask|KeyReleaseMask |ButtonPressMask|ButtonReleaseMask|EnterWindowMask |LeaveWindowMask|PointerMotionMask|VirtualEventMask, CanvasBindProc, canvasPtr); Tk_CreateSelHandler(canvasPtr->tkwin, XA_PRIMARY, XA_STRING, CanvasFetchSelection, canvasPtr, XA_STRING); | | | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | CanvasEventProc, canvasPtr); Tk_CreateEventHandler(canvasPtr->tkwin, KeyPressMask|KeyReleaseMask |ButtonPressMask|ButtonReleaseMask|EnterWindowMask |LeaveWindowMask|PointerMotionMask|VirtualEventMask, CanvasBindProc, canvasPtr); Tk_CreateSelHandler(canvasPtr->tkwin, XA_PRIMARY, XA_STRING, CanvasFetchSelection, canvasPtr, XA_STRING); if (ConfigureCanvas(interp, canvasPtr, objc-2, objv+2, 0) != TCL_OK) { goto error; } Tcl_SetObjResult(interp, Tk_NewWindowObj(canvasPtr->tkwin)); return TCL_OK; error: |
︙ | ︙ | |||
823 824 825 826 827 828 829 | * See the user documentation. * *-------------------------------------------------------------- */ static int CanvasWidgetCmd( | | | 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | * See the user documentation. * *-------------------------------------------------------------- */ static int CanvasWidgetCmd( void *clientData, /* Information about canvas widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent |
︙ | ︙ | |||
1253 1254 1255 1256 1257 1258 1259 | TkSizeT length; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg ...?"); result = TCL_ERROR; goto done; } | | | 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | TkSizeT length; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg ...?"); result = TCL_ERROR; goto done; } arg = Tcl_GetStringFromObj(objv[2], &length); c = arg[0]; /* * Lock because the list of types is a global resource that could be * updated by another thread. That's fairly unlikely, but not * impossible. */ |
︙ | ︙ | |||
1438 1439 1440 1441 1442 1443 1444 | } } } break; } case CANV_DTAG: { Tk_Uid tag; | | | | 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 | } } } break; } case CANV_DTAG: { Tk_Uid tag; TkSizeT i; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?tagToDelete?"); result = TCL_ERROR; goto done; } if (objc == 4) { tag = Tk_GetUid(Tcl_GetString(objv[3])); } else { tag = Tk_GetUid(Tcl_GetString(objv[2])); } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { for (i = itemPtr->numTags-1; i != TCL_INDEX_NONE; i--) { if (itemPtr->tagPtr[i] == tag) { /* * Don't shuffle the tags sequence: memmove the tags. */ memmove((void *)(itemPtr->tagPtr + i), |
︙ | ︙ | |||
1914 1915 1916 1917 1918 1919 1920 | canvasPtr->flags |= REPICK_NEEDED; } break; } case CANV_SCAN: { int x, y, gain = 10; static const char *const optionStrings[] = { | | | | | | 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 | canvasPtr->flags |= REPICK_NEEDED; } break; } case CANV_SCAN: { int x, y, gain = 10; static const char *const optionStrings[] = { "dragto", "mark", NULL }; if (objc < 5) { Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x y ?dragGain?"); result = TCL_ERROR; } else if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings, "scan option", 0, &idx) != TCL_OK) { result = TCL_ERROR; } else if ((objc != 5) && (objc + idx != 6)) { Tcl_WrongNumArgs(interp, 3, objv, idx?"x y":"x y ?gain?"); result = TCL_ERROR; } else if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){ result = TCL_ERROR; } else if ((objc == 6) && (Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) { result = TCL_ERROR; } else if (idx) { canvasPtr->scanX = x; canvasPtr->scanXOrigin = canvasPtr->xOrigin; canvasPtr->scanY = y; canvasPtr->scanYOrigin = canvasPtr->yOrigin; } else { int newXOrigin, newYOrigin, tmp; |
︙ | ︙ | |||
2379 2380 2381 2382 2383 2384 2385 | */ canvasPtr->scrollX1 = 0; canvasPtr->scrollY1 = 0; canvasPtr->scrollX2 = 0; canvasPtr->scrollY2 = 0; if (canvasPtr->regionString != NULL) { | | | 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 | */ canvasPtr->scrollX1 = 0; canvasPtr->scrollY1 = 0; canvasPtr->scrollX2 = 0; canvasPtr->scrollY2 = 0; if (canvasPtr->regionString != NULL) { TkSizeT argc2; const char **argv2; if (Tcl_SplitList(canvasPtr->interp, canvasPtr->regionString, &argc2, &argv2) != TCL_OK) { return TCL_ERROR; } if (argc2 != 4) { |
︙ | ︙ | |||
2461 2462 2463 2464 2465 2466 2467 | * to be redisplayed. * *---------------------------------------------------------------------- */ static void CanvasWorldChanged( | | | 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 | * to be redisplayed. * *---------------------------------------------------------------------- */ static void CanvasWorldChanged( void *instanceData) /* Information about widget. */ { TkCanvas *canvasPtr = (TkCanvas *)instanceData; Tk_Item *itemPtr; itemPtr = canvasPtr->firstItemPtr; for ( ; itemPtr != NULL; itemPtr = itemPtr->nextPtr) { if (ItemConfigure(canvasPtr, itemPtr, 0, NULL) != TCL_OK) { |
︙ | ︙ | |||
2571 2572 2573 2574 2575 2576 2577 | #define BYTE_SWAP16(n) ((((unsigned short)n)>>8) | (((unsigned short)n)<<8)) #define BYTE_SWAP32(n) (((n>>24)&0x000000FF) | ((n<<8)&0x00FF0000) | ((n>>8)&0x0000FF00) | ((n<<24)&0xFF000000)) static int DrawCanvas( Tcl_Interp *interp, /* As passed to the widget command, and we will leave errors here */ | | | 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 | #define BYTE_SWAP16(n) ((((unsigned short)n)>>8) | (((unsigned short)n)<<8)) #define BYTE_SWAP32(n) (((n>>24)&0x000000FF) | ((n<<8)&0x00FF0000) | ((n>>8)&0x0000FF00) | ((n<<24)&0xFF000000)) static int DrawCanvas( Tcl_Interp *interp, /* As passed to the widget command, and we will leave errors here */ void *clientData, Tk_PhotoHandle photohandle, /* The photo we are rendering into */ int subsample, /* If either subsample or zoom are not 1 then we call Tk_PhotoPutZoomedBlock() */ int zoom) { TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin; Display *displayPtr; |
︙ | ︙ | |||
2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 | * use memcpy() instead of the slow pixel or line copy. */ blockPtr.width = cWidth; blockPtr.height = cHeight; blockPtr.pixelSize = 4; blockPtr.pitch = blockPtr.pixelSize * blockPtr.width; blockPtr.offset[0] = 0; blockPtr.offset[1] = 1; blockPtr.offset[2] = 2; blockPtr.offset[3] = 3; blockPtr.pixelPtr = (unsigned char *)ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width); /* * Now convert the image data pixel by pixel from XImage to 32bit RGBA * format suitable for Tk_PhotoPutBlock(). */ | > > > > > > > > > | 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 | * use memcpy() instead of the slow pixel or line copy. */ blockPtr.width = cWidth; blockPtr.height = cHeight; blockPtr.pixelSize = 4; blockPtr.pitch = blockPtr.pixelSize * blockPtr.width; #ifdef TK_XGETIMAGE_USES_ABGR32 blockPtr.offset[0] = 1; blockPtr.offset[1] = 2; blockPtr.offset[2] = 3; blockPtr.offset[3] = 0; #else blockPtr.offset[0] = 0; blockPtr.offset[1] = 1; blockPtr.offset[2] = 2; blockPtr.offset[3] = 3; #endif blockPtr.pixelPtr = (unsigned char *)ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width); /* * Now convert the image data pixel by pixel from XImage to 32bit RGBA * format suitable for Tk_PhotoPutBlock(). */ |
︙ | ︙ | |||
2844 2845 2846 2847 2848 2849 2850 | #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " {", NULL); #endif for(x = 0; x < blockPtr.width; ++x) { unsigned int pixel = 0; | | | 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 | #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " {", NULL); #endif for(x = 0; x < blockPtr.width; ++x) { unsigned int pixel = 0; int pixel_offset = blockPtr.pitch * y + blockPtr.pixelSize * x; switch (ximagePtr->bits_per_pixel) { /* * Get an 8 bit pixel from the XImage. */ case 8 : |
︙ | ︙ | |||
2897 2898 2899 2900 2901 2902 2903 | * quad. However the visual mask is a 32bit ABGR quad. And * Tk_PhotoPutBlock() wants R-G-B-A which is a 32bit ABGR quad. * If the visual mask was correct there would be no need to * swap anything here. */ #ifdef _WIN32 | | > | > | > | > > > > > > | > > > > > > > > | | | | > > > > > > > | 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 | * quad. However the visual mask is a 32bit ABGR quad. And * Tk_PhotoPutBlock() wants R-G-B-A which is a 32bit ABGR quad. * If the visual mask was correct there would be no need to * swap anything here. */ #ifdef _WIN32 #define R_OFFSET blockPtr.offset[2] #define G_OFFSET blockPtr.offset[1] #define B_OFFSET blockPtr.offset[0] #define A_OFFSET blockPtr.offset[3] #else #define R_OFFSET blockPtr.offset[0] #define G_OFFSET blockPtr.offset[1] #define B_OFFSET blockPtr.offset[2] #define A_OFFSET blockPtr.offset[3] #endif #ifdef TK_XGETIMAGE_USES_ABGR32 #define COPY_PIXEL (ximagePtr->bits_per_pixel == 32) #else #define COPY_PIXEL 0 #endif if (COPY_PIXEL) { /* * This platform packs pixels in RGBA byte order, as expected * by Tk_PhotoPutBlock() so we can just copy the pixel as an int. */ *((unsigned int *) (blockPtr.pixelPtr + pixel_offset)) = pixel; } else { blockPtr.pixelPtr[pixel_offset + R_OFFSET] = (unsigned char)((pixel & visualPtr->red_mask) >> rshift); blockPtr.pixelPtr[pixel_offset + G_OFFSET] = (unsigned char)((pixel & visualPtr->green_mask) >> gshift); blockPtr.pixelPtr[pixel_offset + B_OFFSET] = (unsigned char)((pixel & visualPtr->blue_mask) >> bshift); blockPtr.pixelPtr[pixel_offset + A_OFFSET] = 0xFF; } #ifdef DEBUG_DRAWCANVAS fprintf(stderr, "Converted pixel %x to %hhx %hhx %hhx %hhx \n", pixel, blockPtr.pixelPtr[pixel_offset + 0], blockPtr.pixelPtr[pixel_offset + 1], blockPtr.pixelPtr[pixel_offset + 2], blockPtr.pixelPtr[pixel_offset + 3]); { int ix; if (x > 0) Tcl_AppendResult(interp, "-", NULL); for (ix = 0; ix < 4; ++ix) { if (ix > 0) Tcl_AppendResult(interp, " ", NULL); |
︙ | ︙ | |||
2993 2994 2995 2996 2997 2998 2999 | * Information appears on the screen. * *---------------------------------------------------------------------- */ static void DisplayCanvas( | | > > > > | | | 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 | * Information appears on the screen. * *---------------------------------------------------------------------- */ static void DisplayCanvas( void *clientData) /* Information about widget. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; Tk_Item *itemPtr; Pixmap pixmap; int screenX1, screenX2, screenY1, screenY2, width, height; #ifdef MAC_OSX_TK TkWindow *winPtr; MacDrawable *macWin; #endif if (canvasPtr->tkwin == NULL) { return; } if (!Tk_IsMapped(tkwin)) { goto done; } #ifdef MAC_OSX_TK /* * If drawing is disabled, all we need to do is * clear the REDRAW_PENDING flag. */ winPtr = (TkWindow *)(canvasPtr->tkwin); macWin = winPtr->privatePtr; if (macWin && (macWin->flags & TK_DO_NOT_DRAW)){ canvasPtr->flags &= ~REDRAW_PENDING; return; } #endif /* |
︙ | ︙ | |||
3122 3123 3124 3125 3126 3127 3128 | (screenX2 + 30 - canvasPtr->drawableXOrigin), (screenY2 + 30 - canvasPtr->drawableYOrigin), Tk_Depth(tkwin)); #else canvasPtr->drawableXOrigin = canvasPtr->xOrigin; canvasPtr->drawableYOrigin = canvasPtr->yOrigin; pixmap = Tk_WindowId(tkwin); | | | 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 | (screenX2 + 30 - canvasPtr->drawableXOrigin), (screenY2 + 30 - canvasPtr->drawableYOrigin), Tk_Depth(tkwin)); #else canvasPtr->drawableXOrigin = canvasPtr->xOrigin; canvasPtr->drawableYOrigin = canvasPtr->yOrigin; pixmap = Tk_WindowId(tkwin); Tk_ClipDrawableToRect(Tk_Display(tkwin), pixmap, screenX1 - canvasPtr->xOrigin, screenY1 - canvasPtr->yOrigin, width, height); #endif /* TK_NO_DOUBLE_BUFFERING */ /* * Clear the area to be redrawn. */ |
︙ | ︙ | |||
3181 3182 3183 3184 3185 3186 3187 | canvasPtr->pixmapGC, screenX1 - canvasPtr->drawableXOrigin, screenY1 - canvasPtr->drawableYOrigin, (unsigned int) width, (unsigned int) height, screenX1 - canvasPtr->xOrigin, screenY1 - canvasPtr->yOrigin); Tk_FreePixmap(Tk_Display(tkwin), pixmap); #else | | | 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 | canvasPtr->pixmapGC, screenX1 - canvasPtr->drawableXOrigin, screenY1 - canvasPtr->drawableYOrigin, (unsigned int) width, (unsigned int) height, screenX1 - canvasPtr->xOrigin, screenY1 - canvasPtr->yOrigin); Tk_FreePixmap(Tk_Display(tkwin), pixmap); #else Tk_ClipDrawableToRect(Tk_Display(tkwin), pixmap, 0, 0, -1, -1); #endif /* TK_NO_DOUBLE_BUFFERING */ } /* * Draw the window borders, if needed. */ |
︙ | ︙ | |||
3208 3209 3210 3211 3212 3213 3214 | GC fgGC, bgGC; bgGC = Tk_GCForColor(canvasPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); if (canvasPtr->textInfo.gotFocus) { fgGC = Tk_GCForColor(canvasPtr->highlightColorPtr, Tk_WindowId(tkwin)); | | | | 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 | GC fgGC, bgGC; bgGC = Tk_GCForColor(canvasPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); if (canvasPtr->textInfo.gotFocus) { fgGC = Tk_GCForColor(canvasPtr->highlightColorPtr, Tk_WindowId(tkwin)); Tk_DrawHighlightBorder(tkwin, fgGC, bgGC, canvasPtr->highlightWidth, Tk_WindowId(tkwin)); } else { Tk_DrawHighlightBorder(tkwin, bgGC, bgGC, canvasPtr->highlightWidth, Tk_WindowId(tkwin)); } } } done: canvasPtr->flags &= ~(REDRAW_PENDING|BBOX_NOT_EMPTY); |
︙ | ︙ | |||
3246 3247 3248 3249 3250 3251 3252 | * it gets exposed, it is redisplayed. * *---------------------------------------------------------------------- */ static void CanvasEventProc( | | | 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 | * it gets exposed, it is redisplayed. * *---------------------------------------------------------------------- */ static void CanvasEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; if (eventPtr->type == Expose) { int x, y; |
︙ | ︙ | |||
3337 3338 3339 3340 3341 3342 3343 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void CanvasCmdDeletedProc( | | | 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void CanvasCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; /* * This function could be invoked either because the window was destroyed * and the command was then deleted (in which case tkwin is NULL) or |
︙ | ︙ | |||
4591 4592 4593 4594 4595 4596 4597 | */ if (itemPtr->tagSpace == itemPtr->numTags) { Tk_Uid *newTagPtr; itemPtr->tagSpace += 5; newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); | | | 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 | */ if (itemPtr->tagSpace == itemPtr->numTags) { Tk_Uid *newTagPtr; itemPtr->tagSpace += 5; newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); memcpy(newTagPtr, itemPtr->tagPtr, itemPtr->numTags * sizeof(Tk_Uid)); if (itemPtr->tagPtr != itemPtr->staticTagSpace) { ckfree(itemPtr->tagPtr); } itemPtr->tagPtr = newTagPtr; tagPtr = &itemPtr->tagPtr[itemPtr->numTags]; } |
︙ | ︙ | |||
5072 5073 5074 5075 5076 5077 5078 | * any). * *-------------------------------------------------------------- */ static void CanvasBindProc( | | | 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 | * any). * *-------------------------------------------------------------- */ static void CanvasBindProc( void *clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; unsigned mask; Tcl_Preserve(canvasPtr); |
︙ | ︙ | |||
5273 5274 5275 5276 5277 5278 5279 | */ if ((canvasPtr->newCurrentPtr != canvasPtr->currentItemPtr) && (canvasPtr->currentItemPtr != NULL) && !(canvasPtr->flags & LEFT_GRABBED_ITEM)) { XEvent event; Tk_Item *itemPtr = canvasPtr->currentItemPtr; | | | 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 | */ if ((canvasPtr->newCurrentPtr != canvasPtr->currentItemPtr) && (canvasPtr->currentItemPtr != NULL) && !(canvasPtr->flags & LEFT_GRABBED_ITEM)) { XEvent event; Tk_Item *itemPtr = canvasPtr->currentItemPtr; TkSizeT i; event = canvasPtr->pickEvent; event.type = LeaveNotify; /* * If the event's detail happens to be NotifyInferior the binding * mechanism will discard the event. To be consistent, always use |
︙ | ︙ | |||
5295 5296 5297 5298 5299 5300 5301 | /* * The check below is needed because there could be an event handler * for <LeaveNotify> that deletes the current item. */ if ((itemPtr == canvasPtr->currentItemPtr) && !buttonDown) { | | | 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 | /* * The check below is needed because there could be an event handler * for <LeaveNotify> that deletes the current item. */ if ((itemPtr == canvasPtr->currentItemPtr) && !buttonDown) { for (i = itemPtr->numTags-1; i != TCL_INDEX_NONE; i--) { if (itemPtr->tagPtr[i] == searchUids->currentUid) /* then */ { memmove((void *)(itemPtr->tagPtr + i), itemPtr->tagPtr + i + 1, (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid)); itemPtr->numTags--; break; |
︙ | ︙ | |||
5431 5432 5433 5434 5435 5436 5437 | TkCanvas *canvasPtr, /* Canvas widget in which event occurred. */ XEvent *eventPtr) /* Real or simulated X event that is to be * processed. */ { #define NUM_STATIC 3 void *staticObjects[NUM_STATIC]; void **objectPtr; | | | 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 | TkCanvas *canvasPtr, /* Canvas widget in which event occurred. */ XEvent *eventPtr) /* Real or simulated X event that is to be * processed. */ { #define NUM_STATIC 3 void *staticObjects[NUM_STATIC]; void **objectPtr; TkSizeT numObjects, i; Tk_Item *itemPtr; TagSearchExpr *expr; int numExprs; SearchUids *searchUids = GetStaticUids(); if (canvasPtr->bindingTable == NULL) { return; |
︙ | ︙ | |||
5483 5484 5485 5486 5487 5488 5489 | numObjects = itemPtr->numTags + numExprs + 2; if (numObjects <= NUM_STATIC) { objectPtr = staticObjects; } else { objectPtr = (void **)ckalloc(numObjects * sizeof(void *)); } objectPtr[0] = (char *)searchUids->allUid; | | | 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 | numObjects = itemPtr->numTags + numExprs + 2; if (numObjects <= NUM_STATIC) { objectPtr = staticObjects; } else { objectPtr = (void **)ckalloc(numObjects * sizeof(void *)); } objectPtr[0] = (char *)searchUids->allUid; for (i = itemPtr->numTags - 1; i != TCL_INDEX_NONE; i--) { objectPtr[i+1] = (char *)itemPtr->tagPtr[i]; } objectPtr[itemPtr->numTags + 1] = itemPtr; /* * Copy uids of matching expressions into object array */ |
︙ | ︙ | |||
5535 5536 5537 5538 5539 5540 5541 | * function reschedules itself. * *---------------------------------------------------------------------- */ static void CanvasBlinkProc( | | | 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 | * function reschedules itself. * *---------------------------------------------------------------------- */ static void CanvasBlinkProc( void *clientData) /* Pointer to record describing entry. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; if (!canvasPtr->textInfo.gotFocus || (canvasPtr->insertOffTime == 0)) { return; } if (canvasPtr->textInfo.cursorOn) { |
︙ | ︙ | |||
5685 5686 5687 5688 5689 5690 5691 | * None. * *-------------------------------------------------------------- */ static TkSizeT CanvasFetchSelection( | | | 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 | * None. * *-------------------------------------------------------------- */ static TkSizeT CanvasFetchSelection( void *clientData, /* Information about canvas widget. */ TkSizeT offset, /* Offset within selection of first character * to be returned. */ char *buffer, /* Location in which to place selection. */ TkSizeT maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NULL * character. */ { |
︙ | ︙ | |||
5719 5720 5721 5722 5723 5724 5725 | * not containing a selection. * *---------------------------------------------------------------------- */ static void CanvasLostSelection( | | | 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 | * not containing a selection. * *---------------------------------------------------------------------- */ static void CanvasLostSelection( void *clientData) /* Information about entry widget. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr); canvasPtr->textInfo.selItemPtr = NULL; } |
︙ | ︙ |
Changes to generic/tkCanvas.h.
1 2 3 4 5 | /* * tkCanvas.h -- * * Declarations shared among all the files that implement canvas widgets. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkCanvas.h -- * * Declarations shared among all the files that implement canvas widgets. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1995 Sun Microsystems, Inc. * Copyright © 1998 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKCANVAS #define _TKCANVAS |
︙ | ︙ |
Changes to generic/tkClipboard.c.
1 2 3 4 5 6 7 | /* * tkClipboard.c -- * * This file manages the clipboard for the Tk toolkit, maintaining a * collection of data buffers that will be supplied on demand to * requesting applications. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkClipboard.c -- * * This file manages the clipboard for the Tk toolkit, maintaining a * collection of data buffers that will be supplied on demand to * requesting applications. * * Copyright © 1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkSelect.h" |
︙ | ︙ | |||
450 451 452 453 454 455 456 | "-displayof", "-format", "-type", NULL }; enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE }; int subIndex; TkSizeT length; for (i = 2; i < objc - 1; i++) { | | | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | "-displayof", "-format", "-type", NULL }; enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE }; int subIndex; TkSizeT length; for (i = 2; i < objc - 1; i++) { string = Tcl_GetStringFromObj(objv[i], &length); if (string[0] != '-') { break; } /* * If the argument is "--", it signifies the end of arguments. */ |
︙ | ︙ | |||
705 706 707 708 709 710 711 | ClipboardGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { | > > > > | > > | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | ClipboardGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { Tcl_Encoding utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_DString ds; (void)Tcl_ExternalToUtfDStringEx(utf8, portion, -1, TCL_ENCODING_NOCOMPLAIN, &ds); Tcl_DStringAppend((Tcl_DString *) clientData, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); Tcl_FreeEncoding(utf8); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkCmds.c.
1 2 3 4 5 6 | /* * tkCmds.c -- * * This file contains a collection of Tk-related Tcl commands that didn't * fit in any particular file of the toolkit. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkCmds.c -- * * This file contains a collection of Tk-related Tcl commands that didn't * fit in any particular file of the toolkit. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #endif /* * Table of tk subcommand names and implementations. */ static const TkEnsemble tkCmdMap[] = { {"appname", AppnameCmd, NULL }, {"busy", Tk_BusyObjCmd, NULL }, {"caret", CaretCmd, NULL }, {"inactive", InactiveCmd, NULL }, {"scaling", ScalingCmd, NULL }, {"useinputmethods", UseinputmethodsCmd, NULL }, {"windowingsystem", WindowingsystemCmd, NULL }, | > < | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #endif /* * Table of tk subcommand names and implementations. */ static const TkEnsemble tkCmdMap[] = { {"fontchooser", NULL, tkFontchooserEnsemble}, {"appname", AppnameCmd, NULL }, {"busy", Tk_BusyObjCmd, NULL }, {"caret", CaretCmd, NULL }, {"inactive", InactiveCmd, NULL }, {"scaling", ScalingCmd, NULL }, {"useinputmethods", UseinputmethodsCmd, NULL }, {"windowingsystem", WindowingsystemCmd, NULL }, {NULL, NULL, NULL} }; /* *---------------------------------------------------------------------- * * Tk_BellObjCmd -- |
︙ | ︙ | |||
181 182 183 184 185 186 187 | */ if (string[0] == '.') { winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); if (winPtr == NULL) { return TCL_ERROR; } | | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | */ if (string[0] == '.') { winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); if (winPtr == NULL) { return TCL_ERROR; } object = winPtr->pathName; } else { winPtr = (TkWindow *)clientData; object = (void *) Tk_GetUid(string); } /* * If there are four arguments, the command is modifying a binding. If * there are three arguments, the command is querying a binding. If there * are only two arguments, the command is querying all the bindings for * the given tag/window. |
︙ | ︙ | |||
263 264 265 266 267 268 269 | void TkBindEventProc( TkWindow *winPtr, /* Pointer to info about window. */ XEvent *eventPtr) /* Information about event. */ { #define MAX_OBJS 20 | | | | | | | | | | | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | void TkBindEventProc( TkWindow *winPtr, /* Pointer to info about window. */ XEvent *eventPtr) /* Information about event. */ { #define MAX_OBJS 20 void *objects[MAX_OBJS], **objPtr; TkWindow *topLevPtr; TkSizeT i, count; char *p; Tcl_HashEntry *hPtr; if ((winPtr->mainPtr == NULL) || (winPtr->mainPtr->bindingTable == NULL)) { return; } objPtr = objects; if (winPtr->numTags != 0) { /* * Make a copy of the tags for the window, replacing window names with * pointers to the pathName from the appropriate window. */ if (winPtr->numTags > MAX_OBJS) { objPtr = (void **)ckalloc(winPtr->numTags * sizeof(void *)); } for (i = 0; i < winPtr->numTags; i++) { p = (char *)winPtr->tagPtr[i]; if (*p == '.') { hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p); if (hPtr != NULL) { p = ((TkWindow *) Tcl_GetHashValue(hPtr))->pathName; } else { p = NULL; } } objPtr[i] = p; } count = winPtr->numTags; } else { objPtr[0] = winPtr->pathName; objPtr[1] = (void *)winPtr->classUid; for (topLevPtr = winPtr; (topLevPtr != NULL) && !(topLevPtr->flags & TK_TOP_HIERARCHY); topLevPtr = topLevPtr->parentPtr) { /* Empty loop body. */ } if ((winPtr != topLevPtr) && (topLevPtr != NULL)) { count = 4; objPtr[2] = topLevPtr->pathName; } else { count = 3; } objPtr[count-1] = (void *) Tk_GetUid("all"); } Tk_BindEvent(winPtr->mainPtr->bindingTable, eventPtr, (Tk_Window) winPtr, count, objPtr); if (objPtr != objects) { ckfree(objPtr); } } |
︙ | ︙ | |||
345 346 347 348 349 350 351 | ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr, *winPtr2; | | | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr, *winPtr2; TkSizeT i, length; const char *p; Tcl_Obj *listPtr, **tags; if ((objc < 2) || (objc > 3)) { Tcl_WrongNumArgs(interp, 1, objv, "window ?taglist?"); return TCL_ERROR; } |
︙ | ︙ | |||
396 397 398 399 400 401 402 | } if (length == 0) { return TCL_OK; } winPtr->numTags = length; winPtr->tagPtr = (void **)ckalloc(length * sizeof(void *)); | | | | | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | } if (length == 0) { return TCL_OK; } winPtr->numTags = length; winPtr->tagPtr = (void **)ckalloc(length * sizeof(void *)); for (i = 0; i < (TkSizeT)length; i++) { p = Tcl_GetString(tags[i]); if (p[0] == '.') { char *copy; /* * Handle names starting with "." specially: store a malloc'ed * string, rather than a Uid; at event time we'll look up the name * in the window table and use the corresponding window, if there * is one. */ copy = (char *)ckalloc(strlen(p) + 1); strcpy(copy, p); winPtr->tagPtr[i] = copy; } else { winPtr->tagPtr[i] = (void *)Tk_GetUid(p); } } return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
440 441 442 443 444 445 446 | *---------------------------------------------------------------------- */ void TkFreeBindingTags( TkWindow *winPtr) /* Window whose tags are to be released. */ { | | | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | *---------------------------------------------------------------------- */ void TkFreeBindingTags( TkWindow *winPtr) /* Window whose tags are to be released. */ { TkSizeT i; const char *p; for (i = 0; i < winPtr->numTags; i++) { p = (const char *)winPtr->tagPtr[i]; if (*p == '.') { /* * Names starting with "." are malloced rather than Uids, so they |
︙ | ︙ | |||
645 646 647 648 649 650 651 | */ int TkInitTkCmd( Tcl_Interp *interp, ClientData clientData) { | > > | > | > | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | */ int TkInitTkCmd( Tcl_Interp *interp, ClientData clientData) { /* If the interp is safe, leave out "fontchooser" */ int isSafe = Tcl_IsSafe(interp); TkMakeEnsemble(interp, "::", "tk", clientData, tkCmdMap + isSafe); #if defined(_WIN32) || defined(MAC_OSX_TK) if (!isSafe) { TkInitFontchooser(interp, clientData); } #endif return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1109 1110 1111 1112 1113 1114 1115 | return code; } static char * WaitVariableProc( ClientData clientData, /* Pointer to integer to set to 1. */ | | | > > | 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | return code; } static char * WaitVariableProc( ClientData clientData, /* Pointer to integer to set to 1. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ TCL_UNUSED(const char *), /* Second part of variable name. */ TCL_UNUSED(int)) /* Information about what happened. */ { int *donePtr = (int *)clientData; *donePtr = 1; Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, WaitVariableProc, clientData); return NULL; } static void WaitVisibilityProc( ClientData clientData, /* Pointer to integer to set to 1. */ XEvent *eventPtr) /* Information about event (not used). */ |
︙ | ︙ | |||
1858 1859 1860 1861 1862 1863 1864 | { const char *string; TkSizeT length; if (objc < 1) { return 0; } | | | 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 | { const char *string; TkSizeT length; if (objc < 1) { return 0; } string = Tcl_GetStringFromObj(objv[0], &length); if ((length >= 2) && (strncmp(string, "-displayof", length) == 0)) { if (objc < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-displayof\" missing", -1)); Tcl_SetErrorCode(interp, "TK", "NO_VALUE", "DISPLAYOF", NULL); return -1; |
︙ | ︙ |
Changes to generic/tkColor.c.
1 2 3 4 5 6 7 | /* * tkColor.c -- * * This file maintains a database of color values for the Tk toolkit, in * order to avoid round-trips to the server to map color names to pixel * values. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkColor.c -- * * This file maintains a database of color values for the Tk toolkit, in * order to avoid round-trips to the server to map color names to pixel * values. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkColor.h" |
︙ | ︙ |
Changes to generic/tkColor.h.
1 2 3 4 5 | /* * tkColor.h -- * * Declarations of data types and functions used by the Tk color module. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkColor.h -- * * Declarations of data types and functions used by the Tk color module. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKCOLOR #define _TKCOLOR |
︙ | ︙ |
Changes to generic/tkConfig.c.
1 2 3 4 5 6 | /* * tkConfig.c -- * * This file contains functions that manage configuration options for * widgets and other things. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkConfig.c -- * * This file contains functions that manage configuration options for * widgets and other things. * * Copyright © 1997-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ /* * Temporary flag for working on new config package. |
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #define __NO_OLD_CONFIG #endif #include "tkInt.h" #include "tkFont.h" /* * The following definition keeps track of all of * the option tables that have been created for a thread. */ typedef struct { int initialized; /* 0 means table below needs initializing. */ | > > > > > > > > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #define __NO_OLD_CONFIG #endif #include "tkInt.h" #include "tkFont.h" /* * The following encoding is used in TYPE_FLAGS: * * if sizeof(type) == sizeof(int) => TYPE_FLAGS(type) = 0 * if sizeof(type) == 1 => TYPE_FLAGS(type) = 64 * if sizeof(type) == 2 => TYPE_FLAGS(type) = 128 */ #define TYPE_FLAGS(type) (((int)(sizeof(type)&(sizeof(int)-1))<<6)) #define TYPE_MASK (((((int)sizeof(int)-1))|3)<<6) /* * The following definition keeps track of all of * the option tables that have been created for a thread. */ typedef struct { int initialized; /* 0 means table below needs initializing. */ |
︙ | ︙ | |||
451 452 453 454 455 456 457 | /* * Second, check for a system-specific default value. */ if ((valuePtr == NULL) && (optionPtr->dbNameUID != NULL)) { | | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | /* * Second, check for a system-specific default value. */ if ((valuePtr == NULL) && (optionPtr->dbNameUID != NULL)) { valuePtr = Tk_GetSystemDefault(tkwin, optionPtr->dbNameUID, optionPtr->dbClassUID); if (valuePtr != NULL) { source = SYSTEM_DEFAULT; } } /* |
︙ | ︙ | |||
605 606 607 608 609 610 611 | if (savedOptionPtr != NULL) { savedOptionPtr->optionPtr = optionPtr; savedOptionPtr->valuePtr = oldPtr; oldInternalPtr = (char *) &savedOptionPtr->internalForm; } else { oldInternalPtr = (char *) &internal.internalForm; } | | > > > | > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > > > > > > > > | | | | | | > > > > > > > > > > > | | > | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | if (savedOptionPtr != NULL) { savedOptionPtr->optionPtr = optionPtr; savedOptionPtr->valuePtr = oldPtr; oldInternalPtr = (char *) &savedOptionPtr->internalForm; } else { oldInternalPtr = (char *) &internal.internalForm; } nullOK = (optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)); switch (optionPtr->specPtr->type) { case TK_OPTION_BOOLEAN: { int newBool; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newBool = -1; } else if (Tcl_GetBooleanFromObj(nullOK ? NULL : interp, valuePtr, &newBool) != TCL_OK) { if (nullOK && interp) { Tcl_AppendResult(interp, "expected boolean value or \"\" but got \"", Tcl_GetString(valuePtr), "\"", NULL); } return TCL_ERROR; } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newBool; } break; } case TK_OPTION_INT: { int newInt; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newInt = INT_MIN; } else if (Tcl_GetIntFromObj(nullOK ? NULL : interp, valuePtr, &newInt) != TCL_OK) { if (nullOK && interp) { Tcl_Obj *msg = Tcl_NewStringObj("expected integer or \"\" but got \"", -1); Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), -1, 50, ""); Tcl_AppendToObj(msg, "\"", -1); Tcl_SetObjResult(interp, msg); Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL); } return TCL_ERROR; } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newInt; } break; } case TK_OPTION_INDEX: { TkSizeT newIndex; if (TkGetIntForIndex(valuePtr, TCL_INDEX_END, 0, &newIndex) != TCL_OK) { if (interp) { Tcl_AppendResult(interp, "bad index \"", Tcl_GetString(valuePtr), "\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", NULL); } return TCL_ERROR; } if (newIndex == TCL_INDEX_NONE) { newIndex = (TkSizeT)INT_MIN; } else if ((size_t)newIndex > (size_t)TCL_INDEX_END>>1) { newIndex++; } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = (int)newIndex; } break; } case TK_OPTION_DOUBLE: { double newDbl; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; #if defined(NAN) newDbl = NAN; #else newDbl = 0.0; #endif } else { if (Tcl_GetDoubleFromObj(nullOK ? NULL : interp, valuePtr, &newDbl) != TCL_OK) { if (nullOK && interp) { Tcl_Obj *msg = Tcl_NewStringObj("expected floating-point number or \"\" but got \"", -1); Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), -1, 50, ""); Tcl_AppendToObj(msg, "\"", -1); Tcl_SetObjResult(interp, msg); Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL); } return TCL_ERROR; } } if (internalPtr != NULL) { *((double *) oldInternalPtr) = *((double *) internalPtr); *((double *) internalPtr) = newDbl; } break; } case TK_OPTION_STRING: { char *newStr; const char *value; TkSizeT length; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; } if (internalPtr != NULL) { if (valuePtr != NULL) { value = Tcl_GetStringFromObj(valuePtr, &length); newStr = (char *)ckalloc(length + 1); strcpy(newStr, value); } else { newStr = NULL; } *((char **) oldInternalPtr) = *((char **) internalPtr); *((char **) internalPtr) = newStr; } break; } case TK_OPTION_STRING_TABLE: { int newValue; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newValue = -1; } else { if (Tcl_GetIndexFromObjStruct(interp, valuePtr, optionPtr->specPtr->clientData, sizeof(char *), optionPtr->specPtr->optionName+1, (nullOK ? TCL_NULL_OK : 0), &newValue) != TCL_OK) { return TCL_ERROR; } } if (internalPtr != NULL) { if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) { *((char *) oldInternalPtr) = *((char *) internalPtr); *((char *) internalPtr) = newValue; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); *((short *) internalPtr) = newValue; } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE"); } } else { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newValue; } } break; } case TK_OPTION_COLOR: { XColor *newPtr; if (nullOK && ObjectIsEmpty(valuePtr)) { |
︙ | ︙ | |||
785 786 787 788 789 790 791 | } case TK_OPTION_RELIEF: { int newRelief; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newRelief = TK_RELIEF_NULL; | | | | < | 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | } case TK_OPTION_RELIEF: { int newRelief; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newRelief = TK_RELIEF_NULL; } else if (Tcl_GetIndexFromObj(interp, valuePtr, tkReliefStrings, "relief", (nullOK ? TCL_NULL_OK : 0), &newRelief) != TCL_OK) { return TCL_ERROR; } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newRelief; } break; } |
︙ | ︙ | |||
816 817 818 819 820 821 822 | *((Tk_Cursor *) oldInternalPtr) = *((Tk_Cursor *) internalPtr); *((Tk_Cursor *) internalPtr) = newCursor; } Tk_DefineCursor(tkwin, newCursor); break; } case TK_OPTION_JUSTIFY: { | | > > > | > | | > > > | > | | < | | | < < | | | < | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 | *((Tk_Cursor *) oldInternalPtr) = *((Tk_Cursor *) internalPtr); *((Tk_Cursor *) internalPtr) = newCursor; } Tk_DefineCursor(tkwin, newCursor); break; } case TK_OPTION_JUSTIFY: { int newJustify; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newJustify = -1; } else if (Tcl_GetIndexFromObj(interp, valuePtr, tkJustifyStrings, "justification", (nullOK ? TCL_NULL_OK : 0), &newJustify) != TCL_OK) { return TCL_ERROR; } if (internalPtr != NULL) { *((Tk_Justify *) oldInternalPtr) = *((Tk_Justify *) internalPtr); *((Tk_Justify *) internalPtr) = (Tk_Justify)newJustify; } break; } case TK_OPTION_ANCHOR: { int newAnchor; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newAnchor = -1; } else if (Tcl_GetIndexFromObj(interp, valuePtr, tkAnchorStrings, "anchor", (nullOK ? TCL_NULL_OK : 0), &newAnchor) != TCL_OK) { return TCL_ERROR; } if (internalPtr != NULL) { *((Tk_Anchor *) oldInternalPtr) = *((Tk_Anchor *) internalPtr); *((Tk_Anchor *) internalPtr) = (Tk_Anchor)newAnchor; } break; } case TK_OPTION_PIXELS: { int newPixels; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newPixels = INT_MIN; } else if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &newPixels) != TCL_OK) { return TCL_ERROR; } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newPixels; } break; } case TK_OPTION_WINDOW: { Tk_Window newWin; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newWin = NULL; } else if (TkGetWindowFromObj(interp, tkwin, valuePtr, &newWin) != TCL_OK) { return TCL_ERROR; } if (internalPtr != NULL) { *((Tk_Window *) oldInternalPtr) = *((Tk_Window *) internalPtr); *((Tk_Window *) internalPtr) = newWin; } break; } |
︙ | ︙ | |||
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | if (specPtr->internalOffset != TCL_INDEX_NONE) { char *ptr = (char *) &savePtr->items[i].internalForm; CLANG_ASSERT(internalPtr); switch (specPtr->type) { case TK_OPTION_BOOLEAN: case TK_OPTION_INT: *((int *) internalPtr) = *((int *) ptr); break; case TK_OPTION_DOUBLE: *((double *) internalPtr) = *((double *) ptr); break; case TK_OPTION_STRING: *((char **) internalPtr) = *((char **) ptr); break; case TK_OPTION_STRING_TABLE: | > > > > > > > > > > | > | 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 | if (specPtr->internalOffset != TCL_INDEX_NONE) { char *ptr = (char *) &savePtr->items[i].internalForm; CLANG_ASSERT(internalPtr); switch (specPtr->type) { case TK_OPTION_BOOLEAN: case TK_OPTION_INT: case TK_OPTION_INDEX: *((int *) internalPtr) = *((int *) ptr); break; case TK_OPTION_DOUBLE: *((double *) internalPtr) = *((double *) ptr); break; case TK_OPTION_STRING: *((char **) internalPtr) = *((char **) ptr); break; case TK_OPTION_STRING_TABLE: if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) { *((char *) internalPtr) = *((char *) ptr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(short)) { *((short *) internalPtr) = *((short *) ptr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE"); } } else { *((int *) internalPtr) = *((int *) ptr); } break; case TK_OPTION_COLOR: *((XColor **) internalPtr) = *((XColor **) ptr); break; case TK_OPTION_FONT: *((Tk_Font *) internalPtr) = *((Tk_Font *) ptr); break; |
︙ | ︙ | |||
1863 1864 1865 1866 1867 1868 1869 | void *recordPtr, /* Pointer to record holding current values of * configuration options. */ Option *optionPtr, /* Pointer to information describing an option * whose internal value is stored in * *recordPtr. */ Tk_Window tkwin) /* Window corresponding to recordPtr. */ { | | | < < > > > > > | > > > > > > > > > > > > > > > > > | > | > > > > > > > > > > > > > | | > > | 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 | void *recordPtr, /* Pointer to record holding current values of * configuration options. */ Option *optionPtr, /* Pointer to information describing an option * whose internal value is stored in * *recordPtr. */ Tk_Window tkwin) /* Window corresponding to recordPtr. */ { Tcl_Obj *objPtr = NULL; void *internalPtr; /* Points to internal value of option in record. */ if (optionPtr->specPtr->internalOffset != TCL_INDEX_NONE) { internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset; switch (optionPtr->specPtr->type) { case TK_OPTION_BOOLEAN: if (*((int *) internalPtr) != -1) { objPtr = Tcl_NewBooleanObj(*((int *)internalPtr)); } break; case TK_OPTION_INT: if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)) || *((int *) internalPtr) != INT_MIN) { objPtr = Tcl_NewWideIntObj(*((int *)internalPtr)); } break; case TK_OPTION_INDEX: if (*((int *) internalPtr) == INT_MIN) { objPtr = TkNewIndexObj(TCL_INDEX_NONE); } else if (*((int *) internalPtr) == INT_MAX) { objPtr = Tcl_NewStringObj("end+1", -1); } else if (*((int *) internalPtr) == -1) { objPtr = Tcl_NewStringObj("end", -1); } else if (*((int *) internalPtr) < 0) { char buf[32]; sprintf(buf, "end%d", *((int *) internalPtr)); objPtr = Tcl_NewStringObj(buf, -1); } else { objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); } break; case TK_OPTION_DOUBLE: if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)) || !isnan(*((double *) internalPtr))) { objPtr = Tcl_NewDoubleObj(*((double *) internalPtr)); } break; case TK_OPTION_STRING: objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1); break; case TK_OPTION_STRING_TABLE: { int value; if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) { value = *((signed char *)internalPtr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(short)) { value = *((short *)internalPtr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE"); } } else { value = *((int *)internalPtr); } if (value >= 0) { objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[ value], -1); } break; } case TK_OPTION_COLOR: { XColor *colorPtr = *((XColor **)internalPtr); if (colorPtr != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1); } break; |
︙ | ︙ | |||
1947 1948 1949 1950 1951 1952 1953 | *((Tk_Justify *)internalPtr)), -1); break; case TK_OPTION_ANCHOR: objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( *((Tk_Anchor *)internalPtr)), -1); break; case TK_OPTION_PIXELS: | > | > | 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 | *((Tk_Justify *)internalPtr)), -1); break; case TK_OPTION_ANCHOR: objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( *((Tk_Anchor *)internalPtr)), -1); break; case TK_OPTION_PIXELS: if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)) || *((int *) internalPtr) != INT_MIN) { objPtr = Tcl_NewWideIntObj(*((int *)internalPtr)); } break; case TK_OPTION_WINDOW: { tkwin = *((Tk_Window *) internalPtr); if (tkwin != NULL) { objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); } |
︙ | ︙ |
Changes to generic/tkConsole.c.
1 2 3 4 5 6 7 | /* * tkConsole.c -- * * This file implements a Tcl console for systems that may not otherwise * have access to a console. It uses the Text widget and provides special * access via a console command. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkConsole.c -- * * This file implements a Tcl console for systems that may not otherwise * have access to a console. It uses the Text widget and provides special * access via a console command. * * Copyright © 1995-1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
513 514 515 516 517 518 519 | /* * Not checking for utf8 == NULL. Did not check for TCL_ERROR * from Tcl_SetChannelOption() in Tk_InitConsoleChannels() either. * Assumption is utf-8 Tcl_Encoding is reliably present. */ | > | < | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | /* * Not checking for utf8 == NULL. Did not check for TCL_ERROR * from Tcl_SetChannelOption() in Tk_InitConsoleChannels() either. * Assumption is utf-8 Tcl_Encoding is reliably present. */ (void)Tcl_ExternalToUtfDStringEx(utf8, buf, toWrite, TCL_ENCODING_NOCOMPLAIN, &ds); const char *bytes = Tcl_DStringValue(&ds); int numBytes = Tcl_DStringLength(&ds); Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", -1); Tcl_FreeEncoding(utf8); if (data->type == TCL_STDERR) { Tcl_ListObjAppendElement(NULL, cmd, |
︙ | ︙ |
Changes to generic/tkCursor.c.
1 2 3 4 5 6 7 | /* * tkCursor.c -- * * This file maintains a database of read-only cursors for the Tk * toolkit. This allows cursors to be shared between widgets and also * avoids round-trips to the X server. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkCursor.c -- * * This file maintains a database of read-only cursors for the Tk * toolkit. This allows cursors to be shared between widgets and also * avoids round-trips to the X server. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to generic/tkDList.h.
1 2 3 4 5 6 7 8 9 | /* * tkDList.h -- * * A list is headed by pointers to first and last element. The elements * are doubly linked so that an arbitrary element can be removed without * a need to traverse the list. New elements can be added to the list * before or after an existing element or at the head/tail of the list. * A list may be traversed in the forward or backward direction. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkDList.h -- * * A list is headed by pointers to first and last element. The elements * are doubly linked so that an arbitrary element can be removed without * a need to traverse the list. New elements can be added to the list * before or after an existing element or at the head/tail of the list. * A list may be traversed in the forward or backward direction. * * Copyright © 2018 Gregor Cramer. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ /* * Note that this file will not be included in header files, it is the purpose |
︙ | ︙ |
Changes to generic/tkDecls.h.
1 2 3 4 5 | /* * tkDecls.h -- * * Declarations of functions in the platform independent public Tcl API. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkDecls.h -- * * Declarations of functions in the platform independent public Tcl API. * * Copyright (c) 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKDECLS #define _TKDECLS |
︙ | ︙ | |||
889 890 891 892 893 894 895 896 897 898 899 900 901 902 | /* 277 */ EXTERN Tcl_Obj * Tk_NewWindowObj(Tk_Window tkwin); /* 278 */ EXTERN void Tk_SendVirtualEvent(Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 279 */ EXTERN Tcl_Obj * Tk_FontGetDescription(Tk_Font tkfont); typedef struct { const struct TkPlatStubs *tkPlatStubs; const struct TkIntStubs *tkIntStubs; const struct TkIntPlatStubs *tkIntPlatStubs; const struct TkIntXlibStubs *tkIntXlibStubs; } TkStubHooks; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | /* 277 */ EXTERN Tcl_Obj * Tk_NewWindowObj(Tk_Window tkwin); /* 278 */ EXTERN void Tk_SendVirtualEvent(Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 279 */ EXTERN Tcl_Obj * Tk_FontGetDescription(Tk_Font tkfont); /* 280 */ EXTERN void Tk_CreatePhotoImageFormatVersion3( const Tk_PhotoImageFormatVersion3 *formatPtr); /* 281 */ EXTERN void Tk_DrawHighlightBorder(Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable); /* 282 */ EXTERN void Tk_SetMainMenubar(Tcl_Interp *interp, Tk_Window tkwin, const char *menuName); /* 283 */ EXTERN void Tk_SetWindowMenubar(Tcl_Interp *interp, Tk_Window tkwin, const char *oldMenuName, const char *menuName); /* 284 */ EXTERN void Tk_ClipDrawableToRect(Display *display, Drawable d, int x, int y, int width, int height); /* 285 */ EXTERN Tcl_Obj * Tk_GetSystemDefault(Tk_Window tkwin, const char *dbName, const char *className); /* 286 */ EXTERN int Tk_UseWindow(Tcl_Interp *interp, Tk_Window tkwin, const char *string); /* 287 */ EXTERN void Tk_MakeContainer(Tk_Window tkwin); /* 288 */ EXTERN Tk_Window Tk_GetOtherWindow(Tk_Window tkwin); /* 289 */ EXTERN void Tk_Get3DBorderColors(Tk_3DBorder border, XColor *bgColorPtr, XColor *darkColorPtr, XColor *lightColorPtr); /* 290 */ EXTERN Window Tk_MakeWindow(Tk_Window tkwin, Window parent); typedef struct { const struct TkPlatStubs *tkPlatStubs; const struct TkIntStubs *tkIntStubs; const struct TkIntPlatStubs *tkIntPlatStubs; const struct TkIntXlibStubs *tkIntXlibStubs; } TkStubHooks; |
︙ | ︙ | |||
1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 | void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */ int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */ unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */ int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */ Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */ void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */ Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */ } TkStubs; extern const TkStubs *tkStubsPtr; #ifdef __cplusplus } #endif | > > > > > > > > > > > | 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 | void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */ int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */ unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */ int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */ Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */ void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */ Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */ void (*tk_CreatePhotoImageFormatVersion3) (const Tk_PhotoImageFormatVersion3 *formatPtr); /* 280 */ void (*tk_DrawHighlightBorder) (Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable); /* 281 */ void (*tk_SetMainMenubar) (Tcl_Interp *interp, Tk_Window tkwin, const char *menuName); /* 282 */ void (*tk_SetWindowMenubar) (Tcl_Interp *interp, Tk_Window tkwin, const char *oldMenuName, const char *menuName); /* 283 */ void (*tk_ClipDrawableToRect) (Display *display, Drawable d, int x, int y, int width, int height); /* 284 */ Tcl_Obj * (*tk_GetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 285 */ int (*tk_UseWindow) (Tcl_Interp *interp, Tk_Window tkwin, const char *string); /* 286 */ void (*tk_MakeContainer) (Tk_Window tkwin); /* 287 */ Tk_Window (*tk_GetOtherWindow) (Tk_Window tkwin); /* 288 */ void (*tk_Get3DBorderColors) (Tk_3DBorder border, XColor *bgColorPtr, XColor *darkColorPtr, XColor *lightColorPtr); /* 289 */ Window (*tk_MakeWindow) (Tk_Window tkwin, Window parent); /* 290 */ } TkStubs; extern const TkStubs *tkStubsPtr; #ifdef __cplusplus } #endif |
︙ | ︙ | |||
1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 | (tkStubsPtr->tk_GetDoublePixelsFromObj) /* 276 */ #define Tk_NewWindowObj \ (tkStubsPtr->tk_NewWindowObj) /* 277 */ #define Tk_SendVirtualEvent \ (tkStubsPtr->tk_SendVirtualEvent) /* 278 */ #define Tk_FontGetDescription \ (tkStubsPtr->tk_FontGetDescription) /* 279 */ #endif /* defined(USE_TK_STUBS) */ /* !END!: Do not edit above this line. */ /* Functions that don't belong in the stub table */ #undef Tk_MainEx #undef Tk_Init #undef Tk_SafeInit #undef Tk_CreateConsoleWindow #undef Tk_FreeXId #define Tk_FreeXId(display,xid) #undef Tk_GetStyleFromObj #undef Tk_FreeStyleFromObj #define Tk_GetStyleFromObj(obj) Tk_AllocStyleFromObj(NULL, obj) #define Tk_FreeStyleFromObj(obj) /* no-op */ #define Tk_GetImageMasterData Tk_GetImageModelData #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW EXTERN void Tk_MainExW(int argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #endif #if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 #undef Tk_PhotoPutBlock_NoComposite #undef Tk_PhotoPutZoomedBlock_NoComposite #undef Tk_PhotoExpand_Panic #undef Tk_PhotoPutBlock_Panic #undef Tk_PhotoPutZoomedBlock_Panic #undef Tk_PhotoSetSize_Panic #undef Tk_CreateOldPhotoImageFormat #endif /* TK_NO_DEPRECATED */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TKDECLS */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 | (tkStubsPtr->tk_GetDoublePixelsFromObj) /* 276 */ #define Tk_NewWindowObj \ (tkStubsPtr->tk_NewWindowObj) /* 277 */ #define Tk_SendVirtualEvent \ (tkStubsPtr->tk_SendVirtualEvent) /* 278 */ #define Tk_FontGetDescription \ (tkStubsPtr->tk_FontGetDescription) /* 279 */ #define Tk_CreatePhotoImageFormatVersion3 \ (tkStubsPtr->tk_CreatePhotoImageFormatVersion3) /* 280 */ #define Tk_DrawHighlightBorder \ (tkStubsPtr->tk_DrawHighlightBorder) /* 281 */ #define Tk_SetMainMenubar \ (tkStubsPtr->tk_SetMainMenubar) /* 282 */ #define Tk_SetWindowMenubar \ (tkStubsPtr->tk_SetWindowMenubar) /* 283 */ #define Tk_ClipDrawableToRect \ (tkStubsPtr->tk_ClipDrawableToRect) /* 284 */ #define Tk_GetSystemDefault \ (tkStubsPtr->tk_GetSystemDefault) /* 285 */ #define Tk_UseWindow \ (tkStubsPtr->tk_UseWindow) /* 286 */ #define Tk_MakeContainer \ (tkStubsPtr->tk_MakeContainer) /* 287 */ #define Tk_GetOtherWindow \ (tkStubsPtr->tk_GetOtherWindow) /* 288 */ #define Tk_Get3DBorderColors \ (tkStubsPtr->tk_Get3DBorderColors) /* 289 */ #define Tk_MakeWindow \ (tkStubsPtr->tk_MakeWindow) /* 290 */ #endif /* defined(USE_TK_STUBS) */ /* !END!: Do not edit above this line. */ /* Functions that don't belong in the stub table */ #undef Tk_MainEx #undef Tk_Init #undef Tk_SafeInit #undef Tk_CreateConsoleWindow #undef Tk_FreeXId #define Tk_FreeXId(display,xid) #undef Tk_GetStyleFromObj #undef Tk_FreeStyleFromObj #define Tk_GetStyleFromObj(obj) Tk_AllocStyleFromObj(NULL, obj) #define Tk_FreeStyleFromObj(obj) /* no-op */ #define Tk_GetImageMasterData Tk_GetImageModelData #ifndef MAC_OSX_TK # undef Tk_ClipDrawableToRect #endif #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW EXTERN void Tk_MainExW(int argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #endif #if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 #undef Tk_PhotoPutBlock_NoComposite #undef Tk_PhotoPutZoomedBlock_NoComposite #undef Tk_PhotoExpand_Panic #undef Tk_PhotoPutBlock_Panic #undef Tk_PhotoPutZoomedBlock_Panic #undef Tk_PhotoSetSize_Panic #undef Tk_CreateOldPhotoImageFormat #endif /* TK_NO_DEPRECATED */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #undef TkUnusedStubEntry #endif /* _TKDECLS */ |
Changes to generic/tkEntry.c.
1 2 3 4 5 6 7 8 | /* * tkEntry.c -- * * This module implements entry and spinbox widgets for the Tk toolkit. * An entry displays a string and allows the string to be edited. A * spinbox expands on the entry by adding up/down buttons that control * the value of the entry widget. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tkEntry.c -- * * This module implements entry and spinbox widgets for the Tk toolkit. * An entry displays a string and allows the string to be edited. A * spinbox expands on the entry by adding up/down buttons that control * the value of the entry widget. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2000 Ajuba Solutions. * Copyright © 2002 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkEntry.h" |
︙ | ︙ | |||
73 74 75 76 77 78 79 | DEF_ENTRY_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Entry, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_ENTRY_CURSOR, TCL_INDEX_NONE, offsetof(Entry, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground", "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK, | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | DEF_ENTRY_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Entry, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_ENTRY_CURSOR, TCL_INDEX_NONE, offsetof(Entry, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground", "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK, DEF_ENTRY_DISABLED_BG_MONO, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_ENTRY_DISABLED_FG, TCL_INDEX_NONE, offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, TCL_INDEX_NONE, offsetof(Entry, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, |
︙ | ︙ | |||
99 100 101 102 103 104 105 | "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, offsetof(Entry, highlightWidth), 0, 0, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_ENTRY_INSERT_BG, TCL_INDEX_NONE, offsetof(Entry, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, TCL_INDEX_NONE, offsetof(Entry, insertBorderWidth), 0, | | | | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, offsetof(Entry, highlightWidth), 0, 0, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_ENTRY_INSERT_BG, TCL_INDEX_NONE, offsetof(Entry, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, TCL_INDEX_NONE, offsetof(Entry, insertBorderWidth), 0, DEF_ENTRY_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_ENTRY_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", DEF_ENTRY_INSERT_ON_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOnTime), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_ENTRY_INSERT_WIDTH, TCL_INDEX_NONE, offsetof(Entry, insertWidth), 0, 0, 0}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", DEF_ENTRY_INVALIDCMD, TCL_INDEX_NONE, offsetof(Entry, invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-invalidcommand", 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_ENTRY_JUSTIFY, TCL_INDEX_NONE, offsetof(Entry, justify), 0, 0, 0}, {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", DEF_ENTRY_PLACEHOLDER, TCL_INDEX_NONE, offsetof(Entry, placeholderString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground", "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, TCL_INDEX_NONE, offsetof(Entry, placeholderColorPtr), 0, 0, 0}, {TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground", "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK, DEF_ENTRY_READONLY_BG_MONO, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_ENTRY_RELIEF, TCL_INDEX_NONE, offsetof(Entry, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_ENTRY_SELECT_COLOR, TCL_INDEX_NONE, offsetof(Entry, selBorder), 0, DEF_ENTRY_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, TCL_INDEX_NONE, |
︙ | ︙ | |||
212 213 214 215 216 217 218 | TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_ENTRY_CURSOR, TCL_INDEX_NONE, offsetof(Entry, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground", "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK, | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_ENTRY_CURSOR, TCL_INDEX_NONE, offsetof(Entry, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground", "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK, DEF_ENTRY_DISABLED_BG_MONO, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_ENTRY_DISABLED_FG, TCL_INDEX_NONE, offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, TCL_INDEX_NONE, offsetof(Entry, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, |
︙ | ︙ | |||
245 246 247 248 249 250 251 | {TK_OPTION_DOUBLE, "-increment", "increment", "Increment", DEF_SPINBOX_INCREMENT, TCL_INDEX_NONE, offsetof(Spinbox, increment), 0, 0, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_ENTRY_INSERT_BG, TCL_INDEX_NONE, offsetof(Entry, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, TCL_INDEX_NONE, offsetof(Entry, insertBorderWidth), 0, | | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | {TK_OPTION_DOUBLE, "-increment", "increment", "Increment", DEF_SPINBOX_INCREMENT, TCL_INDEX_NONE, offsetof(Spinbox, increment), 0, 0, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_ENTRY_INSERT_BG, TCL_INDEX_NONE, offsetof(Entry, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, TCL_INDEX_NONE, offsetof(Entry, insertBorderWidth), 0, DEF_ENTRY_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_ENTRY_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", DEF_ENTRY_INSERT_ON_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOnTime), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_ENTRY_INSERT_WIDTH, TCL_INDEX_NONE, offsetof(Entry, insertWidth), 0, 0, 0}, |
︙ | ︙ | |||
271 272 273 274 275 276 277 | "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, TCL_INDEX_NONE, offsetof(Entry, placeholderColorPtr), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_ENTRY_RELIEF, TCL_INDEX_NONE, offsetof(Entry, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground", "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK, | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, TCL_INDEX_NONE, offsetof(Entry, placeholderColorPtr), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_ENTRY_RELIEF, TCL_INDEX_NONE, offsetof(Entry, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground", "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, TCL_INDEX_NONE, offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK, DEF_ENTRY_READONLY_BG_MONO, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", DEF_SPINBOX_REPEAT_DELAY, TCL_INDEX_NONE, offsetof(Spinbox, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", DEF_SPINBOX_REPEAT_INTERVAL, TCL_INDEX_NONE, offsetof(Spinbox, repeatInterval), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", |
︙ | ︙ | |||
383 384 385 386 387 388 389 | /* * This is the string array corresponding to the enum in selelement. If you * modify them, you must modify the strings here. */ static const char *const selElementNames[] = { | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | /* * This is the string array corresponding to the enum in selelement. If you * modify them, you must modify the strings here. */ static const char *const selElementNames[] = { "buttondown", "buttonup", "none", NULL, "entry" }; /* * Flags for GetEntryIndex function: */ #define ZERO_OK 1 |
︙ | ︙ | |||
707 708 709 710 711 712 713 | } case COMMAND_GET: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); goto error; } | | | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | } case COMMAND_GET: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); goto error; } Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, -1)); break; case COMMAND_ICURSOR: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pos"); goto error; } |
︙ | ︙ | |||
780 781 782 783 784 785 786 | entryPtr->scanMarkX = x; entryPtr->scanMarkIndex = entryPtr->leftIndex; } else if ((minorCmd[0] == 'd') && (strncmp(minorCmd, "dragto", strlen(minorCmd)) == 0)) { EntryScanTo(entryPtr, x); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( | | | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | entryPtr->scanMarkX = x; entryPtr->scanMarkIndex = entryPtr->leftIndex; } else if ((minorCmd[0] == 'd') && (strncmp(minorCmd, "dragto", strlen(minorCmd)) == 0)) { EntryScanTo(entryPtr, x); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad scan option \"%s\": must be dragto or mark", minorCmd)); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "scan option", minorCmd, NULL); goto error; } break; } |
︙ | ︙ | |||
1257 1258 1259 1260 1261 1262 1263 | if (oldValues != sbPtr->valueStr) { if (sbPtr->listObj != NULL) { Tcl_DecrRefCount(sbPtr->listObj); } sbPtr->listObj = NULL; if (sbPtr->valueStr != NULL) { Tcl_Obj *newObjPtr; | | | | 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | if (oldValues != sbPtr->valueStr) { if (sbPtr->listObj != NULL) { Tcl_DecrRefCount(sbPtr->listObj); } sbPtr->listObj = NULL; if (sbPtr->valueStr != NULL) { Tcl_Obj *newObjPtr; TkSizeT nelems; newObjPtr = Tcl_NewStringObj(sbPtr->valueStr, -1); if (Tcl_ListObjLength(interp, newObjPtr, &nelems) != TCL_OK) { valuesChanged = -1; continue; } sbPtr->listObj = newObjPtr; Tcl_IncrRefCount(sbPtr->listObj); |
︙ | ︙ | |||
1923 1924 1925 1926 1927 1928 1929 | } if (xBound > 0) { GC fgGC, bgGC; bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, pixmap); if (entryPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(entryPtr->highlightColorPtr, pixmap); | | | | 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 | } if (xBound > 0) { GC fgGC, bgGC; bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, pixmap); if (entryPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(entryPtr->highlightColorPtr, pixmap); Tk_DrawHighlightBorder(tkwin, fgGC, bgGC, xBound, pixmap); } else { Tk_DrawHighlightBorder(tkwin, bgGC, bgGC, xBound, pixmap); } } } #ifndef TK_NO_DOUBLE_BUFFERING /* * Everything's been redisplayed; now copy the pixmap onto the screen and |
︙ | ︙ | |||
2686 2687 2688 2689 2690 2691 2692 | } else if (idx > entryPtr->numChars) { idx = entryPtr->numChars; } *indexPtr = idx; return TCL_OK; } | | | 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 | } else if (idx > entryPtr->numChars) { idx = entryPtr->numChars; } *indexPtr = idx; return TCL_OK; } string = Tcl_GetStringFromObj(indexObj, &length); switch (string[0]) { case 'a': if (strncmp(string, "anchor", length) != 0) { goto badIndex; } *indexPtr = entryPtr->selectAnchor; |
︙ | ︙ | |||
3263 3264 3265 3266 3267 3268 3269 | /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && entryPtr->textVarName) { | | | | 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 | /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && entryPtr->textVarName) { void *probe = NULL; do { probe = Tcl_VarTraceInfo(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, EntryTextVarProc, probe); if (probe == (void *)entryPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * textVarName, which means it is not unset and not |
︙ | ︙ | |||
4055 4056 4057 4058 4059 4060 4061 | entryPtr->scanMarkX = x; entryPtr->scanMarkIndex = entryPtr->leftIndex; } else if ((minorCmd[0] == 'd') && (strncmp(minorCmd, "dragto", strlen(minorCmd)) == 0)) { EntryScanTo(entryPtr, x); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( | | | 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 | entryPtr->scanMarkX = x; entryPtr->scanMarkIndex = entryPtr->leftIndex; } else if ((minorCmd[0] == 'd') && (strncmp(minorCmd, "dragto", strlen(minorCmd)) == 0)) { EntryScanTo(entryPtr, x); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad scan option \"%s\": must be dragto or mark", minorCmd)); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "scan option", minorCmd, NULL); goto error; } break; } |
︙ | ︙ | |||
4422 4423 4424 4425 4426 4427 4428 | if (strcmp(Tcl_GetString(objPtr), entryPtr->string)) { /* * Somehow the string changed from what we expected, so let's * do a search on the list to see if the current value is * there. If not, move to the first element of the list. */ | | | | 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 | if (strcmp(Tcl_GetString(objPtr), entryPtr->string)) { /* * Somehow the string changed from what we expected, so let's * do a search on the list to see if the current value is * there. If not, move to the first element of the list. */ TkSizeT i, listc; TkSizeT elemLen, length = entryPtr->numChars; const char *bytes; Tcl_Obj **listv; Tcl_ListObjGetElements(interp, sbPtr->listObj, &listc, &listv); for (i = 0; i < listc; i++) { bytes = Tcl_GetStringFromObj(listv[i], &elemLen); if ((length == elemLen) && (memcmp(bytes, entryPtr->string, length) == 0)) { sbPtr->eIndex = i; break; } } |
︙ | ︙ |
Changes to generic/tkEntry.h.
1 2 3 4 5 6 7 8 | /* * tkEntry.h -- * * This module defined the structures for the Entry & SpinBox widgets. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkEntry.h -- * * This module defined the structures for the Entry & SpinBox widgets. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Copyright © 2002 Apple Inc. */ #ifndef _TKENTRY #define _TKENTRY #ifndef _TKINT #include "tkInt.h" |
︙ | ︙ | |||
292 293 294 295 296 297 298 | /* * This is the element index corresponding to the strings in selElementNames. * If you modify them, you must modify the numbers here. */ enum selelement { | | | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | /* * This is the element index corresponding to the strings in selElementNames. * If you modify them, you must modify the numbers here. */ enum selelement { SEL_BUTTONDOWN, SEL_BUTTONUP, SEL_NONE, SEL_NULL, SEL_ENTRY }; /* * Declaration of functions used in the implementation of the native side of * the Entry widget. */ MODULE_SCOPE int TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox); MODULE_SCOPE int TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d); #endif /* _TKENTRY */ |
Changes to generic/tkError.c.
1 2 3 4 5 6 7 8 | /* * tkError.c -- * * This file provides a high-performance mechanism for selectively * dealing with errors that occur in talking to the X server. This is * useful, for example, when communicating with a window that may not * exist. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkError.c -- * * This file provides a high-performance mechanism for selectively * dealing with errors that occur in talking to the X server. This is * useful, for example, when communicating with a window that may not * exist. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to generic/tkEvent.c.
1 2 3 4 5 6 | /* * tkEvent.c -- * * This file provides basic low-level facilities for managing X events in * Tk. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkEvent.c -- * * This file provides basic low-level facilities for managing X events in * Tk. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1995 Sun Microsystems, Inc. * Copyright © 1998-2000 Ajuba Solutions. * Copyright © 2004 George Peter Staplin * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | return; } else if (eventPtr->type == ButtonPress) { int but = eventPtr->xbutton.button; eventPtr->type = MouseWheelEvent; eventPtr->xany.send_event = -1; eventPtr->xkey.keycode = (but & 1) ? -120 : 120; if (but > Button5) { | | | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | return; } else if (eventPtr->type == ButtonPress) { int but = eventPtr->xbutton.button; eventPtr->type = MouseWheelEvent; eventPtr->xany.send_event = -1; eventPtr->xkey.keycode = (but & 1) ? -120 : 120; if (but > Button5) { eventPtr->xkey.state |= ShiftMask; } } } #endif /* * If the generic handler processed this event we are done and can return. |
︙ | ︙ | |||
1838 1839 1840 1841 1842 1843 1844 | * *---------------------------------------------------------------------- */ void TkCreateExitHandler( Tcl_ExitProc *proc, /* Function to invoke. */ | | | 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 | * *---------------------------------------------------------------------- */ void TkCreateExitHandler( Tcl_ExitProc *proc, /* Function to invoke. */ void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; Tcl_MutexLock(&exitMutex); |
︙ | ︙ | |||
2003 2004 2005 2006 2007 2008 2009 | /* *---------------------------------------------------------------------- * * TkFinalize -- * * Runs our private exit handlers and removes itself from Tcl. This is | | | 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 | /* *---------------------------------------------------------------------- * * TkFinalize -- * * Runs our private exit handlers and removes itself from Tcl. This is * beneficial should we want to protect from dangling pointers should the * Tk shared library be unloaded prior to Tcl which can happen on windows * should the process be forcefully exiting from an exception handler. * * Results: * None. * * Side effects. |
︙ | ︙ |
Changes to generic/tkFileFilter.c.
1 2 3 4 5 6 | /* * tkFileFilter.c -- * * Process the -filetypes option for the file dialogs on Windows and the * Mac. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkFileFilter.c -- * * Process the -filetypes option for the file dialogs on Windows and the * Mac. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkFileFilter.h" |
︙ | ︙ | |||
259 260 261 262 263 264 265 | * Might be cleaner to use 'Tcl_GetOSTypeFromObj' but that is actually * static to the MacOS X/Darwin version of Tcl, and would therefore * require further code refactoring. */ for (i=0; i<ostypeCount; i++) { TkSizeT len; | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | * Might be cleaner to use 'Tcl_GetOSTypeFromObj' but that is actually * static to the MacOS X/Darwin version of Tcl, and would therefore * require further code refactoring. */ for (i=0; i<ostypeCount; i++) { TkSizeT len; const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len); /* * If len is < 4, it is definitely an error. If equal or longer, * we need to use the macRoman encoding to determine the correct * length (assuming there may be non-ascii characters, e.g., * embedded nulls or accented characters in the string, the * macRoman length will be different). |
︙ | ︙ | |||
282 283 284 285 286 287 288 | Tcl_DString osTypeDS; /* * Convert utf to macRoman, since MacOS types are defined to * be 4 macRoman characters long */ | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | Tcl_DString osTypeDS; /* * Convert utf to macRoman, since MacOS types are defined to * be 4 macRoman characters long */ (void)Tcl_UtfToExternalDStringEx(macRoman, strType, len, TCL_ENCODING_NOCOMPLAIN, &osTypeDS); len = Tcl_DStringLength(&osTypeDS); Tcl_DStringFree(&osTypeDS); } if (len != 4) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad Macintosh file type \"%s\"", Tcl_GetString(ostypeList[i]))); |
︙ | ︙ | |||
319 320 321 322 323 324 325 | } clausePtr->next = NULL; if (globCount > 0 && globList != NULL) { for (i=0; i<globCount; i++) { GlobPattern *globPtr = (GlobPattern *)ckalloc(sizeof(GlobPattern)); TkSizeT len; | | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | } clausePtr->next = NULL; if (globCount > 0 && globList != NULL) { for (i=0; i<globCount; i++) { GlobPattern *globPtr = (GlobPattern *)ckalloc(sizeof(GlobPattern)); TkSizeT len; const char *str = Tcl_GetStringFromObj(globList[i], &len); len = (len + 1) * sizeof(char); if (str[0] && str[0] != '*') { /* * Prepend a "*" to patterns that do not have a leading "*" */ |
︙ | ︙ | |||
373 374 375 376 377 378 379 | if (macRoman == NULL) { macRoman = Tcl_GetEncoding(NULL, "macRoman"); } for (i=0; i<ostypeCount; i++) { Tcl_DString osTypeDS; TkSizeT len; MacFileType *mfPtr = (MacFileType *)ckalloc(sizeof(MacFileType)); | | | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | if (macRoman == NULL) { macRoman = Tcl_GetEncoding(NULL, "macRoman"); } for (i=0; i<ostypeCount; i++) { Tcl_DString osTypeDS; TkSizeT len; MacFileType *mfPtr = (MacFileType *)ckalloc(sizeof(MacFileType)); const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len); char *string; /* * Convert utf to macRoman, since MacOS types are defined to be 4 * macRoman characters long */ (void)Tcl_UtfToExternalDStringEx(macRoman, strType, len, TCL_ENCODING_NOCOMPLAIN, &osTypeDS); string = Tcl_DStringValue(&osTypeDS); mfPtr->type = (OSType) string[0] << 24 | (OSType) string[1] << 16 | (OSType) string[2] << 8 | (OSType) string[3]; Tcl_DStringFree(&osTypeDS); /* * Add the Mac type pattern into the list of Mac types |
︙ | ︙ |
Changes to generic/tkFileFilter.h.
1 2 3 4 5 6 | /* * tkFileFilter.h -- * * Declarations for the file filter processing routines needed by the * file selection dialogs. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkFileFilter.h -- * * Declarations for the file filter processing routines needed by the * file selection dialogs. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TK_FILE_FILTER #define _TK_FILE_FILTER |
︙ | ︙ |
Changes to generic/tkFocus.c.
1 2 3 4 5 | /* * tkFocus.c -- * * This file contains functions that manage the input focus for Tk. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkFocus.c -- * * This file contains functions that manage the input focus for Tk. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
311 312 313 314 315 316 317 | * Skip FocusIn events that cause confusion * NotifyVirtual and NotifyNonlinearVirtual - Virtual events occur on * windows in between the origin and destination of the focus * change. For FocusIn we may see this when focus goes into an * embedded child. We don't care about this, although we may end * up getting a NotifyPointer later. * NotifyInferior - focus is coming to us from an embedded child. When | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | * Skip FocusIn events that cause confusion * NotifyVirtual and NotifyNonlinearVirtual - Virtual events occur on * windows in between the origin and destination of the focus * change. For FocusIn we may see this when focus goes into an * embedded child. We don't care about this, although we may end * up getting a NotifyPointer later. * NotifyInferior - focus is coming to us from an embedded child. When * focus is on an embedded focus, we still think we have the * focus, too, so this message doesn't change our state. * NotifyPointerRoot - should never happen because this is sent to the * root window. * * Interesting FocusIn events are * NotifyAncestor - focus is coming from our parent, probably the root. * NotifyNonlinear - focus is coming from a different branch, probably |
︙ | ︙ | |||
365 366 367 368 369 370 371 | retValue = 1; if (eventPtr->xcrossing.detail == NotifyInferior) { return retValue; } } /* | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | retValue = 1; if (eventPtr->xcrossing.detail == NotifyInferior) { return retValue; } } /* * If winPtr isn't a top-level window then just ignore the event. */ winPtr = TkWmFocusToplevel(winPtr); if (winPtr == NULL) { return retValue; } |
︙ | ︙ | |||
632 633 634 635 636 637 638 | if (topLevelPtr->flags & TK_EMBEDDED && (displayFocusPtr->focusWinPtr == NULL)) { /* * We are assigning focus to an embedded toplevel. The platform * specific function TkpClaimFocus needs to handle the job of * assigning focus to the container, since we have no way to find the | | | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | if (topLevelPtr->flags & TK_EMBEDDED && (displayFocusPtr->focusWinPtr == NULL)) { /* * We are assigning focus to an embedded toplevel. The platform * specific function TkpClaimFocus needs to handle the job of * assigning focus to the container, since we have no way to find the * container. */ TkpClaimFocus(topLevelPtr, force); } else if ((displayFocusPtr->focusWinPtr != NULL) || force) { /* * If we are forcing removal of focus from a container hosting a |
︙ | ︙ | |||
809 810 811 812 813 814 815 816 817 818 819 820 821 822 | TkFocusDeadWindow( TkWindow *winPtr) /* Information about the window that is being * deleted. */ { ToplevelFocusInfo *tlFocusPtr, *prevPtr; DisplayFocusInfo *displayFocusPtr; TkDisplay *dispPtr = winPtr->dispPtr; /* * Certain special windows like those used for send and clipboard have no * mainPtr. */ if (winPtr->mainPtr == NULL) { | > | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | TkFocusDeadWindow( TkWindow *winPtr) /* Information about the window that is being * deleted. */ { ToplevelFocusInfo *tlFocusPtr, *prevPtr; DisplayFocusInfo *displayFocusPtr; TkDisplay *dispPtr = winPtr->dispPtr; int noMatch = 1; /* * Certain special windows like those used for send and clipboard have no * mainPtr. */ if (winPtr->mainPtr == NULL) { |
︙ | ︙ | |||
852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | } if (prevPtr == NULL) { winPtr->mainPtr->tlFocusPtr = tlFocusPtr->nextPtr; } else { prevPtr->nextPtr = tlFocusPtr->nextPtr; } ckfree(tlFocusPtr); break; } else if (winPtr == tlFocusPtr->focusWinPtr) { /* * The deleted window had the focus for its top-level: move the * focus to the top-level itself. */ tlFocusPtr->focusWinPtr = tlFocusPtr->topLevelPtr; if ((displayFocusPtr->focusWinPtr == winPtr) && !(tlFocusPtr->topLevelPtr->flags & TK_ALREADY_DEAD)) { DEBUG(dispPtr, ("forwarding focus to %s after %s died\n", tlFocusPtr->topLevelPtr->pathName, winPtr->pathName)); GenerateFocusEvents(displayFocusPtr->focusWinPtr, tlFocusPtr->topLevelPtr); displayFocusPtr->focusWinPtr = tlFocusPtr->topLevelPtr; dispPtr->focusPtr = tlFocusPtr->topLevelPtr; } break; } } /* * Occasionally, things can become unsynchronized. Move them back into * synch now. [Bug 2496114] */ if (displayFocusPtr->focusWinPtr == winPtr) { DEBUG(dispPtr, ("focus cleared after %s died\n", winPtr->pathName)); displayFocusPtr->focusWinPtr = NULL; } if (displayFocusPtr->focusOnMapPtr == winPtr) { displayFocusPtr->focusOnMapPtr = NULL; } } /* *---------------------------------------------------------------------- * * GenerateFocusEvents -- * | > > > > > > > > > > > | 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | } if (prevPtr == NULL) { winPtr->mainPtr->tlFocusPtr = tlFocusPtr->nextPtr; } else { prevPtr->nextPtr = tlFocusPtr->nextPtr; } ckfree(tlFocusPtr); noMatch = 0; break; } else if (winPtr == tlFocusPtr->focusWinPtr) { /* * The deleted window had the focus for its top-level: move the * focus to the top-level itself. */ tlFocusPtr->focusWinPtr = tlFocusPtr->topLevelPtr; if ((displayFocusPtr->focusWinPtr == winPtr) && !(tlFocusPtr->topLevelPtr->flags & TK_ALREADY_DEAD)) { DEBUG(dispPtr, ("forwarding focus to %s after %s died\n", tlFocusPtr->topLevelPtr->pathName, winPtr->pathName)); GenerateFocusEvents(displayFocusPtr->focusWinPtr, tlFocusPtr->topLevelPtr); displayFocusPtr->focusWinPtr = tlFocusPtr->topLevelPtr; dispPtr->focusPtr = tlFocusPtr->topLevelPtr; } noMatch = 0; break; } } /* * Occasionally, things can become unsynchronized. Move them back into * synch now. [Bug 2496114] */ if (displayFocusPtr->focusWinPtr == winPtr) { DEBUG(dispPtr, ("focus cleared after %s died\n", winPtr->pathName)); displayFocusPtr->focusWinPtr = NULL; } if (displayFocusPtr->focusOnMapPtr == winPtr) { displayFocusPtr->focusOnMapPtr = NULL; } /* * It may happen that the search above for focus records that refer * to this window did not find any match. In such a case, when the * dead window had the focus, release it. */ if (noMatch && (dispPtr->focusPtr == winPtr)) { dispPtr->focusPtr = NULL; } } /* *---------------------------------------------------------------------- * * GenerateFocusEvents -- * |
︙ | ︙ | |||
1163 1164 1165 1166 1167 1168 1169 | } /* *---------------------------------------------------------------------- * * TkFocusJoin -- * | | | 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 | } /* *---------------------------------------------------------------------- * * TkFocusJoin -- * * Remove the focus record for this window that is no longer managed * * Results: * None. * * Side effects: * A tlFocusPtr record is removed * |
︙ | ︙ |
Changes to generic/tkFont.c.
1 2 3 4 5 6 | /* * tkFont.c -- * * This file maintains a database of fonts for the Tk toolkit. It also * provides several utility functions for measuring and displaying text. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkFont.c -- * * This file maintains a database of fonts for the Tk toolkit. It also * provides several utility functions for measuring and displaying text. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkFont.h" |
︙ | ︙ | |||
729 730 731 732 733 734 735 | "font ?-displayof window? text"); return TCL_ERROR; } tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]); if (tkfont == NULL) { return TCL_ERROR; } | | | | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | "font ?-displayof window? text"); return TCL_ERROR; } tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]); if (tkfont == NULL) { return TCL_ERROR; } string = Tcl_GetStringFromObj(objv[3 + skip], &length); Tcl_SetObjResult(interp, Tcl_NewWideIntObj( Tk_TextWidth(tkfont, string, length))); Tk_FreeFont(tkfont); break; } case FONT_METRICS: { Tk_Font tkfont; int skip, i; const TkFontMetrics *fmPtr; static const char *const switches[] = { "-ascent", "-descent", "-fixed", "-linespace", NULL }; skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin); if (skip < 0) { return TCL_ERROR; } if ((objc < 3) || ((objc - skip) > 4)) { |
︙ | ︙ | |||
774 775 776 777 778 779 780 | Tk_FreeFont(tkfont); return TCL_ERROR; } i = 0; /* Needed only to prevent compiler warning. */ switch (index) { case 0: i = fmPtr->ascent; break; case 1: i = fmPtr->descent; break; | | | | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | Tk_FreeFont(tkfont); return TCL_ERROR; } i = 0; /* Needed only to prevent compiler warning. */ switch (index) { case 0: i = fmPtr->ascent; break; case 1: i = fmPtr->descent; break; case 2: i = fmPtr->fixed; break; case 3: i = fmPtr->ascent + fmPtr->descent; break; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(i)); } Tk_FreeFont(tkfont); break; } case FONT_NAMES: { |
︙ | ︙ | |||
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | static void RecomputeWidgets( TkWindow *winPtr) /* Window to which command is sent. */ { Tk_ClassWorldChangedProc *proc = Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc); if (proc != NULL) { proc(winPtr->instanceData); } /* * Notify all the descendants of this window that the world has changed. * * This could be done recursively or iteratively. The recursive version is * easier to implement and understand, and typically, windows with a -font | > | | | | | | | > > > > > > > | 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | static void RecomputeWidgets( TkWindow *winPtr) /* Window to which command is sent. */ { Tk_ClassWorldChangedProc *proc = Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc); TkWindow *tkwinPtr; if (proc != NULL) { proc(winPtr->instanceData); } /* * Notify all the descendants of this window that the world has changed. * * This could be done recursively or iteratively. The recursive version is * easier to implement and understand, and typically, windows with a -font * option will be leaf nodes in the widget hierarchy (buttons, labels, * etc.), so the recursion depth will be shallow. * * However, the additional overhead of the recursive calls may become a * performance problem if typical usage alters such that -font'ed widgets * appear high in the hierarchy, causing deep recursion. This could happen * with text widgets, or more likely with the labelframe * widget. With these widgets it is possible, even likely, that a * -font'ed widget (text or labelframe) will not be a leaf node, but * will instead have many descendants. If this is ever found to cause a * performance problem, it may be worth investigating an iterative version * of the code below. */ for (tkwinPtr=winPtr->childList ; tkwinPtr!=NULL ; tkwinPtr=tkwinPtr->nextPtr) { RecomputeWidgets(tkwinPtr); } /* * Broadcast font change virtually for mega-widget layout managers. * Do this after the font change has been propagated to core widgets. */ Tk_SendVirtualEvent((Tk_Window)winPtr, "TkWorldChanged", Tcl_NewStringObj("FontChanged",-1)); } /* *--------------------------------------------------------------------------- * * TkCreateNamedFont -- * |
︙ | ︙ | |||
2467 2468 2469 2470 2471 2472 2473 | Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context to use for drawing text. */ Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ int underline) /* Index of the single character to underline, | | | 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 | Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context to use for drawing text. */ Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ int underline) /* Index of the single character to underline, * or INT_MIN for no underline. */ { int xx, yy, width, height; if ((Tk_CharBbox(layout, underline, &xx, &yy, &width, &height) != 0) && (width != 0)) { TextLayout *layoutPtr = (TextLayout *) layout; TkFont *fontPtr = (TkFont *) layoutPtr->tkfont; |
︙ | ︙ | |||
2494 2495 2496 2497 2498 2499 2500 | * text. */ Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ double angle, int underline) /* Index of the single character to underline, | | | 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 | * text. */ Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ double angle, int underline) /* Index of the single character to underline, * or INT_MIN for no underline. */ { int xx, yy, width, height; if (angle == 0.0) { Tk_UnderlineTextLayout(display, drawable, gc, layout, x,y, underline); return; } |
︙ | ︙ | |||
2722 2723 2724 2725 2726 2727 2728 | */ int Tk_CharBbox( Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ int index, /* The index of the character whose bbox is | | > > > > | > | 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 | */ int Tk_CharBbox( Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ int index, /* The index of the character whose bbox is * desired. Negative means count backwards. */ int *xPtr, int *yPtr, /* Filled with the upper-left hand corner, in * pixels, of the bounding box for the * character specified by index, if * non-NULL. */ int *widthPtr, int *heightPtr) /* Filled with the width and height of the * bounding box for the character specified by * index, if non-NULL. */ { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr = layoutPtr->chunks; int i, x = 0, w; Tk_Font tkfont; TkFont *fontPtr; const char *end; if (index < 0) { for (i = 0; i < layoutPtr->numChunks; i++) { index += (chunkPtr + i)->numChars; } if (index < 0) { return 0; } } tkfont = layoutPtr->tkfont; fontPtr = (TkFont *) tkfont; for (i = 0; i < layoutPtr->numChunks; i++) { if (chunkPtr->numDisplayChars < 0) { |
︙ | ︙ | |||
3340 3341 3342 3343 3344 3345 3346 | if (ch > 0xffff) { goto noMapping; } sprintf(uindex, "%04X", ch); /* endianness? */ glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0); if (glyphname) { | | | 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 | if (ch > 0xffff) { goto noMapping; } sprintf(uindex, "%04X", ch); /* endianness? */ glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0); if (glyphname) { ps = Tcl_GetStringFromObj(psObj, &len); if (ps[len-1] == '(') { /* * In-place edit. Ewww! */ ps[len-1] = '/'; } else { |
︙ | ︙ | |||
3654 3655 3656 3657 3658 3659 3660 | Tcl_Obj *objPtr, /* Parseable font description object. */ TkFontAttributes *faPtr) /* Filled with attributes parsed from font * name. Any attributes that were not * specified in font name are filled with * default values. */ { const char *dash; | | > | 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 | Tcl_Obj *objPtr, /* Parseable font description object. */ TkFontAttributes *faPtr) /* Filled with attributes parsed from font * name. Any attributes that were not * specified in font name are filled with * default values. */ { const char *dash; int result, n; TkSizeT objc, i; Tcl_Obj **objv; const char *string; TkInitFontAttributes(faPtr); string = Tcl_GetString(objPtr); if (*string == '-') { |
︙ | ︙ |
Changes to generic/tkFont.h.
1 2 3 4 5 6 7 | /* * tkFont.h -- * * Declarations for interfaces between the generic and platform-specific * parts of the font package. This information is not visible outside of * the font package. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkFont.h -- * * Declarations for interfaces between the generic and platform-specific * parts of the font package. This information is not visible outside of * the font package. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKFONT #define _TKFONT |
︙ | ︙ |
Changes to generic/tkFrame.c.
1 2 3 4 5 6 7 | /* * tkFrame.c -- * * This module implements "frame", "labelframe" and "toplevel" widgets * for the Tk toolkit. Frames are windows with a background color and * possibly a 3-D effect, but not much else in the way of attributes. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkFrame.c -- * * This module implements "frame", "labelframe" and "toplevel" widgets * for the Tk toolkit. Frames are windows with a background color and * possibly a 3-D effect, but not much else in the way of attributes. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "default.h" |
︙ | ︙ | |||
326 327 328 329 330 331 332 | * Forward declarations for functions defined later in this file: */ static void ComputeFrameGeometry(Frame *framePtr); static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, int objc, Tcl_Obj *const objv[]); static int CreateFrame(ClientData clientData, Tcl_Interp *interp, | | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | * Forward declarations for functions defined later in this file: */ static void ComputeFrameGeometry(Frame *framePtr); static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, int objc, Tcl_Obj *const objv[]); static int CreateFrame(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], enum FrameType type, const char *appName); static void DestroyFrame(void *memPtr); static void DestroyFramePartly(Frame *framePtr); static void DisplayFrame(ClientData clientData); static void DrawFrameBackground(Tk_Window tkwin, Pixmap pixmap, int highlightWidth, int borderWidth, Tk_Image bgimg, int bgtile); |
︙ | ︙ | |||
485 486 487 488 489 490 491 | int toplevel, /* Non-zero means create a toplevel window, * zero means create a frame. */ Tcl_Obj *nameObj) /* Should only be non-NULL if there is no main * window associated with the interpreter. * Gives the base name to use for the new * application. */ { | | | 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | int toplevel, /* Non-zero means create a toplevel window, * zero means create a frame. */ Tcl_Obj *nameObj) /* Should only be non-NULL if there is no main * window associated with the interpreter. * Gives the base name to use for the new * application. */ { TkSizeT objc; Tcl_Obj **objv; if (TCL_OK != Tcl_ListObjGetElements(interp, listObj, &objc, &objv)) { return TCL_ERROR; } return CreateFrame(clientData, interp, objc, objv, toplevel ? TYPE_TOPLEVEL : TYPE_FRAME, |
︙ | ︙ | |||
543 544 545 546 547 548 549 | * be processed specially, before the window is configured using the usual * Tk mechanisms. */ className = colormapName = screenName = visualName = useOption = NULL; colormap = None; for (i = 2; i < objc; i += 2) { | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | * be processed specially, before the window is configured using the usual * Tk mechanisms. */ className = colormapName = screenName = visualName = useOption = NULL; colormap = None; for (i = 2; i < objc; i += 2) { arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { continue; } if ((arg[1] == 'c') && (length >= 3) && (strncmp(arg, "-class", length) == 0)) { className = Tcl_GetString(objv[i+1]); } else if ((arg[1] == 'c') && (length >= 3) |
︙ | ︙ | |||
575 576 577 578 579 580 581 | * before calling ConfigureFrame below, and they must also be processed in * a particular order, for the following reasons: * 1. Must set the window's class before calling ConfigureFrame, so that * unspecified options are looked up in the option database using the * correct class. * 2. Must set visual information before calling ConfigureFrame so that * colors are allocated in a proper colormap. | | | | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | * before calling ConfigureFrame below, and they must also be processed in * a particular order, for the following reasons: * 1. Must set the window's class before calling ConfigureFrame, so that * unspecified options are looked up in the option database using the * correct class. * 2. Must set visual information before calling ConfigureFrame so that * colors are allocated in a proper colormap. * 3. Must call Tk_UseWindow before setting non-default visual * information, since Tk_UseWindow changes the defaults. */ if (screenName == NULL) { screenName = (type == TYPE_TOPLEVEL) ? "" : NULL; } /* |
︙ | ︙ | |||
630 631 632 633 634 635 636 | } } Tk_SetClass(newWin, className); if (useOption == NULL) { useOption = Tk_GetOption(newWin, "use", "Use"); } if ((useOption != NULL) && (*useOption != 0) | | | 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | } } Tk_SetClass(newWin, className); if (useOption == NULL) { useOption = Tk_GetOption(newWin, "use", "Use"); } if ((useOption != NULL) && (*useOption != 0) && (Tk_UseWindow(interp, newWin, useOption) != TCL_OK)) { goto error; } if (visualName == NULL) { visualName = Tk_GetOption(newWin, "visual", "Visual"); } if (colormapName == NULL) { colormapName = Tk_GetOption(newWin, "colormap", "Colormap"); |
︙ | ︙ | |||
723 724 725 726 727 728 729 | if (framePtr->useThis != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "windows cannot have both the -use and the -container" " option set", -1)); Tcl_SetErrorCode(interp, "TK", "FRAME", "CONTAINMENT", NULL); goto error; } | | | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | if (framePtr->useThis != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "windows cannot have both the -use and the -container" " option set", -1)); Tcl_SetErrorCode(interp, "TK", "FRAME", "CONTAINMENT", NULL); goto error; } Tk_MakeContainer(framePtr->tkwin); } if (type == TYPE_TOPLEVEL) { Tcl_DoWhenIdle(MapFrame, framePtr); } Tcl_SetObjResult(interp, Tk_NewWindowObj(newWin)); return TCL_OK; |
︙ | ︙ | |||
816 817 818 819 820 821 822 | } else { /* * Don't allow the options -class, -colormap, -container, -screen, * -use, or -visual to be changed. */ for (i = 2; i < objc; i++) { | | | | | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | } else { /* * Don't allow the options -class, -colormap, -container, -screen, * -use, or -visual to be changed. */ for (i = 2; i < objc; i++) { const char *arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { continue; } c = arg[1]; if (((c == 'c') && (length >= 2) && (strncmp(arg, "-class", length) == 0)) || ((c == 'c') && (length >= 3) && (strncmp(arg, "-colormap", length) == 0)) || ((c == 'c') && (length >= 3) && (strncmp(arg, "-container", length) == 0)) || ((c == 's') && (framePtr->type == TYPE_TOPLEVEL) && (strncmp(arg, "-screen", length) == 0)) || ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL) && (strncmp(arg, "-use", length) == 0)) || ((c == 'v') && (strncmp(arg, "-visual", length) == 0))) { #ifdef _WIN32 if (c == 'u') { const char *string = Tcl_GetString(objv[i+1]); if (Tk_UseWindow(interp, framePtr->tkwin, string) != TCL_OK) { result = TCL_ERROR; goto done; } continue; } #endif |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | */ if ((((oldMenuName == NULL) && (framePtr->menuName != NULL)) || ((oldMenuName != NULL) && (framePtr->menuName == NULL)) || ((oldMenuName != NULL) && (framePtr->menuName != NULL) && strcmp(oldMenuName, framePtr->menuName) != 0)) && framePtr->type == TYPE_TOPLEVEL) { | | | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | */ if ((((oldMenuName == NULL) && (framePtr->menuName != NULL)) || ((oldMenuName != NULL) && (framePtr->menuName == NULL)) || ((oldMenuName != NULL) && (framePtr->menuName != NULL) && strcmp(oldMenuName, framePtr->menuName) != 0)) && framePtr->type == TYPE_TOPLEVEL) { Tk_SetWindowMenubar(interp, framePtr->tkwin, oldMenuName, framePtr->menuName); } if (oldMenuName != NULL) { ckfree(oldMenuName); } |
︙ | ︙ | |||
1498 1499 1500 1501 1502 1503 1504 | GC fgGC, bgGC; bgGC = Tk_GCForColor(framePtr->highlightBgColorPtr, Tk_WindowId(tkwin)); if (framePtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(framePtr->highlightColorPtr, Tk_WindowId(tkwin)); | | | | 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 | GC fgGC, bgGC; bgGC = Tk_GCForColor(framePtr->highlightBgColorPtr, Tk_WindowId(tkwin)); if (framePtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(framePtr->highlightColorPtr, Tk_WindowId(tkwin)); Tk_DrawHighlightBorder(tkwin, fgGC, bgGC, hlWidth, Tk_WindowId(tkwin)); } else { Tk_DrawHighlightBorder(tkwin, bgGC, bgGC, hlWidth, Tk_WindowId(tkwin)); } } /* * If -background is set to "", no interior is drawn. */ |
︙ | ︙ | |||
1743 1744 1745 1746 1747 1748 1749 | if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; } else if (eventPtr->type == ConfigureNotify) { ComputeFrameGeometry(framePtr); goto redraw; } else if (eventPtr->type == DestroyNotify) { if (framePtr->menuName != NULL) { | | | 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 | if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; } else if (eventPtr->type == ConfigureNotify) { ComputeFrameGeometry(framePtr); goto redraw; } else if (eventPtr->type == DestroyNotify) { if (framePtr->menuName != NULL) { Tk_SetWindowMenubar(framePtr->interp, framePtr->tkwin, framePtr->menuName, NULL); ckfree(framePtr->menuName); framePtr->menuName = NULL; } if (framePtr->tkwin != NULL) { /* * If this window is a container, then this event could be coming |
︙ | ︙ | |||
1792 1793 1794 1795 1796 1797 1798 | if (eventPtr->xfocus.detail != NotifyInferior) { framePtr->flags &= ~GOT_FOCUS; if (framePtr->highlightWidth > 0) { goto redraw; } } } else if (eventPtr->type == ActivateNotify) { | | | 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 | if (eventPtr->xfocus.detail != NotifyInferior) { framePtr->flags &= ~GOT_FOCUS; if (framePtr->highlightWidth > 0) { goto redraw; } } } else if (eventPtr->type == ActivateNotify) { Tk_SetMainMenubar(framePtr->interp, framePtr->tkwin, framePtr->menuName); } return; redraw: if ((framePtr->tkwin != NULL) && !(framePtr->flags & REDRAW_PENDING)) { Tcl_DoWhenIdle(DisplayFrame, framePtr); |
︙ | ︙ | |||
1830 1831 1832 1833 1834 1835 1836 | FrameCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { Frame *framePtr = (Frame *)clientData; Tk_Window tkwin = framePtr->tkwin; if (framePtr->menuName != NULL) { | | | 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 | FrameCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { Frame *framePtr = (Frame *)clientData; Tk_Window tkwin = framePtr->tkwin; if (framePtr->menuName != NULL) { Tk_SetWindowMenubar(framePtr->interp, framePtr->tkwin, framePtr->menuName, NULL); ckfree(framePtr->menuName); framePtr->menuName = NULL; } /* * This function could be invoked either because the window was destroyed |
︙ | ︙ | |||
2064 2065 2066 2067 2068 2069 2070 | Frame *framePtr = (Frame *)((TkWindow *) tkwin)->instanceData; Tk_OptionTable optionTable; if (Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_FRAME) { framePtr->type = TYPE_TOPLEVEL; Tcl_DoWhenIdle(MapFrame, framePtr); if (framePtr->menuName != NULL) { | | | 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 | Frame *framePtr = (Frame *)((TkWindow *) tkwin)->instanceData; Tk_OptionTable optionTable; if (Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_FRAME) { framePtr->type = TYPE_TOPLEVEL; Tcl_DoWhenIdle(MapFrame, framePtr); if (framePtr->menuName != NULL) { Tk_SetWindowMenubar(framePtr->interp, framePtr->tkwin, NULL, framePtr->menuName); } } else if (!Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_TOPLEVEL) { framePtr->type = TYPE_FRAME; } else { /* * Not a frame or toplevel, skip it. |
︙ | ︙ |
Changes to generic/tkGC.c.
1 2 3 4 5 6 | /* * tkGC.c -- * * This file maintains a database of read-only graphics contexts for the * Tk toolkit, in order to allow GC's to be shared. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkGC.c -- * * This file maintains a database of read-only graphics contexts for the * Tk toolkit, in order to allow GC's to be shared. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to generic/tkGeometry.c.
1 2 3 4 5 6 | /* * tkGeometry.c -- * * This file contains generic Tk code for geometry management (stuff * that's used by all geometry managers). * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkGeometry.c -- * * This file contains generic Tk code for geometry management (stuff * that's used by all geometry managers). * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
557 558 559 560 561 562 563 | * container, then this procedure has no effect. * *---------------------------------------------------------------------- */ void Tk_UnmaintainGeometry( | | | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | * container, then this procedure has no effect. * *---------------------------------------------------------------------- */ void Tk_UnmaintainGeometry( Tk_Window window, /* Window for geometry management. */ Tk_Window container) /* Container for window; must be a descendant of * window's parent. */ { Tcl_HashEntry *hPtr; MaintainContainer *containerPtr; MaintainContent *contentPtr, *prevPtr; Tk_Window ancestor; |
︙ | ︙ |
Changes to generic/tkGet.c.
1 2 3 4 5 6 7 8 | /* * tkGet.c -- * * This file contains a number of "Tk_GetXXX" procedures, which parse * text strings into useful forms for Tk. This file has the simpler * functions, like Tk_GetDirection and Tk_GetUid. The more complex * functions like Tk_GetColor are in separate files. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkGet.c -- * * This file contains a number of "Tk_GetXXX" procedures, which parse * text strings into useful forms for Tk. This file has the simpler * functions, like Tk_GetDirection and Tk_GetUid. The more complex * functions like Tk_GetColor are in separate files. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
31 32 33 34 35 36 37 | static void FreeUidThreadExitProc(ClientData clientData); /* * The following tables defines the string values for reliefs, which are * used by Tk_GetAnchorFromObj and Tk_GetJustifyFromObj. */ | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | static void FreeUidThreadExitProc(ClientData clientData); /* * The following tables defines the string values for reliefs, which are * used by Tk_GetAnchorFromObj and Tk_GetJustifyFromObj. */ const char *const tkAnchorStrings[] = { "n", "ne", "e", "se", "s", "sw", "w", "nw", "center", NULL }; const char *const tkJustifyStrings[] = { "left", "right", "center", NULL }; /* *---------------------------------------------------------------------- * * Tk_GetAnchorFromObj -- |
︙ | ︙ | |||
67 68 69 70 71 72 73 | * from. */ Tk_Anchor *anchorPtr) /* Where to place the Tk_Anchor that * corresponds to the string value of * objPtr. */ { int index, code; | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | * from. */ Tk_Anchor *anchorPtr) /* Where to place the Tk_Anchor that * corresponds to the string value of * objPtr. */ { int index, code; code = Tcl_GetIndexFromObj(interp, objPtr, tkAnchorStrings, "anchor", 0, &index); if (code == TCL_OK) { *anchorPtr = (Tk_Anchor) index; } return code; } |
︙ | ︙ | |||
186 187 188 189 190 191 192 193 194 195 196 197 198 199 | case TK_ANCHOR_E: return "e"; case TK_ANCHOR_SE: return "se"; case TK_ANCHOR_S: return "s"; case TK_ANCHOR_SW: return "sw"; case TK_ANCHOR_W: return "w"; case TK_ANCHOR_NW: return "nw"; case TK_ANCHOR_CENTER: return "center"; } return "unknown anchor position"; } /* *-------------------------------------------------------------- * | > | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | case TK_ANCHOR_E: return "e"; case TK_ANCHOR_SE: return "se"; case TK_ANCHOR_S: return "s"; case TK_ANCHOR_SW: return "sw"; case TK_ANCHOR_W: return "w"; case TK_ANCHOR_NW: return "nw"; case TK_ANCHOR_CENTER: return "center"; case TK_ANCHOR_NULL: return ""; } return "unknown anchor position"; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
381 382 383 384 385 386 387 | * from. */ Tk_Justify *justifyPtr) /* Where to place the Tk_Justify that * corresponds to the string value of * objPtr. */ { int index, code; | | | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | * from. */ Tk_Justify *justifyPtr) /* Where to place the Tk_Justify that * corresponds to the string value of * objPtr. */ { int index, code; code = Tcl_GetIndexFromObj(interp, objPtr, tkJustifyStrings, "justification", 0, &index); if (code == TCL_OK) { *justifyPtr = (Tk_Justify) index; } return code; } |
︙ | ︙ | |||
467 468 469 470 471 472 473 474 475 476 477 478 479 480 | Tk_Justify justify) /* Justification style for which identifying * string is desired. */ { switch (justify) { case TK_JUSTIFY_LEFT: return "left"; case TK_JUSTIFY_RIGHT: return "right"; case TK_JUSTIFY_CENTER: return "center"; } return "unknown justification style"; } /* *---------------------------------------------------------------------- * | > | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | Tk_Justify justify) /* Justification style for which identifying * string is desired. */ { switch (justify) { case TK_JUSTIFY_LEFT: return "left"; case TK_JUSTIFY_RIGHT: return "right"; case TK_JUSTIFY_CENTER: return "center"; case TK_JUSTIFY_NULL: return ""; } return "unknown justification style"; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
690 691 692 693 694 695 696 697 698 699 700 701 702 703 | * units. */ const char *string, /* String describing a number of pixels. */ double *doublePtr) /* Place to store converted result. */ { char *end; double d; d = strtod((char *) string, &end); if (end == string) { goto error; } while ((*end != '\0') && isspace(UCHAR(*end))) { end++; } | > > > > > | 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | * units. */ const char *string, /* String describing a number of pixels. */ double *doublePtr) /* Place to store converted result. */ { char *end; double d; if (!tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad screen")); Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL); return TCL_ERROR; } d = strtod((char *) string, &end); if (end == string) { goto error; } while ((*end != '\0') && isspace(UCHAR(*end))) { end++; } |
︙ | ︙ |
Changes to generic/tkGrab.c.
1 2 3 4 5 | /* * tkGrab.c -- * * This file provides functions that implement grabs for Tk. * | | | > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* * tkGrab.c -- * * This file provides functions that implement grabs for Tk. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #ifdef _WIN32 #include "tkWinInt.h" #elif !defined(MAC_OSX_TK) #include "tkUnixInt.h" #else #include "tkMacOSXInt.h" #endif /* * The grab state machine has four states: ungrabbed, button pressed, grabbed, * and button pressed while grabbed. In addition, there are three pieces of * grab state information: the current grab window, the current restrict * window, and whether the mouse is captured. * * The current grab window specifies the point in the Tk window hierarchy * above which pointer events will not be reported. Any window within the * subtree below the grab window will continue to receive events as normal. * Events outside of the grab tree will be reported to the grab window. * * If the current restrict window is set, then all pointer events will be * reported only to the restrict window. The restrict window is normally set * during an automatic button grab. |
︙ | ︙ | |||
211 212 213 214 215 216 217 | return TCL_ERROR; } /* * First check for a window name or "-global" as the first argument. */ | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | return TCL_ERROR; } /* * First check for a window name or "-global" as the first argument. */ arg = Tcl_GetStringFromObj(objv[1], &len); if (arg[0] == '.') { /* [grab window] */ if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "?-global? window"); return TCL_ERROR; } tkwin = Tk_NameToWindow(interp, arg, (Tk_Window)clientData); |
︙ | ︙ |
Changes to generic/tkGrid.c.
1 2 3 4 5 | /* * tkGrid.c -- * * Grid based geometry manager. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkGrid.c -- * * Grid based geometry manager. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
979 980 981 982 983 984 985 | { Tk_Window container, content; Gridder *containerPtr, *contentPtr; SlotInfo *slotPtr = NULL; int slot; /* the column or row number */ int slotType; /* COLUMN or ROW */ int size; /* the configuration value */ | | | > | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | { Tk_Window container, content; Gridder *containerPtr, *contentPtr; SlotInfo *slotPtr = NULL; int slot; /* the column or row number */ int slotType; /* COLUMN or ROW */ int size; /* the configuration value */ TkSizeT lObjc; /* Number of items in index list */ Tcl_Obj **lObjv; /* array of indices */ int ok; /* temporary TCL result code */ int i, first, last; TkSizeT j; const char *string; static const char *const optionStrings[] = { "-minsize", "-pad", "-uniform", "-weight", NULL }; enum options { ROWCOL_MINSIZE, ROWCOL_PAD, ROWCOL_UNIFORM, ROWCOL_WEIGHT }; |
︙ | ︙ | |||
2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 | static void DestroyGrid( void *memPtr) /* Info about window that is now dead. */ { Gridder *gridPtr = (Gridder *)memPtr; if (gridPtr->containerDataPtr != NULL) { if (gridPtr->containerDataPtr->rowPtr != NULL) { ckfree(gridPtr->containerDataPtr -> rowPtr); } if (gridPtr->containerDataPtr->columnPtr != NULL) { ckfree(gridPtr->containerDataPtr -> columnPtr); } | > > > | 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 | static void DestroyGrid( void *memPtr) /* Info about window that is now dead. */ { Gridder *gridPtr = (Gridder *)memPtr; if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } if (gridPtr->containerDataPtr != NULL) { if (gridPtr->containerDataPtr->rowPtr != NULL) { ckfree(gridPtr->containerDataPtr -> rowPtr); } if (gridPtr->containerDataPtr->columnPtr != NULL) { ckfree(gridPtr->containerDataPtr -> columnPtr); } |
︙ | ︙ | |||
2982 2983 2984 2985 2986 2987 2988 | */ firstChar = 0; for (numWindows=0, i=0; i < objc; i++) { TkSizeT length; char prevChar = firstChar; | | | 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 | */ firstChar = 0; for (numWindows=0, i=0; i < objc; i++) { TkSizeT length; char prevChar = firstChar; string = Tcl_GetStringFromObj(objv[i], &length); firstChar = string[0]; if (firstChar == '.') { /* * Check that windows are valid, and locate the first content's * parent window (default for -in). */ |
︙ | ︙ |
Added generic/tkIcu.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | /* * tkIcu.c -- * * tkIcu.c implements various Tk commands which can find * grapheme cluster and workchar bounderies in Unicode strings. * * Copyright © 2021 Jan Nijtmans * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_STDINT_H #include <stdint.h> #endif /* * Runtime linking of libicu. */ typedef enum UBreakIteratorTypex { UBRK_CHARACTERX = 0, UBRK_WORDX = 1 } UBreakIteratorTypex; typedef enum UErrorCodex { U_ZERO_ERRORZ = 0 /**< No error, no warning. */ } UErrorCodex; typedef void *(*fn_icu_open)(UBreakIteratorTypex, const char *, const uint16_t *, int32_t, UErrorCodex *); typedef void (*fn_icu_close)(void *); typedef int32_t (*fn_icu_preceding)(void *, int32_t); typedef int32_t (*fn_icu_following)(void *, int32_t); typedef int32_t (*fn_icu_previous)(void *); typedef int32_t (*fn_icu_next)(void *); typedef void (*fn_icu_setText)(void *, const void *, int32_t, UErrorCodex *); static struct { size_t nopen; Tcl_LoadHandle lib; fn_icu_open open; fn_icu_close close; fn_icu_preceding preceding; fn_icu_following following; fn_icu_previous previous; fn_icu_next next; fn_icu_setText setText; } icu_fns = { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; #define FLAG_WORD 1 #define FLAG_FOLLOWING 4 #define FLAG_SPACE 8 #define icu_open icu_fns.open #define icu_close icu_fns.close #define icu_preceding icu_fns.preceding #define icu_following icu_fns.following #define icu_previous icu_fns.previous #define icu_next icu_fns.next #define icu_setText icu_fns.setText TCL_DECLARE_MUTEX(icu_mutex); static int startEndOfCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_DString ds; TkSizeT len; const char *str; UErrorCodex errorCode = U_ZERO_ERRORZ; void *it; TkSizeT idx; int flags = PTR2INT(clientData); const uint16_t *ustr; const char *locale = NULL; if ((unsigned)(objc - 3) > 1) { Tcl_WrongNumArgs(interp, 1 , objv, "str start ?locale?"); return TCL_ERROR; } if (objc > 3) { locale = Tcl_GetString(objv[3]); if (!*locale) { locale = NULL; } } Tcl_DStringInit(&ds); str = Tcl_GetStringFromObj(objv[1], &len); Tcl_UtfToChar16DString(str, len, &ds); len = Tcl_DStringLength(&ds)/2; if (TkGetIntForIndex(objv[2], len-1, 0, &idx) != TCL_OK) { Tcl_DStringFree(&ds); Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "ICU", "INDEX", NULL); return TCL_ERROR; } it = icu_open((UBreakIteratorTypex)(flags&3), locale, NULL, -1, &errorCode); if (it != NULL) { errorCode = U_ZERO_ERRORZ; ustr = (const uint16_t *)Tcl_DStringValue(&ds); icu_setText(it, ustr, len, &errorCode); } if (it == NULL || errorCode != U_ZERO_ERRORZ) { Tcl_DStringFree(&ds); Tcl_SetObjResult(interp, Tcl_ObjPrintf("cannot open ICU iterator, errorcode: %d", (int)errorCode)); Tcl_SetErrorCode(interp, "TK", "ICU", "CANNOTOPEN", NULL); return TCL_ERROR; } if (flags & FLAG_FOLLOWING) { if ((idx == TCL_INDEX_NONE) && (flags & FLAG_WORD)) { idx = 0; } idx = icu_following(it, idx); if ((flags & FLAG_WORD) && idx >= len) { idx = -1; } } else if (idx > 0) { if (!(flags & FLAG_WORD)) { idx += 1 + (((ustr[idx]&0xFFC0) == 0xD800) && ((ustr[idx+1]&0xFFC0) == 0xDC00)); } idx = icu_preceding(it, idx); if (idx == 0 && (flags & FLAG_WORD)) { flags &= ~FLAG_WORD; /* If 0 is reached here, don't do a further search */ } } if ((flags & FLAG_WORD) && (idx != TCL_INDEX_NONE)) { if (!(flags & FLAG_SPACE) == ((idx >= len) || Tcl_UniCharIsSpace(ustr[idx]))) { if (flags & FLAG_FOLLOWING) { idx = icu_next(it); if (idx >= len) { idx = TCL_INDEX_NONE; } } else { idx = icu_previous(it); } } else if (idx == 0 && !(flags & FLAG_FOLLOWING)) { idx = TCL_INDEX_NONE; } } icu_close(it); Tcl_DStringFree(&ds); if (idx != TCL_INDEX_NONE) { Tcl_SetObjResult(interp, TkNewIndexObj(idx)); } return TCL_OK; } /* *---------------------------------------------------------------------- * * SysNotifyDeleteCmd -- * * Delete notification and clean up. * * Results: * Window destroyed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void icuCleanup( TCL_UNUSED(void *)) { Tcl_MutexLock(&icu_mutex); if (icu_fns.nopen-- <= 1) { if (icu_fns.lib != NULL) { Tcl_FSUnloadFile(NULL, icu_fns.lib); } memset(&icu_fns, 0, sizeof(icu_fns)); } Tcl_MutexUnlock(&icu_mutex); } void Icu_Init( Tcl_Interp *interp) { Tcl_MutexLock(&icu_mutex); char symbol[24]; char icuversion[4] = "_75"; /* Highest ICU version + 1 */ if (icu_fns.nopen == 0) { int i = 0; Tcl_Obj *nameobj; static const char *iculibs[] = { #if defined(_WIN32) "icuuc??.dll", /* When running under Windows, user-provided */ NULL, "cygicuuc??.dll", /* When running under Cygwin */ #elif defined(__CYGWIN__) "cygicuuc??.dll", #elif defined(MAC_OSX_TCL) "libicuuc.??.dylib", #else "libicuuc.so.??", #endif NULL }; /* Going back down to ICU version 50 */ while ((icu_fns.lib == NULL) && (icuversion[1] >= '5')) { if (icuversion[2]-- < '0') { icuversion[1]--; icuversion[2] = '9'; } #if defined(_WIN32) && !defined(STATIC_BUILD) if (tclStubsPtr->tcl_CreateFileHandler) { /* Running on Cygwin, so try to load the cygwin icu dll */ i = 2; } else #endif i = 0; while (iculibs[i] != NULL) { Tcl_ResetResult(interp); nameobj = Tcl_NewStringObj(iculibs[i], -1); char *nameStr = Tcl_GetString(nameobj); char *p = strchr(nameStr, '?'); if (p != NULL) { memcpy(p, icuversion+1, 2); } Tcl_IncrRefCount(nameobj); if (Tcl_LoadFile(interp, nameobj, NULL, 0, NULL, &icu_fns.lib) == TCL_OK) { if (p == NULL) { icuversion[0] = '\0'; } Tcl_DecrRefCount(nameobj); break; } Tcl_DecrRefCount(nameobj); ++i; } } #if defined(_WIN32) if (icu_fns.lib == NULL) { Tcl_ResetResult(interp); nameobj = Tcl_NewStringObj("icu.dll", -1); Tcl_IncrRefCount(nameobj); if (Tcl_LoadFile(interp, nameobj, NULL, 0, NULL, &icu_fns.lib) == TCL_OK) { icuversion[0] = '\0'; } Tcl_DecrRefCount(nameobj); } if (icu_fns.lib == NULL) { Tcl_ResetResult(interp); nameobj = Tcl_NewStringObj("icuuc.dll", -1); Tcl_IncrRefCount(nameobj); if (Tcl_LoadFile(interp, nameobj, NULL, 0, NULL, &icu_fns.lib) == TCL_OK) { icuversion[0] = '\0'; } Tcl_DecrRefCount(nameobj); } #endif if (icu_fns.lib != NULL) { #define ICU_SYM(name) \ strcpy(symbol, "ubrk_" #name ); \ strcat(symbol, icuversion); \ icu_fns.name = (fn_icu_ ## name) \ Tcl_FindSymbol(NULL, icu_fns.lib, symbol) ICU_SYM(open); ICU_SYM(close); ICU_SYM(preceding); ICU_SYM(following); ICU_SYM(previous); ICU_SYM(next); ICU_SYM(setText); #undef ICU_SYM } } Tcl_MutexUnlock(&icu_mutex); if (icu_fns.lib != NULL) { Tcl_CreateObjCommand(interp, "::tk::startOfCluster", startEndOfCmd, INT2PTR(0), icuCleanup); Tcl_CreateObjCommand(interp, "::tk::startOfNextWord", startEndOfCmd, INT2PTR(FLAG_WORD|FLAG_FOLLOWING), icuCleanup); Tcl_CreateObjCommand(interp, "::tk::startOfPreviousWord", startEndOfCmd, INT2PTR(FLAG_WORD), icuCleanup); Tcl_CreateObjCommand(interp, "::tk::endOfCluster", startEndOfCmd, INT2PTR(FLAG_FOLLOWING), icuCleanup); Tcl_CreateObjCommand(interp, "::tk::endOfWord", startEndOfCmd, INT2PTR(FLAG_WORD|FLAG_FOLLOWING|FLAG_SPACE), icuCleanup); icu_fns.nopen += 5; } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * coding: utf-8 * End: */ |
Changes to generic/tkImage.c.
1 2 3 4 5 6 | /* * tkImage.c -- * * This module implements the image protocol, which allows lots of * different kinds of images to be used in lots of different widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkImage.c -- * * This module implements the image protocol, which allows lots of * different kinds of images to be used in lots of different widgets. * * Copyright © 1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to generic/tkImgBmap.c.
1 2 3 4 5 | /* * tkImgBmap.c -- * * This procedure implements images of type "bitmap" for Tk. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkImgBmap.c -- * * This procedure implements images of type "bitmap" for Tk. * * Copyright © 1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
71 72 73 74 75 76 77 | /* * The type record for bitmap images: */ static int GetByte(Tcl_Channel chan); static int ImgBmapCreate(Tcl_Interp *interp, | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | /* * The type record for bitmap images: */ static int GetByte(Tcl_Channel chan); static int ImgBmapCreate(Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData); static void ImgBmapDisplay(ClientData clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); |
︙ | ︙ | |||
142 143 144 145 146 147 148 | } ParseInfo; /* * Prototypes for procedures used only locally in this file: */ static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp, | | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | } ParseInfo; /* * Prototypes for procedures used only locally in this file: */ static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void ImgBmapCmdDeletedProc(ClientData clientData); static void ImgBmapConfigureInstance(BitmapInstance *instancePtr); static int ImgBmapConfigureModel(BitmapModel *modelPtr, int objc, Tcl_Obj *const objv[], int flags); static int NextBitmapWord(ParseInfo *parseInfoPtr); /* *---------------------------------------------------------------------- * * ImgBmapCreate -- * |
︙ | ︙ | |||
170 171 172 173 174 175 176 | */ static int ImgBmapCreate( Tcl_Interp *interp, /* Interpreter for application containing * image. */ const char *name, /* Name to use for image. */ | | | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | */ static int ImgBmapCreate( Tcl_Interp *interp, /* Interpreter for application containing * image. */ const char *name, /* Name to use for image. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { |
︙ | ︙ | |||
196 197 198 199 200 201 202 | modelPtr->fgUid = NULL; modelPtr->bgUid = NULL; modelPtr->fileString = NULL; modelPtr->dataString = NULL; modelPtr->maskFileString = NULL; modelPtr->maskDataString = NULL; modelPtr->instancePtr = NULL; | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | modelPtr->fgUid = NULL; modelPtr->bgUid = NULL; modelPtr->fileString = NULL; modelPtr->dataString = NULL; modelPtr->maskFileString = NULL; modelPtr->maskDataString = NULL; modelPtr->instancePtr = NULL; if (ImgBmapConfigureModel(modelPtr, objc, objv, 0) != TCL_OK) { ImgBmapDelete(modelPtr); return TCL_ERROR; } *clientDataPtr = modelPtr; return TCL_OK; } |
︙ | ︙ | |||
496 497 498 499 500 501 502 | if ((interp != NULL) && Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get bitmap data from a file in a safe interpreter", -1)); Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL); return NULL; } | | | > > | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | if ((interp != NULL) && Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get bitmap data from a file in a safe interpreter", -1)); Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL); return NULL; } expandedFileName = Tcl_TranslateFileName(NULL, fileName, &buffer); if (expandedFileName == NULL) { Tcl_SetErrno(ENOENT); goto cannotRead; } pi.chan = Tcl_OpenFileChannel(interp, expandedFileName, "r", 0); Tcl_DStringFree(&buffer); if (pi.chan == NULL) { cannotRead: if (interp != NULL) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't read bitmap file \"%s\": %s", fileName, Tcl_PosixError(interp))); } return NULL; |
︙ | ︙ |
Changes to generic/tkImgGIF.c.
1 2 3 4 5 6 7 8 9 10 | /* * tkImgGIF.c -- * * A photo image file handler for GIF files. Reads 87a and 89a GIF files. * At present, there only is a file write function. GIF images may be * read using the -data option of the photo image. The data may be given * as a binary string in a Tcl_Obj or by representing the data as BASE64 * encoded ascii. Derived from the giftoppm code found in the pbmplus * package and tkImgFmtPPM.c in the tk4.0b2 distribution. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tkImgGIF.c -- * * A photo image file handler for GIF files. Reads 87a and 89a GIF files. * At present, there only is a file write function. GIF images may be * read using the -data option of the photo image. The data may be given * as a binary string in a Tcl_Obj or by representing the data as BASE64 * encoded ascii. Derived from the giftoppm code found in the pbmplus * package and tkImgFmtPPM.c in the tk4.0b2 distribution. * * Copyright © Reed Wade ([email protected]), University of Tennessee * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 1997 Australian National University * Copyright © 2005-2010 Donal K. Fellows * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * This file also contains code from the giftoppm program, which is * copyrighted as follows: * |
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #define GIF_SPECIAL (256) #define GIF_PAD (GIF_SPECIAL+1) #define GIF_SPACE (GIF_SPECIAL+2) #define GIF_BAD (GIF_SPECIAL+3) #define GIF_DONE (GIF_SPECIAL+4) /* * structure to "mimic" FILE for Mread, so we can look like fread. The decoder * state keeps track of which byte we are about to read, or EOF. */ typedef struct mFile { unsigned char *data; /* mmencoded source string */ | > > > > > > > > > > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #define GIF_SPECIAL (256) #define GIF_PAD (GIF_SPECIAL+1) #define GIF_SPACE (GIF_SPECIAL+2) #define GIF_BAD (GIF_SPECIAL+3) #define GIF_DONE (GIF_SPECIAL+4) /* * structure to hold the data of a Graphic Control Extension block. */ typedef struct { int blockPresent; /* if 1, the block was read and is in scope */ int transparent; /* Transparency index */ int delayTime; /* update delay time in 10ms */ int disposalMethod; /* disposal method 0-3 */ int userInteraction; /* user interaction 0/1 */ } GIFGraphicControlExtensionBlock; /* * structure to "mimic" FILE for Mread, so we can look like fread. The decoder * state keeps track of which byte we are about to read, or EOF. */ typedef struct mFile { unsigned char *data; /* mmencoded source string */ |
︙ | ︙ | |||
114 115 116 117 118 119 120 | typedef size_t (WriteBytesFunc) (ClientData clientData, const char *bytes, size_t byteCount); /* * The format record for the GIF file format: */ | | | | > | | > | > | > > | | > | > | > > | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | typedef size_t (WriteBytesFunc) (ClientData clientData, const char *bytes, size_t byteCount); /* * The format record for the GIF file format: */ static int FileMatchGIF(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *format, Tcl_Obj *metadataInObj, int *widthPtr, int *heightPtr, Tcl_Obj *metadataOutObj); static int FileReadGIF(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY, Tcl_Obj *metadataOutObj); static int StringMatchGIF(Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *format, Tcl_Obj *metadataInObj, int *widthPtr, int *heightPtr, Tcl_Obj *metadataOutObj); static int StringReadGIF(Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY, Tcl_Obj *metadataOutObj); static int FileWriteGIF(Tcl_Interp *interp, const char *filename, Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr); static int StringWriteGIF(Tcl_Interp *interp, Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr); static int CommonWriteGIF(Tcl_Interp *interp, ClientData clientData, WriteBytesFunc *writeProc, Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr); Tk_PhotoImageFormatVersion3 tkImgFmtGIF = { "gif", /* name */ FileMatchGIF, /* fileMatchProc */ StringMatchGIF, /* stringMatchProc */ FileReadGIF, /* fileReadProc */ StringReadGIF, /* stringReadProc */ FileWriteGIF, /* fileWriteProc */ StringWriteGIF, /* stringWriteProc */ |
︙ | ︙ | |||
161 162 163 164 165 166 167 168 169 | #define MAX_LWZ_BITS 12 #define LM_to_uint(a,b) (((b)<<8)|(a)) /* * Prototypes for local functions defined in this file: */ static int DoExtension(GIFImageConfig *gifConfPtr, Tcl_Channel chan, int label, unsigned char *buffer, | > > > > | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | #define MAX_LWZ_BITS 12 #define LM_to_uint(a,b) (((b)<<8)|(a)) /* * Prototypes for local functions defined in this file: */ static int ReadOneByte(Tcl_Interp *interp, GIFImageConfig *gifConfPtr, Tcl_Channel chan); static int DoExtension(GIFImageConfig *gifConfPtr, Tcl_Channel chan, int label, unsigned char *buffer, GIFGraphicControlExtensionBlock *gifGraphicControlExtensionBlock, Tcl_Obj *metadataOutObj); static int GetCode(Tcl_Channel chan, int code_size, int flag, GIFImageConfig *gifConfPtr); static int GetDataBlock(GIFImageConfig *gifConfPtr, Tcl_Channel chan, unsigned char *buf); static int ReadColorMap(GIFImageConfig *gifConfPtr, Tcl_Channel chan, int number, unsigned char buffer[MAXCOLORMAPSIZE][4]); |
︙ | ︙ | |||
341 342 343 344 345 346 347 348 | * The access position in f may change. * *---------------------------------------------------------------------- */ static int FileMatchGIF( Tcl_Channel chan, /* The image file, open for reading. */ | > | | > | < < < | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | * The access position in f may change. * *---------------------------------------------------------------------- */ static int FileMatchGIF( TCL_UNUSED(Tcl_Interp *), /* not used */ Tcl_Channel chan, /* The image file, open for reading. */ TCL_UNUSED(const char *), /* The name of the image file. */ TCL_UNUSED(Tcl_Obj *), /* User-specified format object, or NULL. */ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw GIF file. */ TCL_UNUSED(Tcl_Obj *)) /* metadata return dict, may be NULL */ { GIFImageConfig gifConf; memset(&gifConf, 0, sizeof(GIFImageConfig)); return ReadGIFHeader(&gifConf, chan, widthPtr, heightPtr); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
383 384 385 386 387 388 389 390 391 392 393 394 | static int FileReadGIF( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ const char *fileName, /* The name of the image file. */ Tcl_Obj *format, /* User-specified format object, or NULL. */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo * image to be written to. */ int width, int height, /* Dimensions of block of photo image to be * written to. */ | > | > > < > > | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | static int FileReadGIF( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ const char *fileName, /* The name of the image file. */ Tcl_Obj *format, /* User-specified format object, or NULL. */ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo * image to be written to. */ int width, int height, /* Dimensions of block of photo image to be * written to. */ int srcX, int srcY, /* Coordinates of top-left pixel to be used in * image being read. */ Tcl_Obj *metadataOutObj) /* metadata return dict, may be NULL */ { int fileWidth, fileHeight, imageWidth, imageHeight; unsigned int nBytes; int index = 0, argc = 0, i, result = TCL_ERROR; Tcl_Obj **objv; unsigned char buf[100]; unsigned char *trashBuffer = NULL; int bitPixel; int gifLabel; unsigned char colorMap[MAXCOLORMAPSIZE][4]; GIFGraphicControlExtensionBlock gifGraphicControlExtensionBlock; static const char *const optionStrings[] = { "-index", NULL }; GIFImageConfig gifConf, *gifConfPtr = &gifConf; gifGraphicControlExtensionBlock.blockPresent = 0; /* * Decode the magic used to convey when we're sourcing data from a string * source and not a file. */ memset(colorMap, 0, MAXCOLORMAPSIZE*4); memset(gifConfPtr, 0, sizeof(GIFImageConfig)); |
︙ | ︙ | |||
499 500 501 502 503 504 505 506 507 508 509 510 | */ if (Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height) != TCL_OK) { return TCL_ERROR; } /* * Search for the frame from the GIF to display. */ while (1) { | > > > > > > < < < < | < < < < | | < < < < < | | > > | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | */ if (Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height) != TCL_OK) { return TCL_ERROR; } /* * ------------------------------------------------------------------------- * From here on, go to error to not leave memory leaks * ------------------------------------------------------------------------- */ /* * Search for the frame from the GIF to display. */ while (1) { if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) { goto error; } switch (gifLabel) { case GIF_TERMINATOR: Tcl_SetObjResult(interp, Tcl_NewStringObj( "no image data for this index", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "NO_DATA", NULL); goto error; case GIF_EXTENSION: /* * This is a GIF extension. */ if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) { goto error; } if (DoExtension(gifConfPtr, chan, gifLabel, gifConfPtr->workingBuffer, &gifGraphicControlExtensionBlock, metadataOutObj) < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading extension in GIF image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT", NULL); goto error; } continue; |
︙ | ︙ | |||
623 624 625 626 627 628 629 630 631 632 633 634 635 636 | * common case. */ if (ReadImage(gifConfPtr, interp, trashBuffer, chan, imageWidth, imageHeight, colorMap, 0, 0, 0, -1) != TCL_OK) { goto error; } continue; } break; } /* * Found the frame we want to read. Next, check for a local color map for | > > > > > > > | 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | * common case. */ if (ReadImage(gifConfPtr, interp, trashBuffer, chan, imageWidth, imageHeight, colorMap, 0, 0, 0, -1) != TCL_OK) { goto error; } /* * This extension starts a new scope, so Graphic control Extension * data should be cleared */ gifGraphicControlExtensionBlock.blockPresent = 0; continue; } break; } /* * Found the frame we want to read. Next, check for a local color map for |
︙ | ︙ | |||
670 671 672 673 674 675 676 | } if (height > imageHeight) { height = imageHeight; } if ((width > 0) && (height > 0)) { Tk_PhotoImageBlock block; | > > > | | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | } if (height > imageHeight) { height = imageHeight; } if ((width > 0) && (height > 0)) { Tk_PhotoImageBlock block; int transparent = -1; if (gifGraphicControlExtensionBlock.blockPresent) { transparent = gifGraphicControlExtensionBlock.transparent; } /* * Read the data and put it into the photo buffer for display by the * general image machinery. */ block.width = width; block.height = height; |
︙ | ︙ | |||
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { ckfree(block.pixelPtr); goto error; } ckfree(block.pixelPtr); } /* * We've successfully read the GIF frame (or there was nothing to read, * which suits as well). We're done. */ Tcl_SetObjResult(interp, Tcl_NewStringObj(tkImgFmtGIF.name, -1)); result = TCL_OK; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > < > < < | | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { ckfree(block.pixelPtr); goto error; } ckfree(block.pixelPtr); } /* * Update the metadata dictionary with current image data */ if (NULL != metadataOutObj) { /* * Save the update box, if not the whole image */ if ( width != fileWidth || height != fileHeight) { Tcl_Obj *itemList[4]; itemList[0] = Tcl_NewIntObj(destX); itemList[1] = Tcl_NewIntObj(destY); itemList[2] = Tcl_NewIntObj(width); itemList[3] = Tcl_NewIntObj(height); if ( TCL_OK != Tcl_DictObjPut(interp, metadataOutObj, Tcl_NewStringObj("update region",-1), Tcl_NewListObj(4, itemList) )) { result = TCL_ERROR; goto error; } } /* * Copy the Graphic Control Extension Block data to the metadata * dictionary */ if (gifGraphicControlExtensionBlock.blockPresent) { if ( gifGraphicControlExtensionBlock.delayTime != 0) { if ( TCL_OK != Tcl_DictObjPut(interp, metadataOutObj, Tcl_NewStringObj("delay time",-1), Tcl_NewIntObj(gifGraphicControlExtensionBlock.delayTime) )) { result = TCL_ERROR; goto error; } } switch ( gifGraphicControlExtensionBlock.disposalMethod ) { case 1: /* Do not dispose */ if ( TCL_OK != Tcl_DictObjPut(interp, metadataOutObj, Tcl_NewStringObj("disposal method",-1), Tcl_NewStringObj("do not dispose",-1))) { result = TCL_ERROR; goto error; } break; case 2: /* Restore to background color */ if ( TCL_OK != Tcl_DictObjPut(interp, metadataOutObj, Tcl_NewStringObj("disposal method",-1), Tcl_NewStringObj("restore to background color",-1))) { result = TCL_ERROR; goto error; } break; case 3: /* Restore to previous */ if ( TCL_OK != Tcl_DictObjPut(interp, metadataOutObj, Tcl_NewStringObj("disposal method",-1), Tcl_NewStringObj("restore to previous",-1))) { result = TCL_ERROR; goto error; } break; } if ( gifGraphicControlExtensionBlock.userInteraction != 0) { if ( TCL_OK != Tcl_DictObjPut(interp, metadataOutObj, Tcl_NewStringObj("user interaction",-1), Tcl_NewBooleanObj(1))) { result = TCL_ERROR; goto error; } } } } /* * We've successfully read the GIF frame (or there was nothing to read, * which suits as well). We're done. */ while (1) { if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) { goto error; } switch (gifLabel) { case GIF_TERMINATOR: break; case GIF_EXTENSION: /* * This is a GIF extension. */ if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) { goto error; } if (DoExtension(gifConfPtr, chan, gifLabel, gifConfPtr->workingBuffer, &gifGraphicControlExtensionBlock, metadataOutObj) < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading extension in GIF image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT", NULL); goto error; } continue; case GIF_START: /* * There should not be a second image block - bail out without error */ break; default: /* * Not a valid start character; ignore it. */ continue; } break; } Tcl_SetObjResult(interp, Tcl_NewStringObj(tkImgFmtGIF.name, -1)); result = TCL_OK; error: /* * If a trash buffer has been allocated, free it now. */ if (trashBuffer != NULL) { ckfree(trashBuffer); } return result; } /* *---------------------------------------------------------------------- * * Read one Byte -- * * Read one byte (label byte) from the image stream. * * Results: * The return value is 1 if the first characters in the data are like GIF * data, and 0 otherwise. * * Side effects: * The access position in the source is incremented. * *---------------------------------------------------------------------- */ static int ReadOneByte( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ GIFImageConfig *gifConfPtr, Tcl_Channel chan /* The image file, open for reading. */ ) { unsigned char buf[2]; if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) { /* * Premature end of image. */ Tcl_SetObjResult(interp, Tcl_NewStringObj( "premature end of image data", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "PREMATURE_END", NULL); return -1; } return buf[0]; } /* *---------------------------------------------------------------------- * * StringMatchGIF -- * * This function is invoked by the photo image type to see if an object * contains image data in GIF format. * * Results: * The return value is 1 if the first characters in the data are like GIF * data, and 0 otherwise. * * Side effects: * The size of the image is placed in widthPtr and heightPtr. * *---------------------------------------------------------------------- */ static int StringMatchGIF( TCL_UNUSED(Tcl_Interp *), /* not used */ Tcl_Obj *dataObj, /* the object containing the image data */ TCL_UNUSED(Tcl_Obj *), /* the image format object, or NULL */ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */ int *widthPtr, /* where to put the string width */ int *heightPtr, /* where to put the string height */ TCL_UNUSED(Tcl_Obj *)) /* metadata return dict, may be NULL */ { unsigned char *data, header[10]; TkSizeT got, length; MFile handle; data = Tcl_GetByteArrayFromObj(dataObj, &length); /* * Header is a minimum of 10 bytes. */ if (length < 10) { return 0; |
︙ | ︙ | |||
821 822 823 824 825 826 827 828 829 830 | */ static int StringReadGIF( Tcl_Interp *interp, /* interpreter for reporting errors in */ Tcl_Obj *dataObj, /* object containing the image */ Tcl_Obj *format, /* format object, or NULL */ Tk_PhotoHandle imageHandle, /* the image to write this data into */ int destX, int destY, /* The rectangular region of the */ int width, int height, /* image to copy */ | > | > | | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | */ static int StringReadGIF( Tcl_Interp *interp, /* interpreter for reporting errors in */ Tcl_Obj *dataObj, /* object containing the image */ Tcl_Obj *format, /* format object, or NULL */ Tcl_Obj *metadataInObj, /* metadata input, may be NULL */ Tk_PhotoHandle imageHandle, /* the image to write this data into */ int destX, int destY, /* The rectangular region of the */ int width, int height, /* image to copy */ int srcX, int srcY, Tcl_Obj *metadataOutObj) /* metadata return dict, may be NULL */ { MFile handle, *hdlPtr = &handle; TkSizeT length; const char *xferFormat; unsigned char *data = Tcl_GetByteArrayFromObj(dataObj, &length); mInit(data, hdlPtr, length); /* * Check whether the data is Base64 encoded by doing a character-by- * charcter comparison with the binary-format headers; BASE64-encoded * never matches (matching the other way is harder because of potential |
︙ | ︙ | |||
853 854 855 856 857 858 859 | /* * Fall through to the file reader now that we have a correctly-configured * pseudo-channel to pull the data from. */ return FileReadGIF(interp, (Tcl_Channel) hdlPtr, xferFormat, format, | | > | 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | /* * Fall through to the file reader now that we have a correctly-configured * pseudo-channel to pull the data from. */ return FileReadGIF(interp, (Tcl_Channel) hdlPtr, xferFormat, format, metadataInObj, imageHandle, destX, destY, width, height, srcX, srcY, metadataOutObj); } /* *---------------------------------------------------------------------- * * ReadGIFHeader -- * |
︙ | ︙ | |||
932 933 934 935 936 937 938 939 940 941 942 943 | buffer[i][CM_BLUE] = rgb[2]; buffer[i][CM_ALPHA] = 255; } } return 1; } static int DoExtension( GIFImageConfig *gifConfPtr, Tcl_Channel chan, int label, | > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > > > | | > | < < < < < < < | > > > > > > > > > > | > > | > > > > > | > > > > > | | > | > > > > > > > | | > > > > > > > > > > > > > > > > > > > | | 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 | buffer[i][CM_BLUE] = rgb[2]; buffer[i][CM_ALPHA] = 255; } } return 1; } /* *---------------------------------------------------------------------- * * DoExtension -- * * Process a GIF extension block * * Results: * -1 to trigger an extension read error * >= 0 ok * * Side effects: * The gifGraphicControlExtensionBlock is set if present in current * extensions * The data of the following extensions are saved to the metadata dict: * - Application extension * - Comment extension in key "comment" * Plain text extensions are currently ignored. * *---------------------------------------------------------------------- */ static int DoExtension( GIFImageConfig *gifConfPtr, Tcl_Channel chan, int label, unsigned char *buf, /* defined as 280 byte working buffer */ GIFGraphicControlExtensionBlock *gifGraphicControlExtensionBlock, Tcl_Obj *metadataOutObj) { int count; /* Prepare extension name * Maximum string size: "comment" + Code(3) + trailing zero */ char extensionStreamName[8]; extensionStreamName[0] = '\0'; switch (label) { case 0x01: /* Plain Text Extension */ /* * This extension starts a new scope, so Graphic control Extension * data should be cleared */ gifGraphicControlExtensionBlock->blockPresent = 0; /* this extension is ignored, skip below */ break; case 0xf9: /* Graphic Control Extension */ count = GetDataBlock(gifConfPtr, chan, buf); if (count < 0) { return -1; } gifGraphicControlExtensionBlock->blockPresent=1; /* save disposal method */ gifGraphicControlExtensionBlock->disposalMethod = ((buf[0] & 0x1C) >> 2); /* save disposal method */ gifGraphicControlExtensionBlock->userInteraction = ((buf[0] & 2) >> 1); /* save delay time */ gifGraphicControlExtensionBlock->delayTime = LM_to_uint(buf[1], buf[2]); /* save transparent index if given */ if ((buf[0] & 0x1) == 0) { gifGraphicControlExtensionBlock->transparent = -1; } else { gifGraphicControlExtensionBlock->transparent = buf[3]; } break; case 0xfe: /* Comment Extension */ strcpy(extensionStreamName,"comment"); /* copy the extension data below */ break; } /* Add extension to dict */ if (NULL != metadataOutObj && extensionStreamName[0] != '\0' ) { Tcl_Obj *ValueObj = NULL; int length = 0; for (;;) { count = GetDataBlock(gifConfPtr, chan, buf); switch (count) { case -1: /* error */ return -1; case 0: /* end of data */ if (length > 0) { if ( TCL_OK != Tcl_DictObjPut(NULL, metadataOutObj, Tcl_NewByteArrayObj( (unsigned char *)extensionStreamName, strlen(extensionStreamName)), ValueObj)) { return -1; } } /* return success */ return 0; default: /* block received */ if (length == 0) { /* first block */ ValueObj = Tcl_NewByteArrayObj(buf, count); length = count; } else { /* consecutive block */ unsigned char *bytePtr; bytePtr = Tcl_SetByteArrayLength(ValueObj, length+count); memcpy(bytePtr+length,buf,count); length += count; } break; } } /* for */ } /* skip eventual remaining data block bytes */ do { count = GetDataBlock(gifConfPtr, chan, buf); } while (count > 0); return count; /* this may be -1 for error or 0 */ } static int GetDataBlock( GIFImageConfig *gifConfPtr, Tcl_Channel chan, unsigned char *buf) |
︙ | ︙ | |||
1030 1031 1032 1033 1034 1035 1036 | ReadImage( GIFImageConfig *gifConfPtr, Tcl_Interp *interp, unsigned char *imagePtr, Tcl_Channel chan, int len, int rows, unsigned char cmap[MAXCOLORMAPSIZE][4], | | > < < | 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 | ReadImage( GIFImageConfig *gifConfPtr, Tcl_Interp *interp, unsigned char *imagePtr, Tcl_Channel chan, int len, int rows, unsigned char cmap[MAXCOLORMAPSIZE][4], TCL_UNUSED(int), TCL_UNUSED(int), int interlace, int transparent) { unsigned char initialCodeSize; int xpos = 0, ypos = 0, pass = 0, i, count; unsigned char *pixelPtr; static const int interlaceStep[] = { 8, 8, 4, 2 }; static const int interlaceStart[] = { 0, 4, 2, 1 }; unsigned short prefix[(1 << MAX_LWZ_BITS)]; unsigned char append[(1 << MAX_LWZ_BITS)]; unsigned char stack[(1 << MAX_LWZ_BITS)*2]; unsigned char *top; int codeSize, clearCode, inCode, endCode, oldCode, maxCode; int code, firstCode, v; /* * Initialize the decoder */ if (((size_t)Fread(gifConfPtr, &initialCodeSize, 1, 1, chan) + 1) < 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 | static int FileWriteGIF( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ const char *filename, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr) { Tcl_Channel chan = NULL; int result; chan = Tcl_OpenFileChannel(interp, (char *) filename, "w", 0644); if (!chan) { return TCL_ERROR; } if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) { Tcl_Close(NULL, chan); return TCL_ERROR; } | > | > > | | 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 | static int FileWriteGIF( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ const char *filename, Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr) { Tcl_Channel chan = NULL; int result; chan = Tcl_OpenFileChannel(interp, (char *) filename, "w", 0644); if (!chan) { return TCL_ERROR; } if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) { Tcl_Close(NULL, chan); return TCL_ERROR; } result = CommonWriteGIF(interp, chan, WriteToChannel, format, metadataInObj, blockPtr); if (Tcl_Close(interp, chan) == TCL_ERROR) { return TCL_ERROR; } return result; } static int StringWriteGIF( Tcl_Interp *interp, /* Interpreter to use for reporting errors and * returning the GIF data. */ Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr) { int result; Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_IncrRefCount(objPtr); result = CommonWriteGIF(interp, objPtr, WriteToByteArray, format, metadataInObj, blockPtr); if (result == TCL_OK) { Tcl_SetObjResult(interp, objPtr); } Tcl_DecrRefCount(objPtr); return result; } |
︙ | ︙ | |||
1707 1708 1709 1710 1711 1712 1713 | } static int CommonWriteGIF( Tcl_Interp *interp, ClientData handle, WriteBytesFunc *writeProc, | > | < | 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 | } static int CommonWriteGIF( Tcl_Interp *interp, ClientData handle, WriteBytesFunc *writeProc, TCL_UNUSED(Tcl_Obj *), Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr) { GifWriterState state; int resolution; long width, height, x; unsigned char c; unsigned int top, left; top = 0; left = 0; memset(&state, 0, sizeof(state)); state.pixelSize = blockPtr->pixelSize; |
︙ | ︙ | |||
1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 | state.ssize = state.rsize = blockPtr->width; state.csize = blockPtr->height; Compress(resolution+1, handle, writeProc, ReadValue, &state); c = 0; writeProc(handle, (char *) &c, 1); c = GIF_TERMINATOR; writeProc(handle, (char *) &c, 1); return TCL_OK; } static int | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | state.ssize = state.rsize = blockPtr->width; state.csize = blockPtr->height; Compress(resolution+1, handle, writeProc, ReadValue, &state); c = 0; writeProc(handle, (char *) &c, 1); /* * Check for metadata keys to add to file */ if (NULL != metadataInObj) { Tcl_Obj *itemData; /* * Check and code comment block */ if (TCL_ERROR == Tcl_DictObjGet(interp, metadataInObj, Tcl_NewStringObj("comment",-1), &itemData)) { return TCL_ERROR; } if (itemData != NULL) { int length; unsigned char *comment; comment = Tcl_GetByteArrayFromObj(itemData, &length); if (length > 0) { /* write comment header */ writeProc(handle, (char *) "\x21\xfe", 2); /* write comment blocks */ for (;length > 0;) { int blockLength; unsigned char blockLengthChar; if (length > 255) { length -=255; blockLength = 255; } else { blockLength = length; length = 0; } blockLengthChar = (unsigned char) blockLength; writeProc(handle, (char *) &blockLengthChar, 1); writeProc(handle, (char *) comment, blockLength); comment += blockLength; } /* Block terminator */ c = 0; writeProc(handle, (char *) &c, 1); } } } c = GIF_TERMINATOR; writeProc(handle, (char *) &c, 1); return TCL_OK; } static int |
︙ | ︙ |
Changes to generic/tkImgListFormat.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * list element being itself a list of pixels (or columns). For details, * see the manpage photo.n * * This image format cannot read/write files, it is meant for string * data only. * * | | | | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * list element being itself a list of pixels (or columns). For details, * see the manpage photo.n * * This image format cannot read/write files, it is meant for string * data only. * * * Copyright © 1994 The Australian National University. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2002-2003 Donal K. Fellows * Copyright © 2003 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Authors: * Paul Mackerras ([email protected]), * Department of Computer Science, |
︙ | ︙ | |||
40 41 42 43 44 45 46 | /* * Color name length limit: do not attempt to parse as color strings that are * longer than this limit */ | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | /* * Color name length limit: do not attempt to parse as color strings that are * longer than this limit */ #define TK_PHOTO_MAX_COLOR_LENGTH 99 /* * Symbols for the different formats of a color string. */ enum ColorFormatType { COLORFORMAT_TKCOLOR, |
︙ | ︙ | |||
192 193 194 195 196 197 198 | int *indexPtr, /* Index giving the first element to * parse. The value is updated to the * index where parsing ended */ struct FormatOptions *optPtr) /* Parsed option values are written to * this struct */ { | | < | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | int *indexPtr, /* Index giving the first element to * parse. The value is updated to the * index where parsing ended */ struct FormatOptions *optPtr) /* Parsed option values are written to * this struct */ { int index, optIndex, first, typeIndex; const char *option; first = 1; /* * Fill in default values */ |
︙ | ︙ | |||
254 255 256 257 258 259 260 | Tcl_SetObjResult(interp, Tcl_ObjPrintf("the \"%s\" option " "requires a value", Tcl_GetString(objv[index - 1]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; } if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", | | | | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | Tcl_SetObjResult(interp, Tcl_ObjPrintf("the \"%s\" option " "requires a value", Tcl_GetString(objv[index - 1]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; } if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", TCL_EXACT, &typeIndex) != TCL_OK || (typeIndex != COLORFORMAT_LIST && typeIndex != COLORFORMAT_RGB2 && typeIndex != COLORFORMAT_RGBA2) ) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad color format " "\"%s\": must be rgb, rgba, or list", Tcl_GetString(objv[index]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_COLOR_FORMAT", NULL); return TCL_ERROR; } optPtr->colorFormat = (enum ColorFormatType)typeIndex; break; default: Tcl_Panic("ParseFormatOptions: unexpected switch fallthrough"); } /* * Add option to bitfield in optPtr |
︙ | ︙ | |||
409 410 411 412 413 414 415 | * Data in base64 encoding (or even binary data), might actually pass * these tests. To avoid parsing it as list of lists format, check one * pixel for validity. */ if (Tcl_ListObjIndex(interp, rowListPtr[0], 0, &pixelData) != TCL_OK) { return 0; } | > | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | * Data in base64 encoding (or even binary data), might actually pass * these tests. To avoid parsing it as list of lists format, check one * pixel for validity. */ if (Tcl_ListObjIndex(interp, rowListPtr[0], 0, &pixelData) != TCL_OK) { return 0; } (void)Tcl_GetString(pixelData); if (pixelData->length > TK_PHOTO_MAX_COLOR_LENGTH) { return 0; } if (ParseColor(interp, pixelData, Tk_Display(Tk_MainWindow(interp)), Tk_Colormap(Tk_MainWindow(interp)), &dummy, &dummy, &dummy, &dummy) != TCL_OK) { return 0; } |
︙ | ︙ | |||
771 772 773 774 775 776 777 | Colormap colormap, /* colormap of current display */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { const char *specString; | | | | | | | | | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | Colormap colormap, /* colormap of current display */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { const char *specString; TkSizeT length; /* * Find out which color format we have */ specString = Tcl_GetStringFromObj(specObj, &length); if (length == 0) { /* Empty string */ *redPtr = *greenPtr = *bluePtr = *alphaPtr = 0; return TCL_OK; } if (length > TK_PHOTO_MAX_COLOR_LENGTH) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid color")); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID_COLOR", NULL); return TCL_ERROR; } if (specString[0] == '#') { return ParseColorAsHex(interp, specString, length, display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } if (ParseColorAsList(interp, specString, length, redPtr, greenPtr, bluePtr, alphaPtr) == TCL_OK) { return TCL_OK; } /* * Parsing the color as standard Tk color always is the last option tried * because TkParseColor() is very slow with values it cannot parse. */ Tcl_ResetResult(interp); return ParseColorAsStandard(interp, specString, length, display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { XColor parsedColor; const char *suffixString, *colorString; | | | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { XColor parsedColor; const char *suffixString, *colorString; char colorBuffer[TK_PHOTO_MAX_COLOR_LENGTH + 1]; char *tmpString; double fracAlpha; unsigned int suffixAlpha; int i; /* * Split color data string in color and suffix parts |
︙ | ︙ |
Changes to generic/tkImgPNG.c.
1 2 3 4 5 | /* * tkImgPNG.c -- * * A Tk photo image file handler for PNG files. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /* * tkImgPNG.c -- * * A Tk photo image file handler for PNG files. * * Copyright © 2006-2008 Muonics, Inc. * Copyright © 2008 Donal K. Fellows * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #define PNG_UINT32(a,b,c,d) \ (((unsigned long)(a) << 24) | ((unsigned long)(b) << 16) | ((unsigned long)(c) << 8) | (unsigned long)(d)) #define PNG_BLOCK_SZ 1024 /* Process up to 1k at a time. */ #define PNG_MIN(a, b) (((a) < (b)) ? (a) : (b)) /* * Every PNG image starts with the following 8-byte signature. */ |
︙ | ︙ | |||
41 42 43 44 45 46 47 | /* * Chunk types, not all of which have support implemented. Note that there are * others in the official extension set which we will never support (as they * are officially deprecated). */ | | | | | | | | | | | | | | | | | | | | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | /* * Chunk types, not all of which have support implemented. Note that there are * others in the official extension set which we will never support (as they * are officially deprecated). */ #define CHUNK_IDAT PNG_UINT32('I','D','A','T') /* Pixel data. */ #define CHUNK_IEND PNG_UINT32('I','E','N','D') /* End of Image. */ #define CHUNK_IHDR PNG_UINT32('I','H','D','R') /* Header. */ #define CHUNK_PLTE PNG_UINT32('P','L','T','E') /* Palette. */ #define CHUNK_bKGD PNG_UINT32('b','K','G','D') /* Background Color */ #define CHUNK_cHRM PNG_UINT32('c','H','R','M') /* Chroma values. */ #define CHUNK_gAMA PNG_UINT32('g','A','M','A') /* Gamma. */ #define CHUNK_hIST PNG_UINT32('h','I','S','T') /* Histogram. */ #define CHUNK_iCCP PNG_UINT32('i','C','C','P') /* Color profile. */ #define CHUNK_iTXt PNG_UINT32('i','T','X','t') /* Internationalized * text (comments, * etc.) */ #define CHUNK_oFFs PNG_UINT32('o','F','F','s') /* Image offset. */ #define CHUNK_pCAL PNG_UINT32('p','C','A','L') /* Pixel calibration * data. */ #define CHUNK_pHYs PNG_UINT32('p','H','Y','s') /* Physical pixel * dimensions. */ #define CHUNK_sBIT PNG_UINT32('s','B','I','T') /* Significant bits */ #define CHUNK_sCAL PNG_UINT32('s','C','A','L') /* Physical scale. */ #define CHUNK_sPLT PNG_UINT32('s','P','L','T') /* Suggested * palette. */ #define CHUNK_sRGB PNG_UINT32('s','R','G','B') /* Standard RGB space * declaration. */ #define CHUNK_tEXt PNG_UINT32('t','E','X','t') /* Plain Latin-1 * text. */ #define CHUNK_tIME PNG_UINT32('t','I','M','E') /* Time stamp. */ #define CHUNK_tRNS PNG_UINT32('t','R','N','S') /* Transparency. */ #define CHUNK_zTXt PNG_UINT32('z','T','X','t') /* Compressed Latin-1 * text. */ /* * Color flags. */ #define PNG_COLOR_INDEXED 1 |
︙ | ︙ | |||
171 172 173 174 175 176 177 178 179 180 181 182 183 184 | Tcl_ZlibStream stream; /* Inflating or deflating stream; this one is * not bound to a Tcl command. */ Tcl_Obj *lastLineObj; /* Last line of pixels, for unfiltering. */ Tcl_Obj *thisLineObj; /* Current line of pixels to process. */ int lineSize; /* Number of bytes in a PNG line. */ int phaseSize; /* Number of bytes/line in current phase. */ } PNGImage; /* * Maximum size of various chunks. */ #define PNG_PLTE_MAXSZ 768 /* 3 bytes/RGB entry, 256 entries max */ | > > > > > > > > > | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | Tcl_ZlibStream stream; /* Inflating or deflating stream; this one is * not bound to a Tcl command. */ Tcl_Obj *lastLineObj; /* Last line of pixels, for unfiltering. */ Tcl_Obj *thisLineObj; /* Current line of pixels to process. */ int lineSize; /* Number of bytes in a PNG line. */ int phaseSize; /* Number of bytes/line in current phase. */ /* * Physical size: pHYS chunks. */ double DPI; double aspect; } PNGImage; /* * Maximum size of various chunks. */ #define PNG_PLTE_MAXSZ 768 /* 3 bytes/RGB entry, 256 entries max */ |
︙ | ︙ | |||
194 195 196 197 198 199 200 | unsigned long calculated); static void CleanupPNGImage(PNGImage *pngPtr); static int DecodeLine(Tcl_Interp *interp, PNGImage *pngPtr); static int DecodePNG(Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle, int destX, int destY); static int EncodePNG(Tcl_Interp *interp, | | > | | | > | | > > | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | unsigned long calculated); static void CleanupPNGImage(PNGImage *pngPtr); static int DecodeLine(Tcl_Interp *interp, PNGImage *pngPtr); static int DecodePNG(Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle, int destX, int destY); static int EncodePNG(Tcl_Interp *interp, Tk_PhotoImageBlock *blockPtr, PNGImage *pngPtr, Tcl_Obj *metadataInObj); static int FileMatchPNG(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj, int *widthPtr, int *heightPtr, Tcl_Obj *metadataOut); static int FileReadPNG(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY, Tcl_Obj *metadataOutPtr); static int FileWritePNG(Tcl_Interp *interp, const char *filename, Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr); static int InitPNGImage(Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Channel chan, Tcl_Obj *objPtr, int dir); static inline unsigned char Paeth(int a, int b, int c); static int ParseFormat(Tcl_Interp *interp, Tcl_Obj *fmtObj, PNGImage *pngPtr); static int ReadBase64(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, size_t destSz, |
︙ | ︙ | |||
232 233 234 235 236 237 238 | unsigned long *resultPtr, unsigned long *crcPtr); static int ReadPLTE(Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc); static int ReadTRNS(Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc); static int SkipChunk(Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc); | | > | | > | | > > | | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | unsigned long *resultPtr, unsigned long *crcPtr); static int ReadPLTE(Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc); static int ReadTRNS(Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc); static int SkipChunk(Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc); static int StringMatchPNG(Tcl_Interp *interp, Tcl_Obj *pObjData, Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj, int *widthPtr, int *heightPtr, Tcl_Obj *metadataOutObj); static int StringReadPNG(Tcl_Interp *interp, Tcl_Obj *pObjData, Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY, Tcl_Obj *metadataOutObj); static int StringWritePNG(Tcl_Interp *interp, Tcl_Obj *fmtObj, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr); static int UnfilterLine(Tcl_Interp *interp, PNGImage *pngPtr); static inline int WriteByte(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char c, unsigned long *crcPtr); static inline int WriteChunk(Tcl_Interp *interp, PNGImage *pngPtr, unsigned long chunkType, const unsigned char *dataPtr, size_t dataSize); static int WriteData(Tcl_Interp *interp, PNGImage *pngPtr, const unsigned char *srcPtr, size_t srcSz, unsigned long *crcPtr); static int WriteExtraChunks(Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Obj *metadataInObj); static int WriteIHDR(Tcl_Interp *interp, PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr); static int WriteIDAT(Tcl_Interp *interp, PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr); static inline int WriteInt32(Tcl_Interp *interp, PNGImage *pngPtr, unsigned long l, unsigned long *crcPtr); /* * The format record for the PNG file format: */ Tk_PhotoImageFormatVersion3 tkImgFmtPNG = { "png", /* name */ FileMatchPNG, /* fileMatchProc */ StringMatchPNG, /* stringMatchProc */ FileReadPNG, /* fileReadProc */ StringReadPNG, /* stringReadProc */ FileWritePNG, /* fileWriteProc */ StringWritePNG, /* stringWriteProc */ |
︙ | ︙ | |||
315 316 317 318 319 320 321 | * reading with ReadData(). */ if (objPtr) { Tcl_IncrRefCount(objPtr); pngPtr->objDataPtr = objPtr; pngPtr->strDataBuf = | | | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | * reading with ReadData(). */ if (objPtr) { Tcl_IncrRefCount(objPtr); pngPtr->objDataPtr = objPtr; pngPtr->strDataBuf = Tcl_GetByteArrayFromObj(objPtr, &pngPtr->strDataLen); } /* * Initialize the palette transparency table to fully opaque. */ memset(pngPtr->palette, 255, sizeof(pngPtr->palette)); |
︙ | ︙ | |||
341 342 343 344 345 346 347 348 349 350 351 352 353 354 | } if (objPtr) { Tcl_DecrRefCount(objPtr); } return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * CleanupPNGImage -- | > > > > > > > | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | } if (objPtr) { Tcl_DecrRefCount(objPtr); } return TCL_ERROR; } /* * Initialize physical size pHYS values */ pngPtr->DPI = -1; pngPtr->aspect = -1; return TCL_OK; } /* *---------------------------------------------------------------------- * * CleanupPNGImage -- |
︙ | ︙ | |||
690 691 692 693 694 695 696 | { unsigned char p[4]; if (ReadData(interp, pngPtr, p, 4, crcPtr) == TCL_ERROR) { return TCL_ERROR; } | | | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | { unsigned char p[4]; if (ReadData(interp, pngPtr, p, 4, crcPtr) == TCL_ERROR) { return TCL_ERROR; } *resultPtr = PNG_UINT32(p[0], p[1], p[2], p[3]); return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
882 883 884 885 886 887 888 | * maximum size for Tcl_Read, Tcl_GetByteArrayFromObj, etc. */ if (ReadData(interp, pngPtr, pc, 4, NULL) == TCL_ERROR) { return TCL_ERROR; } | | | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | * maximum size for Tcl_Read, Tcl_GetByteArrayFromObj, etc. */ if (ReadData(interp, pngPtr, pc, 4, NULL) == TCL_ERROR) { return TCL_ERROR; } temp = PNG_UINT32(pc[0], pc[1], pc[2], pc[3]); if (temp > INT_MAX) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "chunk size is out of supported range on this architecture", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "OUTSIZE", NULL); return TCL_ERROR; |
︙ | ︙ | |||
907 908 909 910 911 912 913 | return TCL_ERROR; } /* * Convert it to a host-order integer for simple comparison. */ | | | 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | return TCL_ERROR; } /* * Convert it to a host-order integer for simple comparison. */ chunkType = PNG_UINT32(pc[0], pc[1], pc[2], pc[3]); /* * Check to see if this is a known/supported chunk type. Note that the * PNG specs require non-critical (i.e., ancillary) chunk types that * are not recognized to be ignored, rather than be treated as an * error. It does, however, recommend that an unknown critical chunk * type be treated as a failure. |
︙ | ︙ | |||
929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | /* * These chunk types are required and/or supported. */ case CHUNK_IDAT: case CHUNK_IEND: case CHUNK_IHDR: case CHUNK_PLTE: case CHUNK_tRNS: break; /* * These chunk types are part of the standard, but are not used by * this implementation (at least not yet). Note that these are all * ancillary chunks (lowercase first letter). */ case CHUNK_bKGD: case CHUNK_cHRM: case CHUNK_gAMA: case CHUNK_hIST: case CHUNK_iCCP: case CHUNK_iTXt: case CHUNK_oFFs: case CHUNK_pCAL: | > < | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | /* * These chunk types are required and/or supported. */ case CHUNK_IDAT: case CHUNK_IEND: case CHUNK_IHDR: case CHUNK_pHYs: case CHUNK_PLTE: case CHUNK_tRNS: break; /* * These chunk types are part of the standard, but are not used by * this implementation (at least not yet). Note that these are all * ancillary chunks (lowercase first letter). */ case CHUNK_bKGD: case CHUNK_cHRM: case CHUNK_gAMA: case CHUNK_hIST: case CHUNK_iCCP: case CHUNK_iTXt: case CHUNK_oFFs: case CHUNK_pCAL: case CHUNK_sBIT: case CHUNK_sCAL: case CHUNK_sPLT: case CHUNK_sRGB: case CHUNK_tEXt: case CHUNK_tIME: case CHUNK_zTXt: |
︙ | ︙ | |||
972 973 974 975 976 977 978 | default: /* * Unknown chunk type. If it's critical, we can't continue. */ if (!(chunkType & PNG_CF_ANCILLARY)) { | | | 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | default: /* * Unknown chunk type. If it's critical, we can't continue. */ if (!(chunkType & PNG_CF_ANCILLARY)) { if (chunkType & PNG_UINT32(128,128,128,128)) { /* * No nice ASCII conversion; shouldn't happen either, but * we'll be doubly careful. */ Tcl_SetObjResult(interp, Tcl_NewStringObj( "encountered an unsupported critical chunk type", |
︙ | ︙ | |||
1259 1260 1261 1262 1263 1264 1265 | mismatch = memcmp(sigBuf, pngSignature, PNG_SIG_SZ); /* * If reading from string, reset position and try base64 decode. */ if (mismatch && pngPtr->strDataBuf) { | | | 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | mismatch = memcmp(sigBuf, pngSignature, PNG_SIG_SZ); /* * If reading from string, reset position and try base64 decode. */ if (mismatch && pngPtr->strDataBuf) { pngPtr->strDataBuf = Tcl_GetByteArrayFromObj(pngPtr->objDataPtr, &pngPtr->strDataLen); pngPtr->base64Data = pngPtr->strDataBuf; if (ReadData(interp, pngPtr, sigBuf, PNG_SIG_SZ, NULL) == TCL_ERROR) { return TCL_ERROR; } |
︙ | ︙ | |||
1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 | return TCL_OK; } /* *---------------------------------------------------------------------- * * Paeth -- * * Utility function for applying the Paeth filter to a pixel. The Paeth * filter is a linear function of the pixel to be filtered and the pixels * to the left, above, and above-left of the pixel to be unfiltered. * * Results: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 | return TCL_OK; } /* *---------------------------------------------------------------------- * * ReadPHYS -- * * This function reads the PHYS (physical size) chunk data from * the PNG file and populates the fields in the PNGImage * structure. * * Results: * TCL_OK, or TCL_ERROR if an I/O error occurs or the PHYS chunk is * invalid. * * Side effects: * The access position in f advances. * *---------------------------------------------------------------------- */ static int ReadPHYS( Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc) { unsigned long PPUx, PPUy; char unitSpecifier; /* * Check chunk size equal 9 bytes */ if (chunkSz != 9) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid physical chunk size", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_PHYS", NULL); return TCL_ERROR; } /* * Read the chunk data * 4 bytes: Pixels per unit, x axis * 4 bytes: Pixels per unit, y axis * 1 byte: unit specifier */ if (ReadInt32(interp, pngPtr, &PPUx, &crc) == TCL_ERROR) { return TCL_ERROR; } if (ReadInt32(interp, pngPtr, &PPUy, &crc) == TCL_ERROR) { return TCL_ERROR; } if (ReadData(interp, pngPtr, (unsigned char *)&unitSpecifier, 1, &crc) == TCL_ERROR) { return TCL_ERROR; } if (CheckCRC(interp, pngPtr, crc) == TCL_ERROR) { return TCL_ERROR; } if ( PPUx > 2147483647 || PPUy > 2147483647 || unitSpecifier > 1 ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid physical size value", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_PHYS", NULL); return TCL_ERROR; } if (PPUx > 0) { pngPtr->aspect = ((double) PPUy) / ((double) PPUx); } if (1 == unitSpecifier) { pngPtr->DPI = ((double) PPUx) * 0.0254; } return TCL_OK; } /* *---------------------------------------------------------------------- * * Paeth -- * * Utility function for applying the Paeth filter to a pixel. The Paeth * filter is a linear function of the pixel to be filtered and the pixels * to the left, above, and above-left of the pixel to be unfiltered. * * Results: |
︙ | ︙ | |||
1704 1705 1706 1707 1708 1709 1710 | static int UnfilterLine( Tcl_Interp *interp, PNGImage *pngPtr) { unsigned char *thisLine = | | | | 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 | static int UnfilterLine( Tcl_Interp *interp, PNGImage *pngPtr) { unsigned char *thisLine = Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, (int *)NULL); unsigned char *lastLine = Tcl_GetByteArrayFromObj(pngPtr->lastLineObj, (int *)NULL); #define PNG_FILTER_NONE 0 #define PNG_FILTER_SUB 1 #define PNG_FILTER_UP 2 #define PNG_FILTER_AVG 3 #define PNG_FILTER_PAETH 4 |
︙ | ︙ | |||
1836 1837 1838 1839 1840 1841 1842 | int haveBits = 0; /* Number of bits remaining in current byte */ unsigned char pixBits = 0; /* Extracted bits for current channel */ int shifts = 0; /* Number of channels extracted from byte */ int offset = 0; /* Current offset into pixelPtr */ int colStep = 1; /* Column increment each pass */ int pixStep = 0; /* extra pixelPtr increment each pass */ unsigned char lastPixel[6]; | | | 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 | int haveBits = 0; /* Number of bits remaining in current byte */ unsigned char pixBits = 0; /* Extracted bits for current channel */ int shifts = 0; /* Number of channels extracted from byte */ int offset = 0; /* Current offset into pixelPtr */ int colStep = 1; /* Column increment each pass */ int pixStep = 0; /* extra pixelPtr increment each pass */ unsigned char lastPixel[6]; unsigned char *p = Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, (int *)NULL); p++; if (UnfilterLine(interp, pngPtr) == TCL_ERROR) { return TCL_ERROR; } if (pngPtr->currentLine >= pngPtr->block.height) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
2142 2143 2144 2145 2146 2147 2148 | /* * Inflate, processing each output buffer's worth as a line of pixels, * until we cannot fill the buffer any more. */ getNextLine: | | | | 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 | /* * Inflate, processing each output buffer's worth as a line of pixels, * until we cannot fill the buffer any more. */ getNextLine: Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, &len1); if (Tcl_ZlibStreamGet(pngPtr->stream, pngPtr->thisLineObj, pngPtr->phaseSize - len1) == TCL_ERROR) { return TCL_ERROR; } Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, &len2); if (len2 == (TkSizeT)pngPtr->phaseSize) { if (pngPtr->phase > 7) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "extra data after final scan line of final phase", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EXTRA_DATA", |
︙ | ︙ | |||
2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 | * PLTE is mandatory for color type 3 and forbidden for 2 and 6 */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { return TCL_ERROR; } if (CHUNK_PLTE == chunkType) { /* * Finish parsing the PLTE chunk. */ if (ReadPLTE(interp, pngPtr, chunkSz, crc) == TCL_ERROR) { | > > > > > > > > > > > > > > > > > > > > > > > | 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 | * PLTE is mandatory for color type 3 and forbidden for 2 and 6 */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { return TCL_ERROR; } /* * Physical header may be present here so try to parse it */ if (CHUNK_pHYs == chunkType) { /* * Finish parsing the PHYS chunk. */ if (ReadPHYS(interp, pngPtr, chunkSz, crc) == TCL_ERROR) { return TCL_ERROR; } /* * Begin the next chunk. */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { return TCL_ERROR; } } if (CHUNK_PLTE == chunkType) { /* * Finish parsing the PLTE chunk. */ if (ReadPLTE(interp, pngPtr, chunkSz, crc) == TCL_ERROR) { |
︙ | ︙ | |||
2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 | /* * Finish parsing the tRNS chunk. */ if (ReadTRNS(interp, pngPtr, chunkSz, crc) == TCL_ERROR) { return TCL_ERROR; } /* * Begin the next chunk. */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { | > > > > > > > > > > > > > > > > > > > > > > > | 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 | /* * Finish parsing the tRNS chunk. */ if (ReadTRNS(interp, pngPtr, chunkSz, crc) == TCL_ERROR) { return TCL_ERROR; } /* * Begin the next chunk. */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { return TCL_ERROR; } } /* * Physical header may be present here so try to parse it */ if (CHUNK_pHYs == chunkType) { /* * Finish parsing the PHYS chunk. */ if (ReadPHYS(interp, pngPtr, chunkSz, crc) == TCL_ERROR) { return TCL_ERROR; } /* * Begin the next chunk. */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { |
︙ | ︙ | |||
2663 2664 2665 2666 2667 2668 2669 | * The access position in f may change. * *---------------------------------------------------------------------- */ static int FileMatchPNG( | > | | > | | < > > | < < | 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 | * The access position in f may change. * *---------------------------------------------------------------------- */ static int FileMatchPNG( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ TCL_UNUSED(const char *), /* The name of the image file. */ TCL_UNUSED(Tcl_Obj *), /* User-specified format object, or NULL. */ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw GIF file. */ TCL_UNUSED(Tcl_Obj *)) /* metadata return dict, may be NULL */ { PNGImage png; int match = 0; InitPNGImage(NULL, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE); if (ReadIHDR(interp, &png) == TCL_OK) { *widthPtr = png.block.width; *heightPtr = png.block.height; match = 1; |
︙ | ︙ | |||
2709 2710 2711 2712 2713 2714 2715 | * image given by imageHandle. * *---------------------------------------------------------------------- */ static int FileReadPNG( | | | | | > | | < > > | | > | | > < < < < < > > > > > > > > > > > > | 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 | * image given by imageHandle. * *---------------------------------------------------------------------- */ static int FileReadPNG( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ TCL_UNUSED(const char *), /* The name of the image file. */ Tcl_Obj *fmtObj, /* User-specified format object, or NULL. */ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo * image to be written to. */ TCL_UNUSED(int), /* Dimensions of block of photo image to be * written to. */ TCL_UNUSED(int), TCL_UNUSED(int), /* Coordinates of top-left pixel to be used in * image being read. */ TCL_UNUSED(int), Tcl_Obj *metadataOutObj) /* metadata return dict, may be NULL */ { PNGImage png; int result = TCL_ERROR; result = InitPNGImage(interp, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE); if (TCL_OK == result) { result = DecodePNG(interp, &png, fmtObj, imageHandle, destX, destY); } if (TCL_OK == result && metadataOutObj != NULL && png.DPI != -1) { result = Tcl_DictObjPut(NULL, metadataOutObj, Tcl_NewStringObj("DPI",-1), Tcl_NewDoubleObj(png.DPI)); } if (TCL_OK == result && metadataOutObj != NULL && png.aspect != -1) { result = Tcl_DictObjPut(NULL, metadataOutObj, Tcl_NewStringObj("aspect",-1), Tcl_NewDoubleObj(png.aspect)); } CleanupPNGImage(&png); return result; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2759 2760 2761 2762 2763 2764 2765 | * The size of the image is placed in widthPre and heightPtr. * *---------------------------------------------------------------------- */ static int StringMatchPNG( | > | > | | | | < | | 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 | * The size of the image is placed in widthPre and heightPtr. * *---------------------------------------------------------------------- */ static int StringMatchPNG( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Obj *pObjData, /* the object containing the image data */ TCL_UNUSED(Tcl_Obj *), /* the image format object, or NULL */ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */ int *widthPtr, /* where to put the string width */ int *heightPtr, /* where to put the string height */ TCL_UNUSED(Tcl_Obj *)) /* metadata return dict, may be NULL */ { PNGImage png; int match = 0; InitPNGImage(NULL, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); png.strDataBuf = Tcl_GetByteArrayFromObj(pObjData, &png.strDataLen); if (ReadIHDR(interp, &png) == TCL_OK) { *widthPtr = png.block.width; *heightPtr = png.block.height; match = 1; } |
︙ | ︙ | |||
2803 2804 2805 2806 2807 2808 2809 | * New data is added to the image given by imageHandle. * *---------------------------------------------------------------------- */ static int StringReadPNG( | | | | > | | | | < | | > < < < < > > > > > > > > > > > > | 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 | * New data is added to the image given by imageHandle. * *---------------------------------------------------------------------- */ static int StringReadPNG( Tcl_Interp *interp, /* interpreter for reporting errors in */ Tcl_Obj *pObjData, /* object containing the image */ Tcl_Obj *fmtObj, /* format object, or NULL */ TCL_UNUSED(Tcl_Obj *), /* metadata input, may be NULL */ Tk_PhotoHandle imageHandle, /* the image to write this data into */ int destX, int destY, /* The rectangular region of the */ TCL_UNUSED(int), /* image to copy */ TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), Tcl_Obj *metadataOutObj) /* metadata return dict, may be NULL */ { PNGImage png; int result = TCL_ERROR; result = InitPNGImage(interp, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); if (TCL_OK == result) { result = DecodePNG(interp, &png, fmtObj, imageHandle, destX, destY); } if (TCL_OK == result && metadataOutObj != NULL && png.DPI != -1) { result = Tcl_DictObjPut(NULL, metadataOutObj, Tcl_NewStringObj("DPI",-1), Tcl_NewDoubleObj(png.DPI)); } if (TCL_OK == result && metadataOutObj != NULL && png.aspect != -1) { result = Tcl_DictObjPut(NULL, metadataOutObj, Tcl_NewStringObj("aspect",-1), Tcl_NewDoubleObj(png.aspect)); } CleanupPNGImage(&png); return result; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2873 2874 2875 2876 2877 2878 2879 | * objects immediately or store them in a multi-object rep? */ if (pngPtr->objDataPtr) { TkSizeT objSz; unsigned char *destPtr; | | | 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 | * objects immediately or store them in a multi-object rep? */ if (pngPtr->objDataPtr) { TkSizeT objSz; unsigned char *destPtr; Tcl_GetByteArrayFromObj(pngPtr->objDataPtr, &objSz); if (objSz + srcSz > INT_MAX) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "image too large to store completely in byte array", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TOO_LARGE", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 | { return WriteData(interp, pngPtr, &c, 1, crcPtr); } /* *---------------------------------------------------------------------- * * WriteInt32 -- * * This function writes a 32-bit integer value out to the PNG image as * four bytes in network byte order. * * Results: * TCL_OK, or TCL_ERROR if the write fails. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 | { return WriteData(interp, pngPtr, &c, 1, crcPtr); } /* *---------------------------------------------------------------------- * * LongToInt32 -- * * This function transforms to a 32-bit integer value as * four bytes in network byte order. * * Results: * None * * Side effects: * Buffer will be modified. * *---------------------------------------------------------------------- */ static inline void LongToInt32( unsigned long l, unsigned char *pc) { pc[0] = (unsigned char) ((l & 0xff000000) >> 24); pc[1] = (unsigned char) ((l & 0x00ff0000) >> 16); pc[2] = (unsigned char) ((l & 0x0000ff00) >> 8); pc[3] = (unsigned char) ((l & 0x000000ff) >> 0); } /* *---------------------------------------------------------------------- * * WriteInt32 -- * * This function writes a 32-bit integer value out to the PNG image as * four bytes in network byte order. * * Results: * TCL_OK, or TCL_ERROR if the write fails. |
︙ | ︙ | |||
2936 2937 2938 2939 2940 2941 2942 | WriteInt32( Tcl_Interp *interp, PNGImage *pngPtr, unsigned long l, unsigned long *crcPtr) { unsigned char pc[4]; | | < < < < < | 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 | WriteInt32( Tcl_Interp *interp, PNGImage *pngPtr, unsigned long l, unsigned long *crcPtr) { unsigned char pc[4]; LongToInt32(l,pc); return WriteData(interp, pngPtr, pc, 4, crcPtr); } /* *---------------------------------------------------------------------- * * WriteChunk -- |
︙ | ︙ | |||
3234 3235 3236 3237 3238 3239 3240 | /* * Now get the compressed data and write it as one big IDAT chunk. */ outputObj = Tcl_NewObj(); (void) Tcl_ZlibStreamGet(pngPtr->stream, outputObj, -1); | | | 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 | /* * Now get the compressed data and write it as one big IDAT chunk. */ outputObj = Tcl_NewObj(); (void) Tcl_ZlibStreamGet(pngPtr->stream, outputObj, -1); outputBytes = Tcl_GetByteArrayFromObj(outputObj, &outputSize); result = WriteChunk(interp, pngPtr, CHUNK_IDAT, outputBytes, outputSize); Tcl_DecrRefCount(outputObj); return result; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3260 3261 3262 3263 3264 3265 3266 | * *---------------------------------------------------------------------- */ static int WriteExtraChunks( Tcl_Interp *interp, | | > | 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 | * *---------------------------------------------------------------------- */ static int WriteExtraChunks( Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Obj *metadataInObj) { static const unsigned char sBIT_contents[] = { 8, 8, 8, 8 }; int sBIT_length = 4; Tcl_DString buf; |
︙ | ︙ | |||
3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 | (unsigned char *) Tcl_DStringValue(&buf), Tcl_DStringLength(&buf)) != TCL_OK) { Tcl_DStringFree(&buf); return TCL_ERROR; } Tcl_DStringFree(&buf); return TCL_OK; } /* *---------------------------------------------------------------------- * * EncodePNG -- | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 | (unsigned char *) Tcl_DStringValue(&buf), Tcl_DStringLength(&buf)) != TCL_OK) { Tcl_DStringFree(&buf); return TCL_ERROR; } Tcl_DStringFree(&buf); /* * Add a pHYs chunk if there is metadata for DPI and/or aspect * aspect = PPUy / PPUx * DPI = PPUx * 0.0254 * The physical chunk consists of: * - Points per meter in x direction (32 bit) * - Points per meter in x direction (32 bit) * - Unit specifier: 0: no unit (only aspect), 1: Points per meter */ if (metadataInObj != NULL) { Tcl_Obj *aspectObj, *DPIObj; double aspectValue=-1, DPIValue=-1; unsigned long PPUx = 65536, PPUy = 65536; char unitSpecifier; if (TCL_ERROR == Tcl_DictObjGet(interp, metadataInObj, Tcl_NewStringObj("aspect",-1), &aspectObj) || TCL_ERROR == Tcl_DictObjGet(interp, metadataInObj, Tcl_NewStringObj("DPI",-1), &DPIObj) ) { return TCL_ERROR; } if (DPIObj != NULL) { if (TCL_ERROR == Tcl_GetDoubleFromObj(interp, DPIObj, &DPIValue)) { return TCL_ERROR; } PPUx = (unsigned long)floor(DPIValue / 0.0254+0.5); if (aspectObj == NULL) { PPUy = PPUx; } unitSpecifier = 1; } if (aspectObj != NULL) { if (TCL_ERROR == Tcl_GetDoubleFromObj(interp, aspectObj, &aspectValue)) { return TCL_ERROR; } /* * aspect = PPUy / PPUx */ if (DPIObj == NULL) { unitSpecifier = 0; PPUx = 65536; PPUy = (unsigned long)floor(65536.0 * aspectValue+0.5); } else { PPUy = (unsigned long)floor(DPIValue * aspectValue / 0.0254+0.5); } } if (DPIObj != NULL || aspectObj != NULL) { unsigned char buffer[9]; if ( PPUx > 2147483647 || PPUy > 2147483647 ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "DPI or aspect out of range", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "PHYS", NULL); return TCL_ERROR; } LongToInt32(PPUx, buffer); LongToInt32(PPUy, buffer+4); buffer[8] = unitSpecifier; if (WriteChunk(interp, pngPtr, CHUNK_pHYs, buffer, 9) != TCL_OK) { return TCL_ERROR; } } } return TCL_OK; } /* *---------------------------------------------------------------------- * * EncodePNG -- |
︙ | ︙ | |||
3337 3338 3339 3340 3341 3342 3343 | *---------------------------------------------------------------------- */ static int EncodePNG( Tcl_Interp *interp, Tk_PhotoImageBlock *blockPtr, | | > | 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 | *---------------------------------------------------------------------- */ static int EncodePNG( Tcl_Interp *interp, Tk_PhotoImageBlock *blockPtr, PNGImage *pngPtr, Tcl_Obj *metadataInObj) { int greenOffset, blueOffset, alphaOffset; /* * Determine appropriate color type based on color usage (e.g., only red * and maybe alpha channel = grayscale). * |
︙ | ︙ | |||
3420 3421 3422 3423 3424 3425 3426 | } /* * Write out the extra chunks containing metadata that is of interest to * other programs more than us. */ | | | 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 | } /* * Write out the extra chunks containing metadata that is of interest to * other programs more than us. */ if (WriteExtraChunks(interp, pngPtr, metadataInObj) == TCL_ERROR) { return TCL_ERROR; } /* * Write out the image pixels in the IDAT (data) chunk. */ |
︙ | ︙ | |||
3461 3462 3463 3464 3465 3466 3467 | *---------------------------------------------------------------------- */ static int FileWritePNG( Tcl_Interp *interp, const char *filename, | > | < | 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 | *---------------------------------------------------------------------- */ static int FileWritePNG( Tcl_Interp *interp, const char *filename, TCL_UNUSED(Tcl_Obj *), Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr) { Tcl_Channel chan; PNGImage png; int result = TCL_ERROR; /* * Open a Tcl file channel where the image data will be stored. Tk ought * to take care of this, and just provide a channel, but it doesn't. */ chan = Tcl_OpenFileChannel(interp, filename, "w", 0644); |
︙ | ︙ | |||
3503 3504 3505 3506 3507 3508 3509 | goto cleanup; } /* * Write the raw PNG data out to the file. */ | | | 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 | goto cleanup; } /* * Write the raw PNG data out to the file. */ result = EncodePNG(interp, blockPtr, &png, metadataInObj); cleanup: Tcl_Close(interp, chan); CleanupPNGImage(&png); return result; } |
︙ | ︙ | |||
3532 3533 3534 3535 3536 3537 3538 | * *---------------------------------------------------------------------- */ static int StringWritePNG( Tcl_Interp *interp, | > | < | | 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 | * *---------------------------------------------------------------------- */ static int StringWritePNG( Tcl_Interp *interp, TCL_UNUSED(Tcl_Obj *), Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr) { Tcl_Obj *resultObj = Tcl_NewObj(); PNGImage png; int result = TCL_ERROR; /* * Initalize PNGImage instance for encoding. */ if (InitPNGImage(interp, &png, NULL, resultObj, TCL_ZLIB_STREAM_DEFLATE) == TCL_ERROR) { goto cleanup; } /* * Write the raw PNG data into the prepared Tcl_Obj buffer. Set the result * back to the interpreter if successful. */ result = EncodePNG(interp, blockPtr, &png, metadataInObj); if (TCL_OK == result) { Tcl_SetObjResult(interp, png.objDataPtr); } cleanup: CleanupPNGImage(&png); |
︙ | ︙ |
Changes to generic/tkImgPPM.c.
1 2 3 4 5 | /* * tkImgPPM.c -- * * A photo image file handler for PPM (Portable PixMap) files. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkImgPPM.c -- * * A photo image file handler for PPM (Portable PixMap) files. * * Copyright © 1994 The Australian National University. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Author: Paul Mackerras ([email protected]), * Department of Computer Science, * Australian National University. |
︙ | ︙ | |||
197 198 199 200 201 202 203 | if (Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height) != TCL_OK) { return TCL_ERROR; } if (srcY > 0) { | | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | if (Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height) != TCL_OK) { return TCL_ERROR; } if (srcY > 0) { Tcl_Seek(chan, (long long)srcY * block.pitch, SEEK_CUR); } nLines = (MAX_MEMORY + block.pitch - 1) / block.pitch; if (nLines > height) { nLines = height; } if (nLines <= 0) { |
︙ | ︙ | |||
237 238 239 240 241 242 243 | for (p = pixelPtr; count > 0; count--, p++) { *p = (((int) *p) * 255)/maxIntensity; } } else if (maxIntensity > 0x00ff) { unsigned char *p; unsigned int value; | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | for (p = pixelPtr; count > 0; count--, p++) { *p = (((int) *p) * 255)/maxIntensity; } } else if (maxIntensity > 0x00ff) { unsigned char *p; unsigned int value; for (p = pixelPtr; count > 0; count -= 2, p += 2) { value = ((unsigned int) p[0]) * 256 + ((unsigned int) p[1]); value = value * 255 / maxIntensity; p[0] = p[1] = (unsigned char) value; } } block.height = nLines; if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, |
︙ | ︙ | |||
600 601 602 603 604 605 606 | if (maxIntensity < 0x00ff) { for (p=pixelPtr,count=nBytes ; count>0 ; count--,p++,dataBuffer++) { *p = (((int) *dataBuffer) * 255)/maxIntensity; } } else { unsigned int value; | | | | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | if (maxIntensity < 0x00ff) { for (p=pixelPtr,count=nBytes ; count>0 ; count--,p++,dataBuffer++) { *p = (((int) *dataBuffer) * 255)/maxIntensity; } } else { unsigned int value; for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2, dataBuffer += 2) { value = ((unsigned int)dataBuffer[0]) * 256 + ((unsigned int)dataBuffer[1]); value = value * 255 / maxIntensity; p[0] = p[1] = (unsigned char) value; } } dataSize -= nBytes; block.height = nLines; if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, |
︙ | ︙ | |||
763 764 765 766 767 768 769 | { #define BUFFER_SIZE 1000 char buffer[BUFFER_SIZE], c; int i, numFields, type = 0; TkSizeT dataSize; unsigned char *dataBuffer; | | | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | { #define BUFFER_SIZE 1000 char buffer[BUFFER_SIZE], c; int i, numFields, type = 0; TkSizeT dataSize; unsigned char *dataBuffer; dataBuffer = Tcl_GetByteArrayFromObj(dataPtr, &dataSize); /* * Read 4 space-separated fields from the string, ignoring comments (any * line that starts with "#"). */ if (dataSize-- < 1) { |
︙ | ︙ |
Changes to generic/tkImgPhInstance.c.
1 2 3 4 5 6 7 | /* * tkImgPhInstance.c -- * * Implements the rendering of images of type "photo" for Tk. Photo * images are stored in full color (32 bits per pixel including alpha * channel) and displayed using dithering if necessary. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tkImgPhInstance.c -- * * Implements the rendering of images of type "photo" for Tk. Photo * images are stored in full color (32 bits per pixel including alpha * channel) and displayed using dithering if necessary. * * Copyright © 1994 The Australian National University. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2002-2008 Donal K. Fellows * Copyright © 2003 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Author: Paul Mackerras ([email protected]), * Department of Computer Science, * Australian National University. |
︙ | ︙ | |||
34 35 36 37 38 39 40 | #endif #endif /* * Forward declarations */ | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #endif #endif /* * Forward declarations */ #ifndef TK_CAN_RENDER_RGBA static void BlendComplexAlpha(XImage *bgImg, PhotoInstance *iPtr, int xOffset, int yOffset, int width, int height); #endif static int IsValidPalette(PhotoInstance *instancePtr, const char *palette); static int CountBits(unsigned mask); static void GetColorTable(PhotoInstance *instancePtr); |
︙ | ︙ | |||
412 413 414 415 416 417 418 | * whereas RGB15 is the correct version and works for 15bpp+, but it * slower, so it's only used for 15bpp+. * * Note that Win32 pre-defines those operations that we really need. * *---------------------------------------------------------------------- */ | | | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | * whereas RGB15 is the correct version and works for 15bpp+, but it * slower, so it's only used for 15bpp+. * * Note that Win32 pre-defines those operations that we really need. * *---------------------------------------------------------------------- */ #ifndef TK_CAN_RENDER_RGBA #ifndef _WIN32 #define GetRValue(rgb) (UCHAR(((rgb) & red_mask) >> red_shift)) #define GetGValue(rgb) (UCHAR(((rgb) & green_mask) >> green_shift)) #define GetBValue(rgb) (UCHAR(((rgb) & blue_mask) >> blue_shift)) #define RGB(r, g, b) ((unsigned)( \ (UCHAR(r) << red_shift) | \ (UCHAR(g) << green_shift) | \ |
︙ | ︙ | |||
578 579 580 581 582 583 584 | } XPutPixel(bgImg, x, y, RGB(r, g, b)); } } } #undef ALPHA_BLEND } | | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | } XPutPixel(bgImg, x, y, RGB(r, g, b)); } } } #undef ALPHA_BLEND } #endif /* TK_CAN_RENDER_RGBA */ /* *---------------------------------------------------------------------- * * TkImgPhotoDisplay -- * * This function is invoked to draw a photo image. |
︙ | ︙ | |||
610 611 612 613 614 615 616 | * draw. */ int width, int height, /* Dimensions of region within image to * draw. */ int drawableX,int drawableY)/* Coordinates within drawable that correspond * to imageX and imageY. */ { PhotoInstance *instancePtr = (PhotoInstance *)clientData; | | | > | | > | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | * draw. */ int width, int height, /* Dimensions of region within image to * draw. */ int drawableX,int drawableY)/* Coordinates within drawable that correspond * to imageX and imageY. */ { PhotoInstance *instancePtr = (PhotoInstance *)clientData; #ifndef TK_CAN_RENDER_RGBA XVisualInfo visInfo = instancePtr->visualInfo; #endif /* * If there's no pixmap, it means that an error occurred while creating * the image instance so it can't be displayed. */ if (instancePtr->pixels == None) { return; } #ifdef TK_CAN_RENDER_RGBA /* * We can use TkpPutRGBAImage to render RGBA Ximages directly so there is * no need to call XGetImage or to do the Porter-Duff compositing by hand. */ unsigned char *rgbaPixels = instancePtr->modelPtr->pix32; XImage *photo = XCreateImage(display, NULL, 32, ZPixmap, 0, (char*)rgbaPixels, (unsigned int)instancePtr->width, (unsigned int)instancePtr->height, 0, (unsigned int)(4 * instancePtr->width)); TkpPutRGBAImage(display, drawable, instancePtr->gc, photo, imageX, imageY, drawableX, drawableY, (unsigned int) width, (unsigned int) height); photo->data = NULL; XDestroyImage(photo); #else if ((instancePtr->modelPtr->flags & COMPLEX_ALPHA) && visInfo.depth >= 15 && (visInfo.c_class == DirectColor || visInfo.c_class == TrueColor)) { Tk_ErrorHandler handler; XImage *bgImg = NULL; |
︙ | ︙ |
Changes to generic/tkImgPhoto.c.
1 2 3 4 5 6 7 | /* * tkImgPhoto.c -- * * Implements images of type "photo" for Tk. Photo images are stored in * full color (32 bits per pixel including alpha channel) and displayed * using dithering if necessary. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tkImgPhoto.c -- * * Implements images of type "photo" for Tk. Photo images are stored in * full color (32 bits per pixel including alpha channel) and displayed * using dithering if necessary. * * Copyright © 1994 The Australian National University. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2002-2003 Donal K. Fellows * Copyright © 2003 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Author: Paul Mackerras ([email protected]), * Department of Computer Science, * Australian National University. |
︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | int toX2, toY2; /* Second coordinate pair for -to option. */ int zoomX, zoomY; /* Values specified for -zoom option. */ int subsampleX, subsampleY; /* Values specified for -subsample option. */ Tcl_Obj *format; /* Value specified for -format option. */ XColor *background; /* Value specified for -background option. */ int compositingRule; /* Value specified for -compositingrule * option. */ }; /* * Bit definitions for use with ParseSubcommandOptions: each bit is set in the * allowedOptions parameter on a call to ParseSubcommandOptions if that option * is allowed for the current photo image subcommand. On return, the bit is * set in the options field of the SubcommandOptions structure if that option * was specified. * * OPT_ALPHA: Set if -alpha option allowed/specified. * OPT_BACKGROUND: Set if -format option allowed/specified. * OPT_COMPOSITE: Set if -compositingrule option allowed/spec'd. * OPT_FORMAT: Set if -format option allowed/specified. * OPT_FROM: Set if -from option allowed/specified. * OPT_GRAYSCALE: Set if -grayscale option allowed/specified. * OPT_SHRINK: Set if -shrink option allowed/specified. * OPT_SUBSAMPLE: Set if -subsample option allowed/spec'd. * OPT_TO: Set if -to option allowed/specified. * OPT_WITHALPHA: Set if -withalpha option allowed/specified. * OPT_ZOOM: Set if -zoom option allowed/specified. */ #define OPT_ALPHA 1 #define OPT_BACKGROUND 2 #define OPT_COMPOSITE 4 #define OPT_FORMAT 8 #define OPT_FROM 0x10 #define OPT_GRAYSCALE 0x20 | > > > | | | | | > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | int toX2, toY2; /* Second coordinate pair for -to option. */ int zoomX, zoomY; /* Values specified for -zoom option. */ int subsampleX, subsampleY; /* Values specified for -subsample option. */ Tcl_Obj *format; /* Value specified for -format option. */ XColor *background; /* Value specified for -background option. */ int compositingRule; /* Value specified for -compositingrule * option. */ Tcl_Obj *metadata; /* Value specified for -metadata option. */ }; /* * Bit definitions for use with ParseSubcommandOptions: each bit is set in the * allowedOptions parameter on a call to ParseSubcommandOptions if that option * is allowed for the current photo image subcommand. On return, the bit is * set in the options field of the SubcommandOptions structure if that option * was specified. * * OPT_ALPHA: Set if -alpha option allowed/specified. * OPT_BACKGROUND: Set if -format option allowed/specified. * OPT_COMPOSITE: Set if -compositingrule option allowed/spec'd. * OPT_FORMAT: Set if -format option allowed/specified. * OPT_FROM: Set if -from option allowed/specified. * OPT_GRAYSCALE: Set if -grayscale option allowed/specified. * OPT_METADATA: Set if -metadata option allowed/specified. * OPT_SHRINK: Set if -shrink option allowed/specified. * OPT_SUBSAMPLE: Set if -subsample option allowed/spec'd. * OPT_TO: Set if -to option allowed/specified. * OPT_WITHALPHA: Set if -withalpha option allowed/specified. * OPT_ZOOM: Set if -zoom option allowed/specified. */ #define OPT_ALPHA 1 #define OPT_BACKGROUND 2 #define OPT_COMPOSITE 4 #define OPT_FORMAT 8 #define OPT_FROM 0x10 #define OPT_GRAYSCALE 0x20 #define OPT_METADATA 0x40 #define OPT_SHRINK 0x80 #define OPT_SUBSAMPLE 0x100 #define OPT_TO 0x200 #define OPT_WITHALPHA 0x400 #define OPT_ZOOM 0x800 /* * List of option names. The order here must match the order of declarations * of the OPT_* constants above. */ static const char *const optionNames[] = { "-alpha", "-background", "-compositingrule", "-format", "-from", "-grayscale", "-metadata", "-shrink", "-subsample", "-to", "-withalpha", "-zoom", NULL }; |
︙ | ︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | /* Pointer to the first in the list of known * photo image formats.*/ #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 Tk_PhotoImageFormat *oldFormatList; /* Pointer to the first in the list of known * photo image formats.*/ #endif int initialized; /* Set to 1 if we've initialized the * structure. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Default configuration | > > > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | /* Pointer to the first in the list of known * photo image formats.*/ #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 Tk_PhotoImageFormat *oldFormatList; /* Pointer to the first in the list of known * photo image formats.*/ #endif Tk_PhotoImageFormatVersion3 *formatListVersion3; /* Pointer to the first in the list of known * photo image formats in Version3 format.*/ int initialized; /* Set to 1 if we've initialized the * structure. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Default configuration |
︙ | ︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | static int ImgPhotoSetSize(PhotoModel *modelPtr, int width, int height); static char * ImgGetPhoto(PhotoModel *modelPtr, Tk_PhotoImageBlock *blockPtr, struct SubcommandOptions *optPtr); static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *formatString, Tk_PhotoImageFormat **imageFormatPtr, int *widthPtr, int *heightPtr, int *oldformat); static int MatchStringFormat(Tcl_Interp *interp, Tcl_Obj *data, Tcl_Obj *formatString, Tk_PhotoImageFormat **imageFormatPtr, int *widthPtr, int *heightPtr, int *oldformat); static const char * GetExtension(const char *path); /* *---------------------------------------------------------------------- * * PhotoFormatThreadExitProc -- | > > > > > > | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | static int ImgPhotoSetSize(PhotoModel *modelPtr, int width, int height); static char * ImgGetPhoto(PhotoModel *modelPtr, Tk_PhotoImageBlock *blockPtr, struct SubcommandOptions *optPtr); static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *formatString, Tcl_Obj *metadataInObj, Tcl_Obj *metadataOutObj, Tk_PhotoImageFormat **imageFormatPtr, Tk_PhotoImageFormatVersion3 **imageFormatVersion3Ptr, int *widthPtr, int *heightPtr, int *oldformat); static int MatchStringFormat(Tcl_Interp *interp, Tcl_Obj *data, Tcl_Obj *formatString, Tcl_Obj *metadataInObj, Tcl_Obj *metadataOutObj, Tk_PhotoImageFormat **imageFormatPtr, Tk_PhotoImageFormatVersion3 **imageFormatVersion3Ptr, int *widthPtr, int *heightPtr, int *oldformat); static const char * GetExtension(const char *path); /* *---------------------------------------------------------------------- * * PhotoFormatThreadExitProc -- |
︙ | ︙ | |||
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | */ static void PhotoFormatThreadExitProc( TCL_UNUSED(void *)) /* not used */ { Tk_PhotoImageFormat *freePtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 while (tsdPtr->oldFormatList != NULL) { freePtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr; ckfree(freePtr); } #endif while (tsdPtr->formatList != NULL) { freePtr = tsdPtr->formatList; tsdPtr->formatList = tsdPtr->formatList->nextPtr; ckfree((char *)freePtr->name); ckfree(freePtr); } } /* *---------------------------------------------------------------------- * | > > > > > > > | > | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | */ static void PhotoFormatThreadExitProc( TCL_UNUSED(void *)) /* not used */ { Tk_PhotoImageFormat *freePtr; Tk_PhotoImageFormatVersion3 *freePtrVersion3; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 while (tsdPtr->oldFormatList != NULL) { freePtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr; ckfree(freePtr); } #endif while (tsdPtr->formatList != NULL) { freePtr = tsdPtr->formatList; tsdPtr->formatList = tsdPtr->formatList->nextPtr; ckfree((char *)freePtr->name); ckfree(freePtr); } while (tsdPtr->formatListVersion3 != NULL) { freePtrVersion3 = tsdPtr->formatListVersion3; tsdPtr->formatListVersion3 = tsdPtr->formatListVersion3->nextPtr; ckfree((char *)freePtrVersion3->name); ckfree(freePtrVersion3); } } /* *---------------------------------------------------------------------- * * Tk_CreateOldPhotoImageFormat, Tk_CreatePhotoImageFormat, * Tk_CreatePhotoImageFormatVersion3 -- * * This function is invoked by an image file handler to register a new * photo image format and the functions that handle the new format. The * function is typically invoked during Tcl_AppInit. * * Results: * None. |
︙ | ︙ | |||
312 313 314 315 316 317 318 319 320 321 322 323 324 325 | char *name = (char *)ckalloc(strlen(formatPtr->name) + 1); strcpy(name, formatPtr->name); copyPtr->name = name; copyPtr->nextPtr = tsdPtr->formatList; tsdPtr->formatList = copyPtr; } } /* *---------------------------------------------------------------------- * * ImgPhotoCreate -- * * This function is called by the Tk image code to create a new photo | > > > > > > > > > > > > > > > > > > > > > > > > > > | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | char *name = (char *)ckalloc(strlen(formatPtr->name) + 1); strcpy(name, formatPtr->name); copyPtr->name = name; copyPtr->nextPtr = tsdPtr->formatList; tsdPtr->formatList = copyPtr; } } void Tk_CreatePhotoImageFormatVersion3( const Tk_PhotoImageFormatVersion3 *formatPtr) /* Structure describing the format. All of the * fields except "nextPtr" must be filled in * by caller. */ { Tk_PhotoImageFormatVersion3 *copyPtr; char *name; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } copyPtr = (Tk_PhotoImageFormatVersion3 *) ckalloc(sizeof(Tk_PhotoImageFormatVersion3)); *copyPtr = *formatPtr; /* for compatibility with aMSN: make a copy of formatPtr->name */ name = (char *)ckalloc(strlen(formatPtr->name) + 1); strcpy(name, formatPtr->name); copyPtr->name = name; copyPtr->nextPtr = tsdPtr->formatListVersion3; tsdPtr->formatListVersion3 = copyPtr; } /* *---------------------------------------------------------------------- * * ImgPhotoCreate -- * * This function is called by the Tk image code to create a new photo |
︙ | ︙ | |||
415 416 417 418 419 420 421 422 423 424 425 426 427 428 | PhotoModel *modelPtr = (PhotoModel *)clientData; int result, index, x, y, width, height; struct SubcommandOptions options; unsigned char *pixelPtr; Tk_PhotoImageBlock block; Tk_PhotoImageFormat *imageFormat; TkSizeT length; int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | > | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | PhotoModel *modelPtr = (PhotoModel *)clientData; int result, index, x, y, width, height; struct SubcommandOptions options; unsigned char *pixelPtr; Tk_PhotoImageBlock block; Tk_PhotoImageFormat *imageFormat; Tk_PhotoImageFormatVersion3 *imageFormatVersion3; TkSizeT length; int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
453 454 455 456 457 458 459 | case PHOTO_CGET: { const char *arg; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } | | > > > > | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | case PHOTO_CGET: { const char *arg; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } arg = Tcl_GetStringFromObj(objv[2], &length); if (strncmp(arg,"-data", length) == 0) { if (modelPtr->dataString) { Tcl_SetObjResult(interp, modelPtr->dataString); } } else if (strncmp(arg,"-format", length) == 0) { if (modelPtr->format) { Tcl_SetObjResult(interp, modelPtr->format); } } else if (strncmp(arg, "-metadata", length) == 0) { if (modelPtr->metadata) { Tcl_SetObjResult(interp, modelPtr->metadata); } } else { Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, (char *) modelPtr, Tcl_GetString(objv[2]), 0); } return TCL_OK; } |
︙ | ︙ | |||
495 496 497 498 499 500 501 502 503 504 505 506 507 508 | } Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewStringObj("-format {} {} {}", 16); if (modelPtr->format) { Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format); } else { Tcl_AppendStringsToObj(subobj, " {}", NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp)); Tcl_SetObjResult(interp, obj); return TCL_OK; } else if (objc == 3) { | > > > > > > > | | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | } Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewStringObj("-format {} {} {}", 16); if (modelPtr->format) { Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format); } else { Tcl_AppendStringsToObj(subobj, " {}", NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewStringObj("-metadata {} {} {}", 16); if (modelPtr->metadata) { Tcl_ListObjAppendElement(NULL, subobj, modelPtr->metadata); } else { Tcl_AppendStringsToObj(subobj, " {}", NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp)); Tcl_SetObjResult(interp, obj); return TCL_OK; } else if (objc == 3) { const char *arg = Tcl_GetStringFromObj(objv[2], &length); if (length > 1 && !strncmp(arg, "-data", length)) { Tcl_AppendResult(interp, "-data {} {} {}", NULL); if (modelPtr->dataString) { /* * TODO: Modifying result is bad! */ |
︙ | ︙ | |||
527 528 529 530 531 532 533 534 535 536 537 538 539 540 | if (modelPtr->format) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), modelPtr->format); } else { Tcl_AppendResult(interp, " {}", NULL); } return TCL_OK; } else { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), configSpecs, (char *) modelPtr, arg, 0); | > > > > > > > > > > > > > > | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | if (modelPtr->format) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), modelPtr->format); } else { Tcl_AppendResult(interp, " {}", NULL); } return TCL_OK; } else if (length > 1 && !strncmp(arg, "-metadata", length)) { Tcl_AppendResult(interp, "-metadata {} {} {}", NULL); if (modelPtr->metadata) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), modelPtr->metadata); } else { Tcl_AppendResult(interp, " {}", NULL); } return TCL_OK; } else { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), configSpecs, (char *) modelPtr, arg, 0); |
︙ | ︙ | |||
580 581 582 583 584 585 586 | Tcl_GetString(options.name), NULL); return TCL_ERROR; } Tk_PhotoGetImage(srcHandle, &block); if ((options.fromX2 > block.width) || (options.fromY2 > block.height) || (options.fromX2 > block.width) || (options.fromY2 > block.height)) { | < < < | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | Tcl_GetString(options.name), NULL); return TCL_ERROR; } Tk_PhotoGetImage(srcHandle, &block); if ((options.fromX2 > block.width) || (options.fromY2 > block.height) || (options.fromX2 > block.width) || (options.fromY2 > block.height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside source image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
635 636 637 638 639 640 641 | options.toY2 = options.toY + height * options.zoomY; } /* * Copy the image data over using Tk_PhotoPutZoomedBlock. */ | > | | | | | | | | | > > > < < < > | | < < > > > | > > > > > > > > > > > > > > > > > | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | options.toY2 = options.toY + height * options.zoomY; } /* * Copy the image data over using Tk_PhotoPutZoomedBlock. */ if (block.pixelPtr) { block.pixelPtr += options.fromX * block.pixelSize + options.fromY * block.pitch; block.width = options.fromX2 - options.fromX; block.height = options.fromY2 - options.fromY; result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) modelPtr, &block, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, options.zoomX, options.zoomY, options.subsampleX, options.subsampleY, options.compositingRule); } else { result = TCL_OK; } /* * Set the destination image size if the -shrink option was specified. * This has to be done _after_ copying the data. Otherwise, if source * and destination are the same image, block.pixelPtr would point to * an invalid memory block (bug [5239fd749b]). */ if (options.options & OPT_SHRINK) { if (ImgPhotoSetSize(modelPtr, options.toX2, options.toY2) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } } if (block.pixelPtr || (options.options & OPT_SHRINK)) { Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); } return result; case PHOTO_DATA: { char *data = NULL; Tcl_Obj *freeObj = NULL; Tcl_Obj *metadataIn; /* * photo data command - first parse and check any options given. */ Tk_ImageStringWriteProc *stringWriteProc = NULL; Tk_ImageStringWriteProcVersion3 *stringWriteProcVersion3 = NULL; index = 1; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; options.metadata = NULL; options.fromX = 0; options.fromY = 0; if (ParseSubcommandOptions(&options, interp, OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND | OPT_METADATA, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if ((options.name == NULL) || (index < objc)) { Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?"); if (options.background) { Tk_FreeColor(options.background); } return TCL_ERROR; } if ((options.fromX > modelPtr->width) || (options.fromY > modelPtr->height) || (options.fromX2 > modelPtr->width) || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); if (options.background) { Tk_FreeColor(options.background); } return TCL_ERROR; } /* * Fill in default values for unspecified parameters. */ if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) { options.fromX2 = modelPtr->width; options.fromY2 = modelPtr->height; } if (!(options.options & OPT_FORMAT)) { options.format = Tcl_NewStringObj("default", -1); freeObj = options.format; } /* * Use argument metadata if specified, otherwise the master metadata */ if (NULL != options.metadata) { metadataIn = options.metadata; } else { metadataIn = modelPtr->metadata; } /* * Search for an appropriate image string format handler. */ matched = 0; for (imageFormat = tsdPtr->formatList; imageFormat != NULL; |
︙ | ︙ | |||
753 754 755 756 757 758 759 760 | break; } } } } #endif if (stringWriteProc == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( | > > > > > > > > > > > > > > > > > | | | | > > > | | 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 | break; } } } } #endif if (stringWriteProc == NULL) { oldformat = 0; for (imageFormatVersion3 = tsdPtr->formatListVersion3; imageFormatVersion3 != NULL; imageFormatVersion3 = imageFormatVersion3->nextPtr) { if ((strncasecmp(Tcl_GetString(options.format), imageFormatVersion3->name, strlen(imageFormatVersion3->name)) == 0)) { matched = 1; if (imageFormatVersion3->stringWriteProc != NULL) { stringWriteProcVersion3 = imageFormatVersion3->stringWriteProc; break; } } } } if (stringWriteProc == NULL && stringWriteProcVersion3 == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image string format \"%s\" is %s", Tcl_GetString(options.format), (matched ? "not supported" : "unknown"))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", Tcl_GetString(options.format), NULL); goto dataErrorExit; } /* * Call the handler's string write function to write out the image. */ data = ImgGetPhoto(modelPtr, &block, &options); if (stringWriteProc == NULL) { result = (stringWriteProcVersion3)(interp, options.format, metadataIn, &block); } else if (oldformat) { Tcl_DString buffer; typedef int (*OldStringWriteProc)(Tcl_Interp *interp, Tcl_DString *dataPtr, const char *formatString, Tk_PhotoImageBlock *blockPtr); Tcl_DStringInit(&buffer); result = ((OldStringWriteProc)(void *)stringWriteProc)(interp, &buffer, |
︙ | ︙ | |||
796 797 798 799 800 801 802 | } if (options.background) { Tk_FreeColor(options.background); } if (data) { ckfree(data); } | | | | | | | | | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | } if (options.background) { Tk_FreeColor(options.background); } if (data) { ckfree(data); } if (freeObj != NULL) { Tcl_DecrRefCount(freeObj); } return result; dataErrorExit: if (options.background) { Tk_FreeColor(options.background); } if (data) { ckfree(data); } if (freeObj != NULL) { Tcl_DecrRefCount(freeObj); } return TCL_ERROR; } case PHOTO_GET: { /* * photo get command - first parse and check parameters. */ |
︙ | ︙ | |||
875 876 877 878 879 880 881 | * photo put command - first parse the options. */ index = 2; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; | > | > | > | > | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | * photo put command - first parse the options. */ index = 2; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; options.metadata = NULL; if (ParseSubcommandOptions(&options, interp, OPT_TO|OPT_FORMAT|OPT_METADATA, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if ((options.name == NULL) || (index < objc)) { Tcl_WrongNumArgs(interp, 2, objv, "data ?-option value ...?"); return TCL_ERROR; } /* * See if there's a format that can read the data */ if (MatchStringFormat(interp, objv[2], options.format, options.metadata, NULL, &imageFormat, &imageFormatVersion3, &imageWidth, &imageHeight, &oldformat) != TCL_OK) { return TCL_ERROR; } if (!(options.options & OPT_TO) || (options.toX2 < 0)) { options.toX2 = options.toX + imageWidth; options.toY2 = options.toY + imageHeight; } |
︙ | ︙ | |||
912 913 914 915 916 917 918 | if (oldformat) { if (format) { format = (Tcl_Obj *) Tcl_GetString(format); } data = (Tcl_Obj *) Tcl_GetString(data); } | > | | | | | | > > > > > > > > > > > > | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 | if (oldformat) { if (format) { format = (Tcl_Obj *) Tcl_GetString(format); } data = (Tcl_Obj *) Tcl_GetString(data); } if (imageFormat != NULL) { if (imageFormat->stringReadProc(interp, data, format, (Tk_PhotoHandle) modelPtr, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, 0, 0) != TCL_OK) { return TCL_ERROR; } } else { if (imageFormatVersion3->stringReadProc(interp, data, format, options.metadata, (Tk_PhotoHandle) modelPtr, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, 0, 0, NULL) != TCL_OK) { return TCL_ERROR; } } /* * SB: is the next line really needed? The stringReadProc * writes image data with Tk_PhotoPutBlock(), which in turn * takes care to notify the changed image and to set/unset the * IMAGE_CHANGED bit. */ modelPtr->flags |= IMAGE_CHANGED; |
︙ | ︙ | |||
939 940 941 942 943 944 945 946 | * photo read command - first parse the options specified. */ index = 2; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; if (ParseSubcommandOptions(&options, interp, | > | | 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | * photo read command - first parse the options specified. */ index = 2; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; options.metadata = NULL; if (ParseSubcommandOptions(&options, interp, OPT_FORMAT | OPT_FROM | OPT_TO | OPT_SHRINK | OPT_METADATA, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if ((options.name == NULL) || (index < objc)) { Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
981 982 983 984 985 986 987 | if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") != TCL_OK) { Tcl_Close(NULL, chan); return TCL_ERROR; } if (MatchFileFormat(interp, chan, | | > | < > | > < | > < | > > | | | | > > > > > > > > | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") != TCL_OK) { Tcl_Close(NULL, chan); return TCL_ERROR; } if (MatchFileFormat(interp, chan, Tcl_GetString(options.name), options.format, options.metadata, NULL, &imageFormat, &imageFormatVersion3, &imageWidth, &imageHeight, &oldformat) != TCL_OK) { result = TCL_ERROR; goto readCleanup; } /* * Check the values given for the -from option. */ if ((options.fromX > imageWidth) || (options.fromY > imageHeight) || (options.fromX2 > imageWidth) || (options.fromY2 > imageHeight)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside source image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); result = TCL_ERROR; goto readCleanup; } if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) { width = imageWidth - options.fromX; height = imageHeight - options.fromY; } else { width = options.fromX2 - options.fromX; height = options.fromY2 - options.fromY; } /* * If the -shrink option was specified, set the size of the image. */ if (options.options & OPT_SHRINK) { if (ImgPhotoSetSize(modelPtr, options.toX + width, options.toY + height) != TCL_OK) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); result = TCL_ERROR; goto readCleanup; } } /* * Call the handler's file read function to read the data into the * image. */ format = options.format; if (oldformat && format) { format = (Tcl_Obj *) Tcl_GetString(format); } if (imageFormat != NULL) { result = imageFormat->fileReadProc(interp, chan, Tcl_GetString(options.name), format, (Tk_PhotoHandle) modelPtr, options.toX, options.toY, width, height, options.fromX, options.fromY); } else { result = imageFormatVersion3->fileReadProc(interp, chan, Tcl_GetString(options.name), format, options.metadata, (Tk_PhotoHandle) modelPtr, options.toX, options.toY, width, height, options.fromX, options.fromY, NULL); } readCleanup: if (chan != NULL) { Tcl_Close(NULL, chan); } return result; } case PHOTO_REDITHER: |
︙ | ︙ | |||
1267 1268 1269 1270 1271 1272 1273 | } Tcl_Panic("unexpected fallthrough"); } case PHOTO_WRITE: { char *data; const char *fmtString; | | | 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | } Tcl_Panic("unexpected fallthrough"); } case PHOTO_WRITE: { char *data; const char *fmtString; Tcl_Obj *format, *metadataIn; int usedExt; /* * Prevent file system access in safe interpreters. */ if (Tcl_IsSafe(interp)) { |
︙ | ︙ | |||
1289 1290 1291 1292 1293 1294 1295 1296 | * photo write command - first parse and check any options given. */ index = 2; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; if (ParseSubcommandOptions(&options, interp, | > | > > > > > > > | 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 | * photo write command - first parse and check any options given. */ index = 2; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; options.metadata = NULL; if (ParseSubcommandOptions(&options, interp, OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND | OPT_METADATA, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if ((options.name == NULL) || (index < objc)) { Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?"); if (options.background) { Tk_FreeColor(options.background); } return TCL_ERROR; } if ((options.fromX > modelPtr->width) || (options.fromY > modelPtr->height) || (options.fromX2 > modelPtr->width) || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); if (options.background) { Tk_FreeColor(options.background); } return TCL_ERROR; } /* * Fill in default values for unspecified parameters. Note that a * missing -format flag results in us having a guess from the file * extension. [Bug 2983824] |
︙ | ︙ | |||
1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 | fmtString = GetExtension(Tcl_GetString(options.name)); usedExt = (fmtString != NULL); } else { fmtString = Tcl_GetString(options.format); usedExt = 0; } /* * Search for an appropriate image file format handler, and give an * error if none is found. */ matched = 0; redoFormatLookup: for (imageFormat = tsdPtr->formatList; imageFormat != NULL; imageFormat = imageFormat->nextPtr) { if ((fmtString == NULL) || (strncasecmp(fmtString, imageFormat->name, strlen(imageFormat->name)) == 0)) { matched = 1; if (imageFormat->fileWriteProc != NULL) { | > > > > > > > > > > > > | 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 | fmtString = GetExtension(Tcl_GetString(options.name)); usedExt = (fmtString != NULL); } else { fmtString = Tcl_GetString(options.format); usedExt = 0; } /* * Use argument metadata if specified, otherwise the master metadata */ if (NULL != options.metadata) { metadataIn = options.metadata; } else { metadataIn = modelPtr->metadata; } /* * Search for an appropriate image file format handler, and give an * error if none is found. */ matched = 0; redoFormatLookup: imageFormatVersion3 = NULL; for (imageFormat = tsdPtr->formatList; imageFormat != NULL; imageFormat = imageFormat->nextPtr) { if ((fmtString == NULL) || (strncasecmp(fmtString, imageFormat->name, strlen(imageFormat->name)) == 0)) { matched = 1; if (imageFormat->fileWriteProc != NULL) { |
︙ | ︙ | |||
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | if (imageFormat->fileWriteProc != NULL) { break; } } } } #endif if (usedExt && !matched) { /* * If we didn't find one and we're using file extensions as the * basis for the guessing, go back and look again without * prejudice. Supports old broken code. */ usedExt = 0; fmtString = NULL; goto redoFormatLookup; } | > > > > > > > > > > > > > > > | > > > > | | > > > > > | 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | if (imageFormat->fileWriteProc != NULL) { break; } } } } #endif if (imageFormat == NULL) { oldformat = 0; for (imageFormatVersion3 = tsdPtr->formatListVersion3; imageFormatVersion3 != NULL; imageFormatVersion3 = imageFormatVersion3->nextPtr) { if ((fmtString == NULL) || (strncasecmp(fmtString, imageFormatVersion3->name, strlen(imageFormatVersion3->name)) == 0)) { matched = 1; if (imageFormatVersion3->fileWriteProc != NULL) { break; } } } } if (usedExt && !matched) { /* * If we didn't find one and we're using file extensions as the * basis for the guessing, go back and look again without * prejudice. Supports old broken code. */ usedExt = 0; fmtString = NULL; goto redoFormatLookup; } if (imageFormat == NULL && imageFormatVersion3 == NULL) { if (fmtString == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "no available image file format has file writing" " capability", -1)); } else if (!matched) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image file format \"%s\" is unknown", fmtString)); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image file format \"%s\" has no file writing capability", fmtString)); } Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", fmtString, NULL); if (options.background) { Tk_FreeColor(options.background); } return TCL_ERROR; } /* * Call the handler's file write function to write out the image. */ data = ImgGetPhoto(modelPtr, &block, &options); format = options.format; if (oldformat && format) { format = (Tcl_Obj *) Tcl_GetString(options.format); } if (imageFormat != NULL) { result = imageFormat->fileWriteProc(interp, Tcl_GetString(options.name), format, &block); } else { result = imageFormatVersion3->fileWriteProc(interp, Tcl_GetString(options.name), format, metadataIn, &block); } if (options.background) { Tk_FreeColor(options.background); } if (data) { ckfree(data); } return result; |
︙ | ︙ | |||
1451 1452 1453 1454 1455 1456 1457 | /* *---------------------------------------------------------------------- * * ParseSubcommandOptions -- * * This function is invoked to process one of the options which may be * specified for the photo image subcommands, namely, -from, -to, -zoom, | | | | 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | /* *---------------------------------------------------------------------- * * ParseSubcommandOptions -- * * This function is invoked to process one of the options which may be * specified for the photo image subcommands, namely, -from, -to, -zoom, * -subsample, -format, -shrink, -compositingrule, -alpha, -boolean, * -withalpha and -metadata. * Parsing starts at the index in *optIndexPtr and stops at the end of * objv[] or at the first value that does not belong to an option. * * Results: * A standard Tcl result. * * Side effects: |
︙ | ︙ | |||
1499 1500 1501 1502 1503 1504 1505 | for (index = *optIndexPtr; index < objc; *optIndexPtr = ++index) { /* * We can have one value specified without an option; it goes into * optPtr->name. */ | | | 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 | for (index = *optIndexPtr; index < objc; *optIndexPtr = ++index) { /* * We can have one value specified without an option; it goes into * optPtr->name. */ expandedOption = option = Tcl_GetStringFromObj(objv[index], &length); if (option[0] != '-') { if (optPtr->name == NULL) { optPtr->name = objv[index]; continue; } break; } |
︙ | ︙ | |||
1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 | */ if (index + 1 >= objc) { goto oneValueRequired; } *optIndexPtr = ++index; optPtr->format = objv[index]; } else if (bit == OPT_COMPOSITE) { /* * The -compositingrule option takes a single value from a * well-known set. */ if (index + 1 >= objc) { | > > > > > > > > > > > | 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 | */ if (index + 1 >= objc) { goto oneValueRequired; } *optIndexPtr = ++index; optPtr->format = objv[index]; } else if (bit == OPT_METADATA) { /* * The -metadata option takes a single dict value. Note that * parsing this is outside the scope of this function. */ if (index + 1 >= objc) { goto oneValueRequired; } *optIndexPtr = ++index; optPtr->metadata = objv[index]; } else if (bit == OPT_COMPOSITE) { /* * The -compositingrule option takes a single value from a * well-known set. */ if (index + 1 >= objc) { |
︙ | ︙ | |||
1766 1767 1768 1769 1770 1771 1772 | int objc, /* Number of entries in objv. */ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */ int flags) /* Flags to pass to Tk_ConfigureWidget, such * as TK_CONFIG_ARGV_ONLY. */ { PhotoInstance *instancePtr; const char *oldFileString, *oldPaletteString; | | > > | | 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 | int objc, /* Number of entries in objv. */ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */ int flags) /* Flags to pass to Tk_ConfigureWidget, such * as TK_CONFIG_ARGV_ONLY. */ { PhotoInstance *instancePtr; const char *oldFileString, *oldPaletteString; Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL, *metadataInObj = NULL, *metadataOutObj = NULL; Tcl_Obj *tempdata, *tempformat; TkSizeT length; int i, j, result, imageWidth, imageHeight, oldformat; double oldGamma; Tcl_Channel chan; Tk_PhotoImageFormat *imageFormat; Tk_PhotoImageFormatVersion3 *imageFormatVersion3; const char **args; args = (const char **)ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { args[j] = Tcl_GetStringFromObj(objv[i], &length); if ((length > 1) && (args[j][0] == '-')) { if ((args[j][1] == 'd') && !strncmp(args[j], "-data", length)) { if (++i < objc) { data = objv[i]; j--; } else { |
︙ | ︙ | |||
1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 | } else { ckfree(args); Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-format\" missing", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; } } } } /* * Save the current values for fileString and dataString, so we can tell | > > > > > > > > > > > > > | 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 | } else { ckfree(args); Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-format\" missing", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; } } else if ((args[j][1] == 'm') && !strncmp(args[j], "-metadata", length)) { if (++i < objc) { metadataInObj = objv[i]; j--; } else { ckfree(args); Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-metadata\" missing", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; } } } } /* * Save the current values for fileString and dataString, so we can tell |
︙ | ︙ | |||
1844 1845 1846 1847 1848 1849 1850 | j, args, (char *) modelPtr, flags) != TCL_OK) { ckfree(args); goto errorExit; } ckfree(args); /* | | | | 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 | j, args, (char *) modelPtr, flags) != TCL_OK) { ckfree(args); goto errorExit; } ckfree(args); /* * Regard the empty string for -file, -data, -format or -metadata as the null value. */ if ((modelPtr->fileString != NULL) && (modelPtr->fileString[0] == 0)) { ckfree(modelPtr->fileString); modelPtr->fileString = NULL; } if (data) { /* * Force into ByteArray format, which most (all) image handlers will * use anyway. Empty length means ignore the -data option. */ TkSizeT bytesize; (void) Tcl_GetByteArrayFromObj(data, &bytesize); if (bytesize) { Tcl_IncrRefCount(data); } else { data = NULL; } if (modelPtr->dataString) { Tcl_DecrRefCount(modelPtr->dataString); |
︙ | ︙ | |||
1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 | format = NULL; } if (modelPtr->format) { Tcl_DecrRefCount(modelPtr->format); } modelPtr->format = format; } /* * Set the image to the user-requested size, if any, and make sure storage * is correctly allocated for this image. */ if (ImgPhotoSetSize(modelPtr, modelPtr->width, modelPtr->height) != TCL_OK) { | > > > > > > > > > > > > > > > > > > > > > > > > > > | 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 | format = NULL; } if (modelPtr->format) { Tcl_DecrRefCount(modelPtr->format); } modelPtr->format = format; } if (metadataInObj) { /* * Make -metadata a dict. * Take also empty metadatas as this may be a sign to replace * existing metadata. */ int dictSize; if (TCL_OK != Tcl_DictObjSize(interp,metadataInObj, &dictSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-metadata\" not a dict", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", NULL); return TCL_ERROR; } if (dictSize > 0) { Tcl_IncrRefCount(metadataInObj); } else { metadataInObj = NULL; } if (modelPtr->metadata) { Tcl_DecrRefCount(modelPtr->metadata); } modelPtr->metadata = metadataInObj; } /* * Set the image to the user-requested size, if any, and make sure storage * is correctly allocated for this image. */ if (ImgPhotoSetSize(modelPtr, modelPtr->width, modelPtr->height) != TCL_OK) { |
︙ | ︙ | |||
1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 | } chan = Tcl_OpenFileChannel(interp, modelPtr->fileString, "r", 0); if (chan == NULL) { goto errorExit; } /* * -translation binary also sets -encoding binary */ if ((Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) || (MatchFileFormat(interp, chan, modelPtr->fileString, | > > > > > > > > | | > | | > | > > > > > > > > > > > > > > > > | > | | | | | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 | } chan = Tcl_OpenFileChannel(interp, modelPtr->fileString, "r", 0); if (chan == NULL) { goto errorExit; } /* * Flag that we want the metadata result dict */ metadataOutObj = Tcl_NewDictObj(); Tcl_IncrRefCount(metadataOutObj); /* * -translation binary also sets -encoding binary */ if ((Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) || (MatchFileFormat(interp, chan, modelPtr->fileString, modelPtr->format, modelPtr->metadata, metadataOutObj, &imageFormat, &imageFormatVersion3, &imageWidth, &imageHeight, &oldformat) != TCL_OK)) { Tcl_Close(NULL, chan); goto errorExit; } result = ImgPhotoSetSize(modelPtr, imageWidth, imageHeight); if (result != TCL_OK) { Tcl_Close(NULL, chan); Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } tempformat = modelPtr->format; if (oldformat && tempformat) { tempformat = (Tcl_Obj *) Tcl_GetString(tempformat); } if (imageFormat != NULL) { result = imageFormat->fileReadProc(interp, chan, modelPtr->fileString, tempformat, (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight, 0, 0); } else { result = imageFormatVersion3->fileReadProc(interp, chan, modelPtr->fileString, tempformat, modelPtr->metadata, (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight, 0, 0, metadataOutObj); } Tcl_Close(NULL, chan); if (result != TCL_OK) { goto errorExit; } Tcl_ResetResult(interp); modelPtr->flags |= IMAGE_CHANGED; } if ((modelPtr->fileString == NULL) && (modelPtr->dataString != NULL) && ((modelPtr->dataString != oldData) || (modelPtr->format != oldFormat))) { /* * Flag that we want the metadata result dict */ metadataOutObj = Tcl_NewDictObj(); Tcl_IncrRefCount(metadataOutObj); if (MatchStringFormat(interp, modelPtr->dataString, modelPtr->format, modelPtr->metadata, metadataOutObj, &imageFormat, &imageFormatVersion3, &imageWidth, &imageHeight, &oldformat) != TCL_OK) { goto errorExit; } if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } tempformat = modelPtr->format; tempdata = modelPtr->dataString; if (oldformat) { if (tempformat) { tempformat = (Tcl_Obj *) Tcl_GetString(tempformat); } tempdata = (Tcl_Obj *) Tcl_GetString(tempdata); } if (imageFormat != NULL) { if (imageFormat->stringReadProc(interp, tempdata, tempformat, (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight, 0, 0) != TCL_OK) { goto errorExit; } } else { if (imageFormatVersion3->stringReadProc(interp, tempdata, tempformat, modelPtr->metadata, (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight, 0, 0, metadataOutObj) != TCL_OK) { goto errorExit; } } Tcl_ResetResult(interp); modelPtr->flags |= IMAGE_CHANGED; } /* * Merge driver returned metadata and master metadata */ if (metadataOutObj != NULL) { int dictSize; if (TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "driver metadata not a dict", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", NULL); goto errorExit; } if (dictSize > 0) { /* * We have driver return metadata */ if (modelPtr->metadata == NULL) { modelPtr->metadata = metadataOutObj; metadataOutObj = NULL; } else { Tcl_DictSearch search; Tcl_Obj *key, *value; int done; if (Tcl_IsShared(modelPtr->metadata)) { Tcl_DecrRefCount(modelPtr->metadata); modelPtr->metadata = Tcl_DuplicateObj(modelPtr->metadata); Tcl_IncrRefCount(modelPtr->metadata); } if (Tcl_DictObjFirst(interp, metadataOutObj, &search, &key, &value, &done) != TCL_OK) { goto errorExit; } for (; !done ; Tcl_DictObjNext(&search, &key, &value, &done)) { Tcl_DictObjPut(interp, modelPtr->metadata, key, value); } } } } /* * Enforce a reasonable value for gamma. */ if (modelPtr->gamma <= 0) { modelPtr->gamma = 1.0; |
︙ | ︙ | |||
2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 | if (oldData != NULL) { Tcl_DecrRefCount(oldData); } if (oldFormat != NULL) { Tcl_DecrRefCount(oldFormat); } ToggleComplexAlphaIfNeeded(modelPtr); return TCL_OK; errorExit: if (oldData != NULL) { Tcl_DecrRefCount(oldData); } if (oldFormat != NULL) { Tcl_DecrRefCount(oldFormat); } return TCL_ERROR; } /* *---------------------------------------------------------------------- * * ToggleComplexAlphaIfNeeded -- | > > > > > > | 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 | if (oldData != NULL) { Tcl_DecrRefCount(oldData); } if (oldFormat != NULL) { Tcl_DecrRefCount(oldFormat); } if (metadataOutObj != NULL) { Tcl_DecrRefCount(metadataOutObj); } ToggleComplexAlphaIfNeeded(modelPtr); return TCL_OK; errorExit: if (oldData != NULL) { Tcl_DecrRefCount(oldData); } if (oldFormat != NULL) { Tcl_DecrRefCount(oldFormat); } if (metadataOutObj != NULL) { Tcl_DecrRefCount(metadataOutObj); } return TCL_ERROR; } /* *---------------------------------------------------------------------- * * ToggleComplexAlphaIfNeeded -- |
︙ | ︙ | |||
2072 2073 2074 2075 2076 2077 2078 | static int ToggleComplexAlphaIfNeeded( PhotoModel *mPtr) { size_t len = (size_t)MAX(mPtr->userWidth, mPtr->width) * (size_t)MAX(mPtr->userHeight, mPtr->height) * 4; unsigned char *c = mPtr->pix32; | | > | 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 | static int ToggleComplexAlphaIfNeeded( PhotoModel *mPtr) { size_t len = (size_t)MAX(mPtr->userWidth, mPtr->width) * (size_t)MAX(mPtr->userHeight, mPtr->height) * 4; unsigned char *c = mPtr->pix32; unsigned char *end; /* * Set the COMPLEX_ALPHA flag if we have an image with partially * transparent bits. */ mPtr->flags &= ~COMPLEX_ALPHA; if (c == NULL) { return 0; } end = c + len; c += 3; /* Start at first alpha byte. */ for (; c < end; c += 4) { if (*c && *c != 255) { mPtr->flags |= COMPLEX_ALPHA; break; } } |
︙ | ︙ | |||
2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 | } if (modelPtr->dataString != NULL) { Tcl_DecrRefCount(modelPtr->dataString); } if (modelPtr->format != NULL) { Tcl_DecrRefCount(modelPtr->format); } Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); ckfree(modelPtr); } /* *---------------------------------------------------------------------- * | > > > | 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 | } if (modelPtr->dataString != NULL) { Tcl_DecrRefCount(modelPtr->dataString); } if (modelPtr->format != NULL) { Tcl_DecrRefCount(modelPtr->format); } if (modelPtr->metadata != NULL) { Tcl_DecrRefCount(modelPtr->metadata); } Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); ckfree(modelPtr); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2377 2378 2379 2380 2381 2382 2383 | * This function is called to find a photo image file format handler * which can parse the image data in the given file. If a user-specified * format string is provided, only handlers whose names match a prefix of * the format string are tried. * * Results: * A standard TCL return value. If the return value is TCL_OK, a pointer | | | | > > | > > > > > > | 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 | * This function is called to find a photo image file format handler * which can parse the image data in the given file. If a user-specified * format string is provided, only handlers whose names match a prefix of * the format string are tried. * * Results: * A standard TCL return value. If the return value is TCL_OK, a pointer * to the image format record is returned in *imageFormatPtr or * *imageFormatVersion3Ptr, and the width and height of the image are * returned in *widthPtr and *heightPtr. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int MatchFileFormat( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ const char *fileName, /* The name of the image file. */ Tcl_Obj *formatObj, /* User-specified format string, or NULL. */ Tcl_Obj *metadataInObj, /* User-specified metadata, may be NULL */ Tcl_Obj *metadataOutObj, /* metadata to return, may be NULL */ Tk_PhotoImageFormat **imageFormatPtr, /* A pointer to the photo image format record * is returned here. For formatVersion3, this is * set to NULL */ Tk_PhotoImageFormatVersion3 **imageFormatVersion3Ptr, /* A pointer to the photo image formatVersion3 * record is returned here. For non * formatVersion3, this is set to NULL*/ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here. */ int *oldformat) /* Returns 1 if the old image API is used. */ { int matched = 0; int useoldformat = 0; Tk_PhotoImageFormat *formatPtr; Tk_PhotoImageFormatVersion3 *formatVersion3Ptr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; if (formatObj) { formatString = Tcl_GetString(formatObj); } |
︙ | ︙ | |||
2486 2487 2488 2489 2490 2491 2492 | break; } } } } #endif | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | < < < < < < | | | > > | > > > > > > | 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 | break; } } } } #endif /* * For old and not version 3 format, exit now with success */ if (formatPtr != NULL) { *imageFormatPtr = formatPtr; *imageFormatVersion3Ptr = NULL; *oldformat = useoldformat; (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET); return TCL_OK; } /* * Scan through the table of file format version 3 handlers to find one * which can handle the image. */ for (formatVersion3Ptr = tsdPtr->formatListVersion3; formatVersion3Ptr != NULL; formatVersion3Ptr = formatVersion3Ptr->nextPtr) { if (formatObj != NULL) { if (strncasecmp(formatString, formatVersion3Ptr->name, strlen(formatVersion3Ptr->name)) != 0) { continue; } matched = 1; if (formatVersion3Ptr->fileMatchProc == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "-file option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "NOT_FILE_FORMAT", NULL); return TCL_ERROR; } } if (formatVersion3Ptr->fileMatchProc != NULL) { (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET); if (formatVersion3Ptr->fileMatchProc(interp, chan, fileName, formatObj, metadataInObj, widthPtr, heightPtr, metadataOutObj)) { if (*widthPtr < 1) { *widthPtr = 1; } if (*heightPtr < 1) { *heightPtr = 1; } *imageFormatVersion3Ptr = formatVersion3Ptr; *imageFormatPtr = NULL; *oldformat = 0; (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET); return TCL_OK; } /* * Check if driver has shared or changed the metadata Tcl object. * In this case, release and recreate it. */ if (metadataOutObj != NULL) { int dictSize; if (Tcl_IsShared(metadataOutObj) || TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize) || dictSize > 0) { Tcl_DecrRefCount(metadataOutObj); metadataOutObj = Tcl_NewDictObj(); Tcl_IncrRefCount(metadataOutObj); } } } } /* * No matching format found */ if ((formatObj != NULL) && !matched) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image file format \"%s\" is not supported", formatString)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", formatString, NULL); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't recognize data in image file \"%s\"", fileName)); Tcl_SetErrorCode(interp, "TK", "PHOTO", "IMAGE", "UNRECOGNIZED_DATA", NULL); } return TCL_ERROR; } /* *---------------------------------------------------------------------- * * MatchStringFormat -- * * This function is called to find a photo image file format handler * which can parse the image data in the given string. If a * user-specified format string is provided, only handlers whose names * match a prefix of the format string are tried. * * Results: * A standard TCL return value. If the return value is TCL_OK, a pointer * to the image format record is returned in *imageFormatPtr or * *imageFormatVersion3Ptr, and the width and height of the image are * returned in *widthPtr and *heightPtr. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int MatchStringFormat( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Obj *data, /* Object containing the image data. */ Tcl_Obj *formatObj, /* User-specified format string, or NULL. */ Tcl_Obj *metadataInObj, /* User-specified metadata, may be NULL */ Tcl_Obj *metadataOutObj, /* metadata output dict, may be NULL */ Tk_PhotoImageFormat **imageFormatPtr, /* A pointer to the photo image format record * is returned here. For formatVersion3, this is * set to NULL*/ Tk_PhotoImageFormatVersion3 **imageFormatVersion3Ptr, /* A pointer to the photo image formatVersion3 * record is returned here. For non * formatVersion3, this is set to NULL*/ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here. */ int *oldformat) /* Returns 1 if the old image API is used. */ { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr, *defaultFormatPtr = NULL; Tk_PhotoImageFormatVersion3 *formatVersion3Ptr = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; if (formatObj) { formatString = Tcl_GetString(formatObj); } |
︙ | ︙ | |||
2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 | break; } } } #endif if (formatPtr == NULL) { /* * Try the default format as last resort (only if no -format option * was passed). */ if ( formatObj == NULL && defaultFormatPtr == NULL) { Tcl_Panic("default image format handler not registered"); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 | break; } } } #endif if (formatPtr == NULL) { useoldformat = 0; for (formatVersion3Ptr = tsdPtr->formatListVersion3; formatVersion3Ptr != NULL; formatVersion3Ptr = formatVersion3Ptr->nextPtr) { if (formatObj != NULL) { if (strncasecmp(formatString, formatVersion3Ptr->name, strlen(formatVersion3Ptr->name) ) != 0) { continue; } matched = 1; if (formatVersion3Ptr->stringMatchProc == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "-data option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "NOT_DATA_FORMAT", NULL); return TCL_ERROR; } } if ((formatVersion3Ptr->stringMatchProc != NULL) && (formatVersion3Ptr->stringReadProc != NULL) && formatVersion3Ptr->stringMatchProc(interp, data, formatObj, metadataInObj, widthPtr, heightPtr, metadataOutObj)) { break; } /* * Check if driver has shared or changed the metadata tcl object. * In this case, release and recreate it. */ if (metadataOutObj != NULL) { int dictSize; if (Tcl_IsShared(metadataOutObj) || TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize) || dictSize > 0) { Tcl_DecrRefCount(metadataOutObj); metadataOutObj = Tcl_NewDictObj(); Tcl_IncrRefCount(metadataOutObj); } } } } if (formatPtr == NULL && formatVersion3Ptr == NULL) { /* * Try the default format as last resort (only if no -format option * was passed). */ if ( formatObj == NULL && defaultFormatPtr == NULL) { Tcl_Panic("default image format handler not registered"); |
︙ | ︙ | |||
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 | "UNRECOGNIZED_DATA", NULL); } return TCL_ERROR; } } *imageFormatPtr = formatPtr; *oldformat = useoldformat; /* * Some stringMatchProc might have left error messages and error codes in * interp. Clear them before return. */ Tcl_ResetResult(interp); | > | 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 | "UNRECOGNIZED_DATA", NULL); } return TCL_ERROR; } } *imageFormatPtr = formatPtr; *imageFormatVersion3Ptr = formatVersion3Ptr; *oldformat = useoldformat; /* * Some stringMatchProc might have left error messages and error codes in * interp. Clear them before return. */ Tcl_ResetResult(interp); |
︙ | ︙ | |||
2803 2804 2805 2806 2807 2808 2809 | * * To find out, just comparing the pointers is not enough - they might have * different values and still point to the same block of memory. (e.g. * if the -from option was passed to [imageName copy]) */ sourceBlock = *blockPtr; memToFree = NULL; | | | | | 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 | * * To find out, just comparing the pointers is not enough - they might have * different values and still point to the same block of memory. (e.g. * if the -from option was passed to [imageName copy]) */ sourceBlock = *blockPtr; memToFree = NULL; if (modelPtr->pix32 && (sourceBlock.pixelPtr >= modelPtr->pix32) && (sourceBlock.pixelPtr < modelPtr->pix32 + modelPtr->width * modelPtr->height * 4)) { /* * Fix 5c51be6411: avoid reading * * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize) * * bytes past the end of modelPtr->pix32[] when * |
︙ | ︙ | |||
3043 3044 3045 3046 3047 3048 3049 | /* * Add this new block to the region which specifies which data is valid. */ if (alphaOffset) { /* * This block is grossly inefficient. For each row in the image, it | | | 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 | /* * Add this new block to the region which specifies which data is valid. */ if (alphaOffset) { /* * This block is grossly inefficient. For each row in the image, it * finds each contiguous string of nontransparent pixels, then marks * those areas as valid in the validRegion mask. This makes drawing * very efficient, because of the way we use X: we just say, here's * your mask, and here's your data. We need not worry about the * current background color, etc. But this costs us a lot on the image * setup. Still, image setup only happens once, whereas the drawing * happens many times, so this might be the best way to go. * |
︙ | ︙ | |||
3249 3250 3251 3252 3253 3254 3255 | * * To find out, just comparing the pointers is not enough - they might have * different values and still point to the same block of memory. (e.g. * if the -from option was passed to [imageName copy]) */ sourceBlock = *blockPtr; memToFree = NULL; | | | | | 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 | * * To find out, just comparing the pointers is not enough - they might have * different values and still point to the same block of memory. (e.g. * if the -from option was passed to [imageName copy]) */ sourceBlock = *blockPtr; memToFree = NULL; if (modelPtr->pix32 && (sourceBlock.pixelPtr >= modelPtr->pix32) && (sourceBlock.pixelPtr < modelPtr->pix32 + modelPtr->width * modelPtr->height * 4)) { /* * Fix 5c51be6411: avoid reading * * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize) * * bytes past the end of modelPtr->pix32[] when * |
︙ | ︙ | |||
3634 3635 3636 3637 3638 3639 3640 | modelPtr->validRegion = TkCreateRegion(); /* * Clear out the 32-bit pixel storage array. Clear out the dithering error * arrays for each instance. */ | > | | > | 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 | modelPtr->validRegion = TkCreateRegion(); /* * Clear out the 32-bit pixel storage array. Clear out the dithering error * arrays for each instance. */ if (modelPtr->pix32) { memset(modelPtr->pix32, 0, ((size_t)modelPtr->width * modelPtr->height * 4)); } for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgResetDither(instancePtr); } /* * Tell the core image code that this image has changed. |
︙ | ︙ | |||
4078 4079 4080 4081 4082 4083 4084 | } /* *---------------------------------------------------------------------- * * Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite -- * | | | 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 | } /* *---------------------------------------------------------------------- * * Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite -- * * 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. * *---------------------------------------------------------------------- */ |
︙ | ︙ | |||
4119 4120 4121 4122 4123 4124 4125 | /* *---------------------------------------------------------------------- * * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic, * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic * | | | 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 | /* *---------------------------------------------------------------------- * * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic, * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic * * 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. * *---------------------------------------------------------------------- */ |
︙ | ︙ |
Changes to generic/tkImgPhoto.h.
1 2 3 4 5 | /* * tkImgPhoto.h -- * * Declarations for images of type "photo" for Tk. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkImgPhoto.h -- * * Declarations for images of type "photo" for Tk. * * Copyright © 1994 The Australian National University. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2002-2008 Donal K. Fellows * Copyright © 2003 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Author: Paul Mackerras ([email protected]), * Department of Computer Science, * Australian National University. |
︙ | ︙ | |||
155 156 157 158 159 160 161 162 163 164 165 166 167 168 | Tk_Uid palette; /* User-specified default palette for * instances of this image. */ double gamma; /* Display gamma value to correct for. */ char *fileString; /* Name of file to read into image. */ Tcl_Obj *dataString; /* Object to use as contents of image. */ Tcl_Obj *format; /* User-specified format of data in image file * or string value. */ unsigned char *pix32; /* Local storage for 32-bit image. */ int ditherX, ditherY; /* Location of first incorrectly dithered * pixel in image. */ TkRegion validRegion; /* Tk region indicating which parts of the * image have valid image data. */ PhotoInstance *instancePtr; /* First in the list of instances associated * with this model. */ | > > | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | Tk_Uid palette; /* User-specified default palette for * instances of this image. */ double gamma; /* Display gamma value to correct for. */ char *fileString; /* Name of file to read into image. */ Tcl_Obj *dataString; /* Object to use as contents of image. */ Tcl_Obj *format; /* User-specified format of data in image file * or string value. */ Tcl_Obj *metadata; /* User-specified metadata dict or read from * image file */ unsigned char *pix32; /* Local storage for 32-bit image. */ int ditherX, ditherY; /* Location of first incorrectly dithered * pixel in image. */ TkRegion validRegion; /* Tk region indicating which parts of the * image have valid image data. */ PhotoInstance *instancePtr; /* First in the list of instances associated * with this model. */ |
︙ | ︙ |
Changes to generic/tkImgSVGnano.c.
1 2 3 4 5 | /* * tkImgSVGnano.c * * A photo file handler for SVG files. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkImgSVGnano.c * * A photo file handler for SVG files. * * Copyright © 2013-14 Mikko Mononen [email protected] * Copyright © 2018 Christian Gollwitzer [email protected] * Copyright © 2018 Christian Werner https://www.androwish.org/ * Copyright © 2018 Rene Zaumseil [email protected] * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * This handler is build using the original nanosvg library files from * https://github.com/memononen/nanosvg * |
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | */ ClientData dataOrChan; Tcl_DString formatString; NSVGimage *nsvgImage; RastOpts ropts; } NSVGcache; static int FileMatchSVG(Tcl_Channel chan, const char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int FileReadSVG(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); | > > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | */ ClientData dataOrChan; Tcl_DString formatString; NSVGimage *nsvgImage; RastOpts ropts; } NSVGcache; static const void * MemMem(const void *haystack, size_t haysize, const void *needle, size_t needlen); static int FileMatchSVG(Tcl_Channel chan, const char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int FileReadSVG(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); |
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 | NULL, /* stringWriteProc */ NULL }; /* *---------------------------------------------------------------------- * * FileMatchSVG -- * * This function is invoked by the photo image type to see if a file * contains image data in SVG format. * * Results: * The return value is >0 if the file can be successfully parsed, | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | NULL, /* stringWriteProc */ NULL }; /* *---------------------------------------------------------------------- * * MemMem -- * * Like strstr() but operating on memory buffers with sizes. * *---------------------------------------------------------------------- */ static const void * MemMem(const void *haystack, size_t haylen, const void *needle, size_t needlen) { const void *hayend, *second, *p; unsigned char first; if ((needlen <= 0) || (haylen < needlen)) { return NULL; } hayend = (const void *) ((char *) haystack + haylen - needlen); first = ((char *) needle)[0]; second = (const void *) ((char *) needle + 1); needlen -= 1; while (haystack < hayend) { p = memchr(haystack, first, (char *) hayend - (char *) haystack); if (p == NULL) { break; } if (needlen == 0) { return p; } haystack = (const void *) ((char *) p + 1); if (memcmp(second, haystack, needlen) == 0) { return p; } } return NULL; } /* *---------------------------------------------------------------------- * * FileMatchSVG -- * * This function is invoked by the photo image type to see if a file * contains image data in SVG format. * * Results: * The return value is >0 if the file can be successfully parsed, |
︙ | ︙ | |||
128 129 130 131 132 133 134 | Tcl_Obj *dataObj = Tcl_NewObj(); const char *data; RastOpts ropts; NSVGimage *nsvgImage; (void)fileName; CleanCache(interp); | | > > > > > > > > > > > > | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | Tcl_Obj *dataObj = Tcl_NewObj(); const char *data; RastOpts ropts; NSVGimage *nsvgImage; (void)fileName; CleanCache(interp); if (Tcl_ReadChars(chan, dataObj, 4096, 0) == TCL_IO_FAILURE) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); return 0; } data = Tcl_GetStringFromObj(dataObj, &length); /* should have a '<svg' and a '>' in the first 4k */ if ((memchr(data, '>', length) == NULL) || (MemMem(data, length, "<svg", 4) == NULL)) { Tcl_DecrRefCount(dataObj); return 0; } if (!Tcl_Eof(chan) && (Tcl_ReadChars(chan, dataObj, -1, 1) == TCL_IO_FAILURE)) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); return 0; } data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); if (nsvgImage != NULL) { GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr); if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) { nsvgDelete(nsvgImage); return 0; |
︙ | ︙ | |||
196 197 198 199 200 201 202 | if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); Tcl_SetObjResult(interp, Tcl_NewStringObj("read error", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "READ_ERROR", NULL); return TCL_ERROR; } | | | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); Tcl_SetObjResult(interp, Tcl_NewStringObj("read error", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "READ_ERROR", NULL); return TCL_ERROR; } data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); if (nsvgImage == NULL) { return TCL_ERROR; } } |
︙ | ︙ | |||
233 234 235 236 237 238 239 | static int StringMatchSVG( Tcl_Obj *dataObj, Tcl_Obj *formatObj, int *widthPtr, int *heightPtr, Tcl_Interp *interp) { | | | > > > > > > | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | static int StringMatchSVG( Tcl_Obj *dataObj, Tcl_Obj *formatObj, int *widthPtr, int *heightPtr, Tcl_Interp *interp) { TkSizeT length, testLength; const char *data; RastOpts ropts; NSVGimage *nsvgImage; CleanCache(interp); data = Tcl_GetStringFromObj(dataObj, &length); /* should have a '<svg' and a '>' in the first 4k */ testLength = (length > 4096) ? 4096 : length; if ((memchr(data, '>', testLength) == NULL) || (MemMem(data, testLength, "<svg", 4) == NULL)) { return 0; } nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); if (nsvgImage != NULL) { GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr); if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) { nsvgDelete(nsvgImage); return 0; } |
︙ | ︙ | |||
289 290 291 292 293 294 295 | { TkSizeT length; const char *data; RastOpts ropts; NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts); if (nsvgImage == NULL) { | | | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | { TkSizeT length; const char *data; RastOpts ropts; NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts); if (nsvgImage == NULL) { data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); } if (nsvgImage == NULL) { return TCL_ERROR; } return RasterizeSVG(interp, imageHandle, nsvgImage, destX, destY, |
︙ | ︙ | |||
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | RastOpts *ropts) { int w, h, c; NSVGrasterizer *rast; unsigned char *imgData; Tk_PhotoImageBlock svgblock; double scale; (void)srcX; (void)srcY; scale = GetScaleFromParameters(nsvgImage, ropts, &w, &h); rast = nsvgCreateRasterizer(); if (rast == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot initialize rasterizer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "RASTERIZER_ERROR", NULL); goto cleanAST; } | > > > > > > > > > > | | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | RastOpts *ropts) { int w, h, c; NSVGrasterizer *rast; unsigned char *imgData; Tk_PhotoImageBlock svgblock; double scale; Tcl_WideUInt wh; (void)srcX; (void)srcY; scale = GetScaleFromParameters(nsvgImage, ropts, &w, &h); rast = nsvgCreateRasterizer(); if (rast == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot initialize rasterizer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "RASTERIZER_ERROR", NULL); goto cleanAST; } /* Tk Ticket [822330269b] Check potential int overflow in following ckalloc */ wh = (Tcl_WideUInt)w * (Tcl_WideUInt)h; if ( w < 0 || h < 0 || wh > INT_MAX / 4) { Tcl_SetObjResult(interp, Tcl_NewStringObj("image size overflow", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "IMAGE_SIZE_OVERFLOW", NULL); goto cleanRAST; } imgData = (unsigned char *)attemptckalloc(wh * 4); if (imgData == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc image buffer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); goto cleanRAST; } nsvgRasterize(rast, nsvgImage, 0, 0, (float) scale, imgData, w, h, w * 4); |
︙ | ︙ | |||
690 691 692 693 694 695 696 | TkSizeT length; const char *data; NSVGcache *cachePtr = GetCachePtr(interp); if (cachePtr != NULL) { cachePtr->dataOrChan = dataOrChan; if (formatObj != NULL) { | | | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | TkSizeT length; const char *data; NSVGcache *cachePtr = GetCachePtr(interp); if (cachePtr != NULL) { cachePtr->dataOrChan = dataOrChan; if (formatObj != NULL) { data = Tcl_GetStringFromObj(formatObj, &length); Tcl_DStringAppend(&cachePtr->formatString, data, length); } cachePtr->nsvgImage = nsvgImage; cachePtr->ropts = *ropts; return 1; } return 0; |
︙ | ︙ | |||
731 732 733 734 735 736 737 | const char *data; NSVGcache *cachePtr = GetCachePtr(interp); NSVGimage *nsvgImage = NULL; if ((cachePtr != NULL) && (cachePtr->nsvgImage != NULL) && (cachePtr->dataOrChan == dataOrChan)) { if (formatObj != NULL) { | | | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | const char *data; NSVGcache *cachePtr = GetCachePtr(interp); NSVGimage *nsvgImage = NULL; if ((cachePtr != NULL) && (cachePtr->nsvgImage != NULL) && (cachePtr->dataOrChan == dataOrChan)) { if (formatObj != NULL) { data = Tcl_GetStringFromObj(formatObj, &length); if (strcmp(data, Tcl_DStringValue(&cachePtr->formatString)) == 0) { nsvgImage = cachePtr->nsvgImage; *ropts = cachePtr->ropts; cachePtr->nsvgImage = NULL; } } else if (Tcl_DStringLength(&cachePtr->formatString) == 0) { nsvgImage = cachePtr->nsvgImage; |
︙ | ︙ |
Changes to generic/tkImgUtil.c.
1 2 3 4 5 | /* * tkImgUtil.c -- * * This file contains image related utility functions. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkImgUtil.c -- * * This file contains image related utility functions. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "xbytes.h" |
︙ | ︙ |
Changes to generic/tkInt.decls.
1 2 3 4 5 6 | # tkInt.decls -- # # This file contains the declarations for all unsupported functions that # are exported by the Tk library. This file is used to generate the # tkIntDecls.h, tkIntPlatDecls.h, tkIntStub.c, and tkPlatStub.c files. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # tkInt.decls -- # # This file contains the declarations for all unsupported functions that # are exported by the Tk library. This file is used to generate the # tkIntDecls.h, tkIntPlatDecls.h, tkIntStub.c, and tkPlatStub.c files. # # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 2007 Daniel A. Steffen <[email protected]> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. library tk ############################################################################## |
︙ | ︙ | |||
222 223 224 225 226 227 228 | } declare 58 { void TkpDisplayWarning(const char *msg, const char *title) } declare 59 { void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name) } | | | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | } declare 58 { void TkpDisplayWarning(const char *msg, const char *title) } declare 59 { void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name) } declare 60 {deprecated {renamed to Tk_GetOtherWindow}} { TkWindow *TkpGetOtherWindow(TkWindow *winPtr) } declare 61 { TkWindow *TkpGetWrapperWindow(TkWindow *winPtr) } declare 62 { int TkpInit(Tcl_Interp *interp) } declare 63 { void TkpInitializeMenuBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable) } declare 64 {deprecated {renamed to Tk_MakeContainer}} { void TkpMakeContainer(Tk_Window tkwin) } declare 65 { void TkpMakeMenuWindow(Tk_Window tkwin, int transient) } declare 66 {deprecated {renamed to Tk_MakeWindow}} { Window TkpMakeWindow(TkWindow *winPtr, Window parent) } declare 67 { void TkpMenuNotifyToplevelCreate(Tcl_Interp *interp, const char *menuName) } declare 68 { TkDisplay *TkpOpenDisplay(const char *display_name) |
︙ | ︙ | |||
265 266 267 268 269 270 271 | } declare 72 { int TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr) } declare 73 { void TkpRedirectKeyEvent(TkWindow *winPtr, XEvent *eventPtr) } | | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | } declare 72 { int TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr) } declare 73 { void TkpRedirectKeyEvent(TkWindow *winPtr, XEvent *eventPtr) } declare 74 {deprecated {renamed to Tk_SetMainMenubar}} { void TkpSetMainMenubar(Tcl_Interp *interp, Tk_Window tkwin, const char *menuName) } declare 75 {deprecated {renamed to Tk_UseWindow}} { int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, const char *string) } # # Slot 76 unused (WAS: TkpWindowWasRecentlyDeleted) # declare 77 { void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr) |
︙ | ︙ | |||
304 305 306 307 308 309 310 | } # Exported publically as Tk_SetClassProcs in 8.4a2 #declare 84 { # void TkSetClassProcs(Tk_Window tkwin, # TkClassProcs *procs, ClientData instanceData) #} | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | } # Exported publically as Tk_SetClassProcs in 8.4a2 #declare 84 { # void TkSetClassProcs(Tk_Window tkwin, # TkClassProcs *procs, ClientData instanceData) #} declare 85 {deprecated {renamed to Tk_SetWindowMenubar}} { void TkSetWindowMenuBar(Tcl_Interp *interp, Tk_Window tkwin, const char *oldMenuName, const char *menuName) } declare 86 { KeySym TkStringToKeysym(const char *name) } declare 87 { |
︙ | ︙ | |||
390 391 392 393 394 395 396 | } declare 109 { const char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr) } declare 110 { void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont) } | | | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | } declare 109 { const char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr) } declare 110 { void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont) } declare 111 {deprecated {renamed to Tk_GetSystemDefault}} { Tcl_Obj *TkpGetSystemDefault(Tk_Window tkwin, const char *dbName, const char *className) } declare 112 { void TkpMenuThreadInit(void) } declare 113 { |
︙ | ︙ | |||
430 431 432 433 434 435 436 | declare 122 aqua { void TkpDefineNativeBitmaps(void) } declare 124 aqua { Pixmap TkpGetNativeAppBitmap(Display *display, const char *name, int *width, int *height) } | | | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | declare 122 aqua { void TkpDefineNativeBitmaps(void) } declare 124 aqua { Pixmap TkpGetNativeAppBitmap(Display *display, const char *name, int *width, int *height) } declare 135 {deprecated {renamed to Tk_DrawHighlightBorder}} { void TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable) } declare 136 { void TkSetFocusWin(TkWindow *winPtr, int force) } declare 137 { |
︙ | ︙ | |||
632 633 634 635 636 637 638 | declare 184 { void TkDrawAngledChars(Display *display,Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle) } # Support for aqua's inability to draw outside [NSView drawRect:] | | | | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | declare 184 { void TkDrawAngledChars(Display *display,Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle) } # Support for aqua's inability to draw outside [NSView drawRect:] declare 185 { void TkpRedrawWidget(Tk_Window tkwin) } declare 186 { int TkpWillDrawWidget(Tk_Window tkwin) } # Debugging / testing functions for photo images declare 187 { int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr) |
︙ | ︙ |
Changes to generic/tkInt.h.
1 2 3 4 5 6 7 8 | /* * tkInt.h -- * * Declarations for things used internally by the Tk functions but not * exported outside the module. * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * tkInt.h -- * * Declarations for things used internally by the Tk functions but not * exported outside the module. * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKINT #define _TKINT #ifndef _TKPORT #include "tkPort.h" #endif #define TK_OPTION_ENUM_VAR ((int)(sizeof(Tk_OptionType)&(sizeof(int)-1))<<6) /* * Ensure WORDS_BIGENDIAN is defined correctly: * Needs to happen here in addition to configure to work with fat compiles on * Darwin (where configure runs only once for multiple architectures). */ |
︙ | ︙ | |||
90 91 92 93 94 95 96 | #if defined(__GNUC__) && (__GNUC__ > 2) # define TKFLEXARRAY 0 #else # define TKFLEXARRAY 1 #endif | > > > > > > > > | | > | < | < | | | < | < | > > | > | > > > > | > | | > > > > > > > > > > > > > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | #if defined(__GNUC__) && (__GNUC__ > 2) # define TKFLEXARRAY 0 #else # define TKFLEXARRAY 1 #endif #if TCL_MAJOR_VERSION < 9 # undef Tcl_ExternalToUtfDStringEx # undef Tcl_UtfToExternalDStringEx /* just assume 'flags' is TCL_ENCODING_NOCOMPLAIN, and return value not used. */ # define Tcl_ExternalToUtfDStringEx(encoding, data, length, flags, ds) \ (Tcl_ExternalToUtfDString(encoding, data, length, ds), TCL_INDEX_NONE) # define Tcl_UtfToExternalDStringEx(encoding, data, length, flags, ds) \ (Tcl_UtfToExternalDString(encoding, data, length, ds), TCL_INDEX_NONE) # if !defined(Tcl_GetParent) && (TCL_MINOR_VERSION < 7) # define Tcl_GetParent Tcl_GetMaster # endif #endif /* * Macros used to cast between pointers and integers (e.g. when storing an int * in ClientData), on 64-bit architectures they avoid gcc warning about "cast * to/from pointer from/to integer of different size". */ #if !defined(INT2PTR) # define INT2PTR(p) ((void *)(ptrdiff_t)(p)) #endif #if !defined(PTR2INT) # define PTR2INT(p) ((ptrdiff_t)(p)) #endif #if !defined(UINT2PTR) # define UINT2PTR(p) ((void *)(size_t)(p)) #endif #if !defined(PTR2UINT) # define PTR2UINT(p) ((size_t)(p)) #endif /* * Fallback in case Tk is linked against a Tcl version not having TIP #585 * (TCL_INDEX_TEMP_TABLE) or TIP #613/#618 (TCL_NULL_OK) */ #ifndef TCL_NULL_OK # define TCL_NULL_OK 32 #endif #if !defined(TCL_INDEX_TEMP_TABLE) # define TCL_INDEX_TEMP_TABLE 64 #endif #ifndef TCL_Z_MODIFIER # if defined(_WIN64) # define TCL_Z_MODIFIER "I" # elif defined(__GNUC__) && !defined(_WIN32) # define TCL_Z_MODIFIER "z" # else # define TCL_Z_MODIFIER "" # endif #endif /* !TCL_Z_MODIFIER */ #undef TCL_LL_MODIFIER #if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) # define TCL_LL_MODIFIER "I64" #else # define TCL_LL_MODIFIER "ll" #endif #if TCL_MAJOR_VERSION > 8 # define TKSIZET_MODIFIER TCL_Z_MODIFIER #else # define TKSIZET_MODIFIER "" #endif /* * Opaque type declarations: */ typedef struct TkColormap TkColormap; typedef struct TkFontAttributes TkFontAttributes; |
︙ | ︙ | |||
370 371 372 373 374 375 376 | Tcl_HashTable maintainHashTable; /* Hash table that maps from a container's * Tk_Window token to a list of windows managed * by that container. */ int geomInit; | > > > > > > | | | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | Tcl_HashTable maintainHashTable; /* Hash table that maps from a container's * Tk_Window token to a list of windows managed * by that container. */ int geomInit; /* * Information used by tkGrid.c, tkPack.c, tkPlace.c, tkPointer.c, * and ttkMacOSXTheme.c: */ #define TkGetContainer(tkwin) (Tk_TopWinHierarchy((TkWindow *)tkwin) ? NULL : \ (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr)) /* * Information used by tkGet.c only: */ Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */ int uidInit; /* 0 means uidTable needs initializing. */ |
︙ | ︙ | |||
691 692 693 694 695 696 697 698 699 700 701 702 703 704 | int strictMotif; /* This is linked to the tk_strictMotif global * variable. */ int alwaysShowSelection; /* This is linked to the * ::tk::AlwaysShowSelection variable. */ struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by * this process. */ Tcl_HashTable busyTable; /* Information used by [tk busy] command. */ } TkMainInfo; /* * Tk keeps the following data structure for each of it's builtin bitmaps. * This structure is only used by tkBitmap.c and other platform specific * bitmap files. */ | > > > > > > > > > > > | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | int strictMotif; /* This is linked to the tk_strictMotif global * variable. */ int alwaysShowSelection; /* This is linked to the * ::tk::AlwaysShowSelection variable. */ struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by * this process. */ Tcl_HashTable busyTable; /* Information used by [tk busy] command. */ Tcl_ObjCmdProc *tclUpdateObjProc; /* Saved Tcl [update] command, used to restore * Tcl's version of [update] after Tk is shut * down */ #if TCL_MAJOR_VERSION > 8 Tcl_ObjCmdProc2 *tclUpdateObjProc2; /* Saved Tcl [update] command, used to restore * Tcl's version of [update] after Tk is shut * down, in case it's a Tcl_ObjCmdProc2 */ #endif } TkMainInfo; /* * Tk keeps the following data structure for each of it's builtin bitmaps. * This structure is only used by tkBitmap.c and other platform specific * bitmap files. */ |
︙ | ︙ | |||
803 804 805 806 807 808 809 | * Information used for event bindings (see "bind" and "bindtags" commands * in tkCmds.c): */ ClientData *tagPtr; /* Points to array of tags used for bindings * on this window. Each tag is a Tk_Uid. * Malloc'ed. NULL means no tags. */ | | | | 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | * Information used for event bindings (see "bind" and "bindtags" commands * in tkCmds.c): */ ClientData *tagPtr; /* Points to array of tags used for bindings * on this window. Each tag is a Tk_Uid. * Malloc'ed. NULL means no tags. */ TkSizeT numTags; /* Number of tags at *tagPtr. */ /* * Information used by tkOption.c to manage options for the window. */ TkSizeT optionLevel; /* TCL_INDEX_NONE means no option information is currently * cached for this window. Otherwise this * gives the level in the option stack at * which info is cached. */ /* * Information used by tkSelect.c to manage the selection. */ |
︙ | ︙ | |||
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | * if its container is its parent. */ #if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9) XIC inputContext; /* XIM input context. */ int ximGeneration; /* Used to invalidate XIC */ #endif /* TK_USE_INPUT_METHODS */ } TkWindow; /* * Real definition of some events. Note that these events come from outside * but have internally generated pieces added to them. */ typedef struct { XKeyEvent keyEvent; /* The real event from X11. */ #ifdef _WIN32 char trans_chars[XMaxTransChars]; /* translated characters */ unsigned char nbytes; | > > > > > > > > > > > > > | | 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | * if its container is its parent. */ #if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9) XIC inputContext; /* XIM input context. */ int ximGeneration; /* Used to invalidate XIC */ #endif /* TK_USE_INPUT_METHODS */ } TkWindow; /* * String tables: */ MODULE_SCOPE const char *const tkStateStrings[]; MODULE_SCOPE const char *const tkCompoundStrings[]; MODULE_SCOPE const char *const tkAnchorStrings[]; MODULE_SCOPE const char *const tkReliefStrings[]; MODULE_SCOPE const char *const tkJustifyStrings[]; /* * Real definition of some events. Note that these events come from outside * but have internally generated pieces added to them. */ typedef struct { XKeyEvent keyEvent; /* The real event from X11. */ #ifdef _WIN32 # ifndef XMaxTransChars # define XMaxTransChars 7 # endif char trans_chars[XMaxTransChars]; /* translated characters */ unsigned char nbytes; #elif !defined(MAC_OSX_TK) char *charValuePtr; /* A pointer to a string that holds the key's * %A substitution text (before backslash * adding), or NULL if that has not been * computed yet. If non-NULL, this string was * allocated with ckalloc(). */ TkSizeT charValueLen; /* Length of string in charValuePtr when that * is non-NULL. */ |
︙ | ︙ | |||
926 927 928 929 930 931 932 933 934 935 936 937 938 939 | #ifndef TCL_IO_FAILURE # define TCL_IO_FAILURE (-1) #endif /* See TIP #537 */ #ifndef TCL_INDEX_NONE # define TCL_INDEX_NONE (-1) #endif /* * The following structure is used with TkMakeEnsemble to create ensemble * commands and optionally to create sub-ensembles. */ typedef struct TkEnsemble { | > > > | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | #ifndef TCL_IO_FAILURE # define TCL_IO_FAILURE (-1) #endif /* See TIP #537 */ #ifndef TCL_INDEX_NONE # define TCL_INDEX_NONE (-1) #endif #ifndef TCL_INDEX_END # define TCL_INDEX_END ((TkSizeT)-2) #endif /* * The following structure is used with TkMakeEnsemble to create ensemble * commands and optionally to create sub-ensembles. */ typedef struct TkEnsemble { |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | /* * Miscellaneous variables shared among Tk modules but not exported to the * outside world: */ MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod; MODULE_SCOPE Tk_ImageType tkBitmapImageType; | | | | 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | /* * Miscellaneous variables shared among Tk modules but not exported to the * outside world: */ MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod; MODULE_SCOPE Tk_ImageType tkBitmapImageType; MODULE_SCOPE Tk_PhotoImageFormatVersion3 tkImgFmtGIF; MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr); MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtDefault; MODULE_SCOPE Tk_PhotoImageFormatVersion3 tkImgFmtPNG; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtSVGnano; MODULE_SCOPE TkMainInfo *tkMainWindowList; MODULE_SCOPE Tk_ImageType tkPhotoImageType; MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; MODULE_SCOPE const char *const tkWebColors[20]; |
︙ | ︙ | |||
1088 1089 1090 1091 1092 1093 1094 | #define PI M_PI #else #define PI 3.14159265358979323846 #endif #endif /* | | | 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | #define PI M_PI #else #define PI 3.14159265358979323846 #endif #endif /* * Support for Clang Static Analyzer <https://clang-analyzer.llvm.org/> */ #if defined(PURIFY) && defined(__clang__) #if __has_feature(attribute_analyzer_noreturn) && \ !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED) void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn)); #endif |
︙ | ︙ | |||
1249 1250 1251 1252 1253 1254 1255 | Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_SelectionObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_SendObjCmd(ClientData clientData, Tcl_Interp *interp,int objc, Tcl_Obj *const objv[]); | < < < | 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 | Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_SelectionObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_SendObjCmd(ClientData clientData, Tcl_Interp *interp,int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_SpinboxObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_TextObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_TkwaitObjCmd(ClientData clientData, |
︙ | ︙ | |||
1281 1282 1283 1284 1285 1286 1287 | Tk_Window tkwin, const char *name); MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin, const char *name); MODULE_SCOPE void TkEventInit(void); MODULE_SCOPE void TkRegisterObjTypes(void); MODULE_SCOPE int TkDeadAppObjCmd(ClientData clientData, | | | | 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | Tk_Window tkwin, const char *name); MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin, const char *name); MODULE_SCOPE void TkEventInit(void); MODULE_SCOPE void TkRegisterObjTypes(void); MODULE_SCOPE int TkDeadAppObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkCanvasGetCoordObj(Tcl_Interp *interp, Tk_Canvas canvas, Tcl_Obj *obj, double *doublePtr); MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin, const char *string, double *doublePtr); MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, XImage *ximage, int x, int y, int width, int height); #if TCL_MAJOR_VERSION > 8 MODULE_SCOPE int TkCanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, size_t offset); MODULE_SCOPE const char *TkCanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, size_t offset, Tcl_FreeProc **freeProcPtr); #else #define TkCanvasTagsParseProc Tk_CanvasTagsParseProc #define TkCanvasTagsPrintProc Tk_CanvasTagsPrintProc #endif MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin); MODULE_SCOPE XEvent * TkpGetBindingXEvent(Tcl_Interp *interp); MODULE_SCOPE void TkCreateExitHandler(Tcl_ExitProc *proc, void *clientData); MODULE_SCOPE void TkDeleteExitHandler(Tcl_ExitProc *proc, ClientData clientData); MODULE_SCOPE Tcl_ExitProc TkFinalize; MODULE_SCOPE Tcl_ExitProc TkFinalizeThread; MODULE_SCOPE void TkpBuildRegionFromAlphaData(Region region, unsigned x, unsigned y, unsigned width, unsigned height, unsigned char *dataPtr, |
︙ | ︙ | |||
1367 1368 1369 1370 1371 1372 1373 | Tcl_Interp *interp, Tcl_Obj *listObj, int toplevel, Tcl_Obj *nameObj); MODULE_SCOPE void TkRotatePoint(double originX, double originY, double sine, double cosine, double *xPtr, double *yPtr); MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*); | > | > > > > > > | 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 | Tcl_Interp *interp, Tcl_Obj *listObj, int toplevel, Tcl_Obj *nameObj); MODULE_SCOPE void TkRotatePoint(double originX, double originY, double sine, double cosine, double *xPtr, double *yPtr); MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*); #if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) # define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1) # define TK_OPTION_UNDERLINE_DEF(type, field) "-1", TCL_INDEX_NONE, offsetof(type, field), 0, NULL #else # define TkNewIndexObj(value) (((TkSizeT)(value) == TCL_INDEX_NONE) ? Tcl_NewObj() : Tcl_NewWideIntObj(value)) # define TK_OPTION_UNDERLINE_DEF(type, field) NULL, TCL_INDEX_NONE, offsetof(type, field), TK_OPTION_NULL_OK, NULL #endif #ifdef _WIN32 #define TkParseColor XParseColor #else MODULE_SCOPE Status TkParseColor (Display * display, Colormap map, const char* spec, XColor * colorPtr); |
︙ | ︙ | |||
1406 1407 1408 1409 1410 1411 1412 | MODULE_SCOPE void TkUnixSetXftClipRegion(Region clipRegion); #endif #if !defined(__cplusplus) && !defined(c_plusplus) # define c_class class #endif | > | < < | | < < < < < < < > > | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 | MODULE_SCOPE void TkUnixSetXftClipRegion(Region clipRegion); #endif #if !defined(__cplusplus) && !defined(c_plusplus) # define c_class class #endif /* Tcl 8.6 has a different definition of Tcl_UniChar than other Tcl versions for TCL_UTF_MAX > 3 */ #if TCL_UTF_MAX > (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6)) # define TkUtfToUniChar(src, ch) (size_t)(((int (*)(const char *, int *))Tcl_UtfToUniChar)(src, ch)) # define TkUniCharToUtf(ch, src) (size_t)(((int (*)(int, char *))Tcl_UniCharToUtf)(ch, src)) #else MODULE_SCOPE size_t TkUtfToUniChar(const char *, int *); MODULE_SCOPE size_t TkUniCharToUtf(int, char *); #endif #if defined(_WIN32) && !defined(STATIC_BUILD) && TCL_MAJOR_VERSION < 9 # define tcl_CreateFileHandler reserved9 #endif MODULE_SCOPE void Icu_Init(Tcl_Interp* interp); /* * Unsupported commands. */ MODULE_SCOPE int TkUnsupported1ObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, |
︙ | ︙ |
Changes to generic/tkIntDecls.h.
1 2 3 4 5 6 7 8 | /* * tkIntDecls.h -- * * This file contains the declarations for all unsupported * functions that are exported by the Tk library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkIntDecls.h -- * * This file contains the declarations for all unsupported * functions that are exported by the Tk library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * * Copyright (c) 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKINTDECLS #define _TKINTDECLS |
︙ | ︙ | |||
200 201 202 203 204 205 206 | /* 57 */ EXTERN void TkpClaimFocus(TkWindow *topLevelPtr, int force); /* 58 */ EXTERN void TkpDisplayWarning(const char *msg, const char *title); /* 59 */ EXTERN void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name); /* 60 */ | > | > | > | > | > | | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | /* 57 */ EXTERN void TkpClaimFocus(TkWindow *topLevelPtr, int force); /* 58 */ EXTERN void TkpDisplayWarning(const char *msg, const char *title); /* 59 */ EXTERN void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name); /* 60 */ TK_DEPRECATED("renamed to Tk_GetOtherWindow") TkWindow * TkpGetOtherWindow(TkWindow *winPtr); /* 61 */ EXTERN TkWindow * TkpGetWrapperWindow(TkWindow *winPtr); /* 62 */ EXTERN int TkpInit(Tcl_Interp *interp); /* 63 */ EXTERN void TkpInitializeMenuBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable); /* 64 */ TK_DEPRECATED("renamed to Tk_MakeContainer") void TkpMakeContainer(Tk_Window tkwin); /* 65 */ EXTERN void TkpMakeMenuWindow(Tk_Window tkwin, int transient); /* 66 */ TK_DEPRECATED("renamed to Tk_MakeWindow") Window TkpMakeWindow(TkWindow *winPtr, Window parent); /* 67 */ EXTERN void TkpMenuNotifyToplevelCreate(Tcl_Interp *interp, const char *menuName); /* 68 */ EXTERN TkDisplay * TkpOpenDisplay(const char *display_name); /* 69 */ EXTERN int TkPointerEvent(XEvent *eventPtr, TkWindow *winPtr); /* 70 */ EXTERN int TkPolygonToArea(double *polyPtr, int numPoints, double *rectPtr); /* 71 */ EXTERN double TkPolygonToPoint(double *polyPtr, int numPoints, double *pointPtr); /* 72 */ EXTERN int TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr); /* 73 */ EXTERN void TkpRedirectKeyEvent(TkWindow *winPtr, XEvent *eventPtr); /* 74 */ TK_DEPRECATED("renamed to Tk_SetMainMenubar") void TkpSetMainMenubar(Tcl_Interp *interp, Tk_Window tkwin, const char *menuName); /* 75 */ TK_DEPRECATED("renamed to Tk_UseWindow") int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, const char *string); /* Slot 76 is reserved */ /* 77 */ EXTERN void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr); /* 78 */ EXTERN int TkReadBitmapFile(Display *display, Drawable d, |
︙ | ︙ | |||
263 264 265 266 267 268 269 | EXTERN void TkSelEventProc(Tk_Window tkwin, XEvent *eventPtr); /* 82 */ EXTERN void TkSelInit(Tk_Window tkwin); /* 83 */ EXTERN void TkSelPropProc(XEvent *eventPtr); /* Slot 84 is reserved */ /* 85 */ | > | | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | EXTERN void TkSelEventProc(Tk_Window tkwin, XEvent *eventPtr); /* 82 */ EXTERN void TkSelInit(Tk_Window tkwin); /* 83 */ EXTERN void TkSelPropProc(XEvent *eventPtr); /* Slot 84 is reserved */ /* 85 */ TK_DEPRECATED("renamed to Tk_SetWindowMenubar") void TkSetWindowMenuBar(Tcl_Interp *interp, Tk_Window tkwin, const char *oldMenuName, const char *menuName); /* 86 */ EXTERN KeySym TkStringToKeysym(const char *name); /* 87 */ EXTERN int TkThickPolyLineToArea(double *coordPtr, int numPoints, double width, int capStyle, |
︙ | ︙ | |||
327 328 329 330 331 332 333 | Tk_Window *windowPtr); /* 109 */ EXTERN const char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 110 */ EXTERN void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont); /* 111 */ | > | | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | Tk_Window *windowPtr); /* 109 */ EXTERN const char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 110 */ EXTERN void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont); /* 111 */ TK_DEPRECATED("renamed to Tk_GetSystemDefault") Tcl_Obj * TkpGetSystemDefault(Tk_Window tkwin, const char *dbName, const char *className); /* 112 */ EXTERN void TkpMenuThreadInit(void); /* 113 */ EXTERN int XClipBox(Region rgn, XRectangle *rect_return); /* 114 */ EXTERN Region XCreateRegion(void); |
︙ | ︙ | |||
375 376 377 378 379 380 381 | /* Slot 129 is reserved */ /* Slot 130 is reserved */ /* Slot 131 is reserved */ /* Slot 132 is reserved */ /* Slot 133 is reserved */ /* Slot 134 is reserved */ /* 135 */ | > | | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | /* Slot 129 is reserved */ /* Slot 130 is reserved */ /* Slot 131 is reserved */ /* Slot 132 is reserved */ /* Slot 133 is reserved */ /* Slot 134 is reserved */ /* 135 */ TK_DEPRECATED("renamed to Tk_DrawHighlightBorder") void TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable); /* 136 */ EXTERN void TkSetFocusWin(TkWindow *winPtr, int force); /* 137 */ EXTERN void TkpSetKeycodeAndState(Tk_Window tkwin, KeySym keySym, XEvent *eventPtr); |
︙ | ︙ | |||
554 555 556 557 558 559 560 | int x, int y, int width, int height, double angle); /* 184 */ EXTERN void TkDrawAngledChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); | < < < < | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | int x, int y, int width, int height, double angle); /* 184 */ EXTERN void TkDrawAngledChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 185 */ EXTERN void TkpRedrawWidget(Tk_Window tkwin); /* 186 */ EXTERN int TkpWillDrawWidget(Tk_Window tkwin); /* 187 */ EXTERN int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); typedef struct TkIntStubs { int magic; |
︙ | ︙ | |||
631 632 633 634 635 636 637 | int (*tkOvalToArea) (double *ovalPtr, double *rectPtr); /* 53 */ double (*tkOvalToPoint) (double ovalPtr[], double width, int filled, double pointPtr[]); /* 54 */ int (*tkpChangeFocus) (TkWindow *winPtr, int force); /* 55 */ void (*tkpCloseDisplay) (TkDisplay *dispPtr); /* 56 */ void (*tkpClaimFocus) (TkWindow *topLevelPtr, int force); /* 57 */ void (*tkpDisplayWarning) (const char *msg, const char *title); /* 58 */ void (*tkpGetAppName) (Tcl_Interp *interp, Tcl_DString *name); /* 59 */ | | | | | | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | int (*tkOvalToArea) (double *ovalPtr, double *rectPtr); /* 53 */ double (*tkOvalToPoint) (double ovalPtr[], double width, int filled, double pointPtr[]); /* 54 */ int (*tkpChangeFocus) (TkWindow *winPtr, int force); /* 55 */ void (*tkpCloseDisplay) (TkDisplay *dispPtr); /* 56 */ void (*tkpClaimFocus) (TkWindow *topLevelPtr, int force); /* 57 */ void (*tkpDisplayWarning) (const char *msg, const char *title); /* 58 */ void (*tkpGetAppName) (Tcl_Interp *interp, Tcl_DString *name); /* 59 */ TCL_DEPRECATED_API("renamed to Tk_GetOtherWindow") TkWindow * (*tkpGetOtherWindow) (TkWindow *winPtr); /* 60 */ TkWindow * (*tkpGetWrapperWindow) (TkWindow *winPtr); /* 61 */ int (*tkpInit) (Tcl_Interp *interp); /* 62 */ void (*tkpInitializeMenuBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable); /* 63 */ TCL_DEPRECATED_API("renamed to Tk_MakeContainer") void (*tkpMakeContainer) (Tk_Window tkwin); /* 64 */ void (*tkpMakeMenuWindow) (Tk_Window tkwin, int transient); /* 65 */ TCL_DEPRECATED_API("renamed to Tk_MakeWindow") Window (*tkpMakeWindow) (TkWindow *winPtr, Window parent); /* 66 */ void (*tkpMenuNotifyToplevelCreate) (Tcl_Interp *interp, const char *menuName); /* 67 */ TkDisplay * (*tkpOpenDisplay) (const char *display_name); /* 68 */ int (*tkPointerEvent) (XEvent *eventPtr, TkWindow *winPtr); /* 69 */ int (*tkPolygonToArea) (double *polyPtr, int numPoints, double *rectPtr); /* 70 */ double (*tkPolygonToPoint) (double *polyPtr, int numPoints, double *pointPtr); /* 71 */ int (*tkPositionInTree) (TkWindow *winPtr, TkWindow *treePtr); /* 72 */ void (*tkpRedirectKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 73 */ TCL_DEPRECATED_API("renamed to Tk_SetMainMenubar") void (*tkpSetMainMenubar) (Tcl_Interp *interp, Tk_Window tkwin, const char *menuName); /* 74 */ TCL_DEPRECATED_API("renamed to Tk_UseWindow") int (*tkpUseWindow) (Tcl_Interp *interp, Tk_Window tkwin, const char *string); /* 75 */ void (*reserved76)(void); void (*tkQueueEventForAllChildren) (TkWindow *winPtr, XEvent *eventPtr); /* 77 */ int (*tkReadBitmapFile) (Display *display, Drawable d, const char *filename, unsigned int *width_return, unsigned int *height_return, Pixmap *bitmap_return, int *x_hot_return, int *y_hot_return); /* 78 */ int (*tkScrollWindow) (Tk_Window tkwin, GC gc, int x, int y, int width, int height, int dx, int dy, Region damageRgn); /* 79 */ void (*tkSelDeadWindow) (TkWindow *winPtr); /* 80 */ void (*tkSelEventProc) (Tk_Window tkwin, XEvent *eventPtr); /* 81 */ void (*tkSelInit) (Tk_Window tkwin); /* 82 */ void (*tkSelPropProc) (XEvent *eventPtr); /* 83 */ void (*reserved84)(void); TCL_DEPRECATED_API("renamed to Tk_SetWindowMenubar") void (*tkSetWindowMenuBar) (Tcl_Interp *interp, Tk_Window tkwin, const char *oldMenuName, const char *menuName); /* 85 */ KeySym (*tkStringToKeysym) (const char *name); /* 86 */ int (*tkThickPolyLineToArea) (double *coordPtr, int numPoints, double width, int capStyle, int joinStyle, double *rectPtr); /* 87 */ void (*tkWmAddToColormapWindows) (TkWindow *winPtr); /* 88 */ void (*tkWmDeadWindow) (TkWindow *winPtr); /* 89 */ TkWindow * (*tkWmFocusToplevel) (TkWindow *winPtr); /* 90 */ void (*tkWmMapWindow) (TkWindow *winPtr); /* 91 */ void (*tkWmNewWindow) (TkWindow *winPtr); /* 92 */ |
︙ | ︙ | |||
682 683 684 685 686 687 688 | int (*tkFindStateNumObj) (Tcl_Interp *interp, Tcl_Obj *optionPtr, const TkStateMap *mapPtr, Tcl_Obj *keyPtr); /* 104 */ Tcl_HashTable * (*tkGetBitmapPredefTable) (void); /* 105 */ TkDisplay * (*tkGetDisplayList) (void); /* 106 */ TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */ int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */ const char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */ void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */ | | | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | int (*tkFindStateNumObj) (Tcl_Interp *interp, Tcl_Obj *optionPtr, const TkStateMap *mapPtr, Tcl_Obj *keyPtr); /* 104 */ Tcl_HashTable * (*tkGetBitmapPredefTable) (void); /* 105 */ TkDisplay * (*tkGetDisplayList) (void); /* 106 */ TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */ int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */ const char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */ void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */ TCL_DEPRECATED_API("renamed to Tk_GetSystemDefault") Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 111 */ void (*tkpMenuThreadInit) (void); /* 112 */ int (*xClipBox) (Region rgn, XRectangle *rect_return); /* 113 */ Region (*xCreateRegion) (void); /* 114 */ int (*xDestroyRegion) (Region rgn); /* 115 */ int (*xIntersectRegion) (Region sra, Region srcb, Region dr_return); /* 116 */ int (*xRectInRegion) (Region rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */ int (*xSetRegion) (Display *display, GC gc, Region rgn); /* 118 */ |
︙ | ︙ | |||
733 734 735 736 737 738 739 | void (*reserved128)(void); void (*reserved129)(void); void (*reserved130)(void); void (*reserved131)(void); void (*reserved132)(void); void (*reserved133)(void); void (*reserved134)(void); | | | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | void (*reserved128)(void); void (*reserved129)(void); void (*reserved130)(void); void (*reserved131)(void); void (*reserved132)(void); void (*reserved133)(void); void (*reserved134)(void); TCL_DEPRECATED_API("renamed to Tk_DrawHighlightBorder") void (*tkpDrawHighlightBorder) (Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable); /* 135 */ void (*tkSetFocusWin) (TkWindow *winPtr, int force); /* 136 */ void (*tkpSetKeycodeAndState) (Tk_Window tkwin, KeySym keySym, XEvent *eventPtr); /* 137 */ KeySym (*tkpGetKeySym) (TkDisplay *dispPtr, XEvent *eventPtr); /* 138 */ void (*tkpInitKeymapInfo) (TkDisplay *dispPtr); /* 139 */ Region (*tkPhotoGetValidRegion) (Tk_PhotoHandle handle); /* 140 */ TkWindow ** (*tkWmStackorderToplevel) (TkWindow *parentPtr); /* 141 */ void (*tkFocusFree) (TkMainInfo *mainPtr); /* 142 */ |
︙ | ︙ | |||
783 784 785 786 787 788 789 | const char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 178 */ int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset); /* 179 */ const char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 180 */ void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); /* 181 */ void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */ int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */ void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */ | < < < < < < < < < < < < < < < < | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 | const char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 178 */ int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, TkSizeT offset); /* 179 */ const char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, TkSizeT offset, Tcl_FreeProc **freeProcPtr); /* 180 */ void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); /* 181 */ void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */ int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */ void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */ void (*tkpRedrawWidget) (Tk_Window tkwin); /* 185 */ int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 186 */ int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 187 */ } TkIntStubs; extern const TkIntStubs *tkIntStubsPtr; #ifdef __cplusplus } |
︙ | ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | (tkIntStubsPtr->tkDrawAngledTextLayout) /* 181 */ #define TkUnderlineAngledTextLayout \ (tkIntStubsPtr->tkUnderlineAngledTextLayout) /* 182 */ #define TkIntersectAngledTextLayout \ (tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */ #define TkDrawAngledChars \ (tkIntStubsPtr->tkDrawAngledChars) /* 184 */ | < < < < > > > > > > > > > > > > > > > > > > > | | 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 | (tkIntStubsPtr->tkDrawAngledTextLayout) /* 181 */ #define TkUnderlineAngledTextLayout \ (tkIntStubsPtr->tkUnderlineAngledTextLayout) /* 182 */ #define TkIntersectAngledTextLayout \ (tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */ #define TkDrawAngledChars \ (tkIntStubsPtr->tkDrawAngledChars) /* 184 */ #define TkpRedrawWidget \ (tkIntStubsPtr->tkpRedrawWidget) /* 185 */ #define TkpWillDrawWidget \ (tkIntStubsPtr->tkpWillDrawWidget) /* 186 */ #define TkDebugPhotoStringMatchDef \ (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 187 */ #endif /* defined(USE_TK_STUBS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #undef TkpCmapStressed_ #undef TkpSync_ #undef TkUnixContainerId_ #undef TkUnixDoOneXEvent_ #undef TkUnixSetMenubar_ #undef TkWmCleanup_ #undef TkSendCleanup_ #undef TkpTestsendCmd_ #undef TkSetWindowMenuBar #undef TkpDrawHighlightBorder #undef TkpUseWindow #undef TkpSetMainMenubar #undef TkpGetOtherWindow #undef TkpGetSystemDefault #undef TkpMakeContainer #undef TkpMakeWindow #if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION == 8) # define TkSetWindowMenuBar Tk_SetWindowMenubar # define TkpDrawHighlightBorder Tk_DrawHighlightBorder # define TkpUseWindow Tk_UseWindow # define TkpSetMainMenubar Tk_SetMainMenubar # define TkpGetOtherWindow ((TkWindow *(*)(TkWindow *))(void *)Tk_GetOtherWindow) # define TkpGetSystemDefault Tk_GetSystemDefault # define TkpMakeContainer Tk_MakeContainer # define TkpMakeWindow ((Window (*)(TkWindow *, Window))(void *)Tk_MakeWindow) #endif #if !defined(MAC_OSX_TK) && !defined(USE_TK_STUBS) # undef TkpWillDrawWidget # undef TkpRedrawWidget # define TkpWillDrawWidget(w) 0 # define TkpRedrawWidget(w) #endif #endif /* _TKINTDECLS */ |
Changes to generic/tkIntPlatDecls.h.
1 2 3 4 5 6 7 8 | /* * tkIntPlatDecls.h -- * * This file contains the declarations for all platform dependent * unsupported functions that are exported by the Tk library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkIntPlatDecls.h -- * * This file contains the declarations for all platform dependent * unsupported functions that are exported by the Tk library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * * Copyright (c) 1998-1999 Scriptics Corporation. * All rights reserved. */ #ifndef _TKINTPLATDECLS #define _TKINTPLATDECLS #ifdef BUILD_tk |
︙ | ︙ |
Changes to generic/tkIntXlibDecls.h.
1 2 3 4 5 6 7 8 | /* * tkIntXlibDecls.h -- * * This file contains the declarations for all platform dependent * unsupported functions that are exported by the Tk library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkIntXlibDecls.h -- * * This file contains the declarations for all platform dependent * unsupported functions that are exported by the Tk library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * * Copyright (c) 1998-1999 Scriptics Corporation. * All rights reserved. */ #ifndef _TKINTXLIBDECLS #define _TKINTXLIBDECLS /* |
︙ | ︙ |
Changes to generic/tkListbox.c.
1 2 3 4 5 6 7 | /* * tkListbox.c -- * * This module implements listbox widgets for the Tk toolkit. A listbox * displays a collection of strings, one per line, and provides scrolling * and selection. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkListbox.c -- * * This module implements listbox widgets for the Tk toolkit. A listbox * displays a collection of strings, one per line, and provides scrolling * and selection. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "default.h" |
︙ | ︙ | |||
216 217 218 219 220 221 222 | * below. */ enum state { STATE_DISABLED, STATE_NORMAL }; | < < < < | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | * below. */ enum state { STATE_DISABLED, STATE_NORMAL }; enum activeStyle { ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE }; static const char *const activeStyleStrings[] = { "dotbox", "none", "underline", NULL }; |
︙ | ︙ | |||
293 294 295 296 297 298 299 | {TK_OPTION_STRING, "-selectmode", "selectMode", "SelectMode", DEF_LISTBOX_SELECT_MODE, TCL_INDEX_NONE, offsetof(Listbox, selectMode), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid", DEF_LISTBOX_SET_GRID, TCL_INDEX_NONE, offsetof(Listbox, setGrid), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_LISTBOX_STATE, TCL_INDEX_NONE, offsetof(Listbox, state), | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | {TK_OPTION_STRING, "-selectmode", "selectMode", "SelectMode", DEF_LISTBOX_SELECT_MODE, TCL_INDEX_NONE, offsetof(Listbox, selectMode), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid", DEF_LISTBOX_SET_GRID, TCL_INDEX_NONE, offsetof(Listbox, setGrid), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_LISTBOX_STATE, TCL_INDEX_NONE, offsetof(Listbox, state), 0, &tkStateStrings[1], 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_LISTBOX_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Listbox, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_LISTBOX_WIDTH, TCL_INDEX_NONE, offsetof(Listbox, width), 0, 0, 0}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", DEF_LISTBOX_SCROLL_COMMAND, TCL_INDEX_NONE, offsetof(Listbox, xScrollCmd), |
︙ | ︙ | |||
319 320 321 322 323 324 325 | * The itemAttrOptionSpecs table defines the valid configuration options for * listbox items. */ static const Tk_OptionSpec itemAttrOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", NULL, TCL_INDEX_NONE, offsetof(ItemAttr, border), | | | | | | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | * The itemAttrOptionSpecs table defines the valid configuration options for * listbox items. */ static const Tk_OptionSpec itemAttrOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", NULL, TCL_INDEX_NONE, offsetof(ItemAttr, border), TK_OPTION_NULL_OK, DEF_LISTBOX_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", NULL, TCL_INDEX_NONE, offsetof(ItemAttr, fgColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", NULL, TCL_INDEX_NONE, offsetof(ItemAttr, selBorder), TK_OPTION_NULL_OK, DEF_LISTBOX_SELECT_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", NULL, TCL_INDEX_NONE, offsetof(ItemAttr, selFgColor), TK_OPTION_NULL_OK, DEF_LISTBOX_SELECT_FG_MONO, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; /* * The following tables define the listbox widget commands (and sub-commands) * and map the indexes into the string tables into enumerated types used to |
︙ | ︙ | |||
366 367 368 369 370 371 372 | "anchor", "clear", "includes", "set", NULL }; enum selcommand { SELECTION_ANCHOR, SELECTION_CLEAR, SELECTION_INCLUDES, SELECTION_SET }; static const char *const scanCommandNames[] = { | | | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | "anchor", "clear", "includes", "set", NULL }; enum selcommand { SELECTION_ANCHOR, SELECTION_CLEAR, SELECTION_INCLUDES, SELECTION_SET }; static const char *const scanCommandNames[] = { "dragto", "mark", NULL }; enum scancommand { SCAN_DRAGTO, SCAN_MARK }; static const char *const indexNames[] = { "active", "anchor", NULL }; enum indices { INDEX_ACTIVE, INDEX_ANCHOR |
︙ | ︙ | |||
1112 1113 1114 1115 1116 1117 1118 | */ result = Tcl_ListObjIndex(interp, listPtr->listObj, index, &el); if (result != TCL_OK) { return result; } | | | 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | */ result = Tcl_ListObjIndex(interp, listPtr->listObj, index, &el); if (result != TCL_OK) { return result; } stringRep = Tcl_GetStringFromObj(el, &stringLen); Tk_GetFontMetrics(listPtr->tkfont, &fm); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen); if (listPtr->justify == TK_JUSTIFY_LEFT) { x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset; } else if (listPtr->justify == TK_JUSTIFY_RIGHT) { x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth) |
︙ | ︙ | |||
2075 2076 2077 2078 2079 2080 2081 | } /* * Draw the actual text of this item. */ Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); | | | 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 | } /* * Draw the actual text of this item. */ Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); stringRep = Tcl_GetStringFromObj(curElement, &stringLen); textWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen); Tk_GetFontMetrics(listPtr->tkfont, &fm); y += fm.ascent + listPtr->selBorderWidth; if (listPtr->justify == TK_JUSTIFY_LEFT) { x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset; |
︙ | ︙ | |||
2188 2189 2190 2191 2192 2193 2194 | listPtr->borderWidth, listPtr->relief); if (listPtr->highlightWidth > 0) { GC fgGC, bgGC; bgGC = Tk_GCForColor(listPtr->highlightBgColorPtr, pixmap); if (listPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(listPtr->highlightColorPtr, pixmap); | | | | 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 | listPtr->borderWidth, listPtr->relief); if (listPtr->highlightWidth > 0) { GC fgGC, bgGC; bgGC = Tk_GCForColor(listPtr->highlightBgColorPtr, pixmap); if (listPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(listPtr->highlightColorPtr, pixmap); Tk_DrawHighlightBorder(tkwin, fgGC, bgGC, listPtr->highlightWidth, pixmap); } else { Tk_DrawHighlightBorder(tkwin, bgGC, bgGC, listPtr->highlightWidth, pixmap); } } #ifndef TK_NO_DOUBLE_BUFFERING XCopyArea(listPtr->display, pixmap, Tk_WindowId(tkwin), listPtr->textGC, 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); |
︙ | ︙ | |||
2259 2260 2261 2262 2263 2264 2265 | */ result = Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element); if (result != TCL_OK) { continue; } | | | 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 | */ result = Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element); if (result != TCL_OK) { continue; } text = Tcl_GetStringFromObj(element, &textLength); Tk_GetFontMetrics(listPtr->tkfont, &fm); pixelWidth = Tk_TextWidth(listPtr->tkfont, text, textLength); if (pixelWidth > listPtr->maxWidth) { listPtr->maxWidth = pixelWidth; } } } |
︙ | ︙ | |||
2337 2338 2339 2340 2341 2342 2343 | oldMaxWidth = listPtr->maxWidth; for (i = 0; i < objc; i++) { /* * Check if any of the new elements are wider than the current widest; * if so, update our notion of "widest." */ | | | 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 | oldMaxWidth = listPtr->maxWidth; for (i = 0; i < objc; i++) { /* * Check if any of the new elements are wider than the current widest; * if so, update our notion of "widest." */ stringRep = Tcl_GetStringFromObj(objv[i], &length); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length); if (pixelWidth > listPtr->maxWidth) { listPtr->maxWidth = pixelWidth; } } /* |
︙ | ︙ | |||
2496 2497 2498 2499 2500 2501 2502 | * Check width of the element. We only have to check if widthChanged * has not already been set to 1, because we only need one maxWidth * element to disappear for us to have to recompute the width. */ if (widthChanged == 0) { Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element); | | | 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 | * Check width of the element. We only have to check if widthChanged * has not already been set to 1, because we only need one maxWidth * element to disappear for us to have to recompute the width. */ if (widthChanged == 0) { Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element); stringRep = Tcl_GetStringFromObj(element, &length); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length); if (pixelWidth == listPtr->maxWidth) { widthChanged = 1; } } } |
︙ | ︙ | |||
2800 2801 2802 2803 2804 2805 2806 | /* * Everything failed, nothing matched. Throw up an error message. */ badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad listbox index \"%s\": must be active, anchor, end, @x,y," | | | 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 | /* * Everything failed, nothing matched. Throw up an error message. */ badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad listbox index \"%s\": must be active, anchor, end, @x,y," " or an index", Tcl_GetString(indexObj))); Tcl_SetErrorCode(interp, "TK", "VALUE", "LISTBOX_INDEX", NULL); return TCL_ERROR; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3144 3145 3146 3147 3148 3149 3150 | entry = Tcl_FindHashEntry(listPtr->selection, KEY(i)); if (entry != NULL) { if (needNewline) { Tcl_DStringAppend(&selection, "\n", 1); } Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); | | | 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 | entry = Tcl_FindHashEntry(listPtr->selection, KEY(i)); if (entry != NULL) { if (needNewline) { Tcl_DStringAppend(&selection, "\n", 1); } Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); stringRep = Tcl_GetStringFromObj(curElement, &stringLen); Tcl_DStringAppend(&selection, stringRep, stringLen); needNewline = 1; } } length = Tcl_DStringLength(&selection); if (length == 0) { |
︙ | ︙ | |||
3451 3452 3453 3454 3455 3456 3457 | /* * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable! */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && listPtr->listVarName) { | | | | 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 | /* * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable! */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && listPtr->listVarName) { void *probe = NULL; do { probe = Tcl_VarTraceInfo(interp, listPtr->listVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ListboxListVarProc, probe); if (probe == (void *)listPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * listVarName, which means it is not unset and not |
︙ | ︙ |
Changes to generic/tkMacWinMenu.c.
1 2 3 4 5 6 | /* * tkMacWinMenu.c -- * * This module implements the common elements of the Mac and Windows * specific features of menus. This file is not used for UNIX. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkMacWinMenu.c -- * * This module implements the common elements of the Mac and Windows * specific features of menus. This file is not used for UNIX. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkMenu.h" |
︙ | ︙ |
Changes to generic/tkMain.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | /* * The default prompt used when the user has not overridden it. */ static const char DEFAULT_PRIMARY_PROMPT[] = "% "; /* | | | | | < | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /* * The default prompt used when the user has not overridden it. */ static const char DEFAULT_PRIMARY_PROMPT[] = "% "; /* * This file can be compiled on Windows in UNICODE mode, as well as on all * other platforms using the native encoding. This is done by using the normal * Windows functions like _tcscmp, but on platforms which don't have <tchar.h> * we have to translate that to strcmp here. */ #ifdef _WIN32 #ifdef __cplusplus extern "C" { #endif /* Little hack to eliminate the need for "tclInt.h" here: Just copy a small portion of TclIntPlatStubs, just |
︙ | ︙ | |||
64 65 66 67 68 69 70 | static inline Tcl_Obj * NewNativeObj( TCHAR *string) { Tcl_Obj *obj; Tcl_DString ds; | | | | | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | static inline Tcl_Obj * NewNativeObj( TCHAR *string) { Tcl_Obj *obj; Tcl_DString ds; #if defined(_WIN32) && defined(UNICODE) Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(string, wcslen(string), &ds); #else (void)Tcl_ExternalToUtfDStringEx(NULL, (char *)string, -1, TCL_ENCODING_NOCOMPLAIN, &ds); #endif obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); return obj; } /* * Declarations for various library functions and variables (don't want to * include tclInt.h or tclPort.h here, because people might copy this file out * of the Tk source directory to make their own modified versions). Note: do * not declare "exit" here even though a declaration is really needed, because * it will conflict with a declaration elsewhere on some systems. */ #if defined(_WIN32) #define isatty WinIsTty static int WinIsTty(int fd) { HANDLE handle; /* * For now, under Windows, we assume we are not running as a console mode * app, so we need to use the GUI console. In order to enable this, we * always claim to be running on a tty. This probably isn't the right way * to do it. */ #if !defined(STATIC_BUILD) if (tclStubsPtr->tcl_CreateFileHandler && tclIntPlatStubsPtr->tclpIsAtty) { /* We are running on Cygwin */ return tclIntPlatStubsPtr->tclpIsAtty(fd); } #endif handle = GetStdHandle(STD_INPUT_HANDLE + fd); /* * If it's a bad or closed handle, then it's been connected to a wish * console window. A character file handle is a tty by definition. */ return (handle == INVALID_HANDLE_VALUE) || (handle == 0) || (GetFileType(handle) == FILE_TYPE_UNKNOWN) || (GetFileType(handle) == FILE_TYPE_CHAR); } #else extern int isatty(int fd); #endif typedef struct { Tcl_Channel input; /* The standard input channel from which lines * are read. */ int tty; /* Non-zero means standard input is a * terminal-like device. Zero means it's a * file. */ Tcl_DString command; /* Used to assemble lines of terminal input * into Tcl commands. */ |
︙ | ︙ | |||
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | TCHAR **argv, /* Array of argument strings. */ Tcl_AppInitProc *appInitProc, /* Application-specific initialization * function to call after most initialization * but before starting to execute commands. */ Tcl_Interp *interp) { Tcl_Obj *path, *argvPtr, *appName; const char *encodingName; int code, nullStdin = 0; Tcl_Channel chan; InteractiveState is; /* * Ensure that we are getting a compatible version of Tcl. */ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { abort(); } else { Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp))); } } #if defined(_WIN32) && !defined(UNICODE) && !defined(STATIC_BUILD) | > > > > > > | | | | | > > | > | | | > | | | > | | | > < < | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | TCHAR **argv, /* Array of argument strings. */ Tcl_AppInitProc *appInitProc, /* Application-specific initialization * function to call after most initialization * but before starting to execute commands. */ Tcl_Interp *interp) { int i=0; /* argv[i] index */ Tcl_Obj *path, *argvPtr, *appName; const char *encodingName; int code, nullStdin = 0; Tcl_Channel chan; InteractiveState is; if (0 < argc) { --argc; /* "consume" argv[0] */ ++i; } /* * Ensure that we are getting a compatible version of Tcl. */ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { abort(); } else { Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp))); } } #if defined(_WIN32) && !defined(UNICODE) && !defined(STATIC_BUILD) if (tclStubsPtr->tcl_CreateFileHandler) { /* We are running win32 Tk under Cygwin, so let's check * whether the env("DISPLAY") variable or the -display * argument is set. If so, we really want to run the * Tk_MainEx function of libtk8.?.dll, not this one. */ if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) { loadCygwinTk: if (TkCygwinMainEx(argc, argv, appInitProc, interp)) { /* Should never reach here. */ return; } } else { int j; for (j = 1; j < argc; ++j) { if (!strcmp(argv[j], "-display")) { goto loadCygwinTk; } } } } #endif Tcl_InitMemory(interp); is.interp = interp; is.gotPartial = 0; Tcl_Preserve(interp); #if defined(_WIN32) #if !defined(STATIC_BUILD) /* If compiled for Win32 but running on Cygwin, don't use console */ if (!tclStubsPtr->tcl_CreateFileHandler) #endif Tk_InitConsoleChannels(interp); #endif #ifdef MAC_OSX_TK if (Tcl_GetStartupScript(NULL) == NULL) { TkMacOSXDefaultStartupScript(); } #endif /* * If the application has not already set a startup script, parse the * first few command line arguments to determine the script path and * encoding. */ if (NULL == Tcl_GetStartupScript(NULL)) { #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 size_t length; #endif /* * Check whether first 3 args (argv[1] - argv[3]) look like * -encoding ENCODING FILENAME * or like * FILENAME * or like * -file FILENAME (ancient history support only, removed with Tcl 9.0) */ /* mind argc is being adjusted as we proceed */ if ((argc >= 3) && (0 == _tcscmp(TEXT("-encoding"), argv[1])) && ('-' != argv[3][0])) { Tcl_Obj *value = NewNativeObj(argv[2]); Tcl_SetStartupScript(NewNativeObj(argv[3]), Tcl_GetString(value)); Tcl_DecrRefCount(value); argc -= 3; i += 3; } else if ((argc >= 1) && ('-' != argv[1][0])) { Tcl_SetStartupScript(NewNativeObj(argv[1]), NULL); argc--; i++; #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 } else if ((argc >= 2) && (length = _tcslen(argv[1])) && (length > 1) && (0 == _tcsncmp(TEXT("-file"), argv[1], length)) && ('-' != argv[2][0])) { Tcl_SetStartupScript(NewNativeObj(argv[2]), NULL); argc -= 2; i += 2; #endif } } path = Tcl_GetStartupScript(&encodingName); if (path == NULL) { appName = NewNativeObj(argv[0]); } else { appName = path; } Tcl_SetVar2Ex(interp, "argv0", NULL, appName, TCL_GLOBAL_ONLY); Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj(argc), TCL_GLOBAL_ONLY); argvPtr = Tcl_NewListObj(0, NULL); while (argc--) { Tcl_ListObjAppendElement(NULL, argvPtr, NewNativeObj(argv[i++])); } Tcl_SetVar2Ex(interp, "argv", NULL, argvPtr, TCL_GLOBAL_ONLY); /* * Set the "tcl_interactive" variable. */ |
︙ | ︙ | |||
399 400 401 402 403 404 405 | * *---------------------------------------------------------------------- */ static void StdinProc( ClientData clientData, /* The state of interactive cmd line */ | | | | | > > > > > > < < > | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | * *---------------------------------------------------------------------- */ static void StdinProc( ClientData clientData, /* The state of interactive cmd line */ TCL_UNUSED(int) /*mask*/) { char *cmd; int code; int length; InteractiveState *isPtr = (InteractiveState *)clientData; Tcl_Channel chan = isPtr->input; Tcl_Interp *interp = isPtr->interp; length = Tcl_Gets(chan, &isPtr->line); if ((length < 0) && !isPtr->gotPartial) { if (isPtr->tty) { /* * Would be better to find a way to exit the mainLoop? Or perhaps * evaluate [exit]? Leaving as is for now due to compatibility * concerns. */ Tcl_Exit(0); } Tcl_DeleteChannelHandler(chan, StdinProc, isPtr); return; } Tcl_DStringAppend(&isPtr->command, Tcl_DStringValue(&isPtr->line), -1); cmd = Tcl_DStringAppend(&isPtr->command, "\n", -1); Tcl_DStringFree(&isPtr->line); if (!Tcl_CommandComplete(cmd)) { |
︙ | ︙ | |||
437 438 439 440 441 442 443 | * otherwise if the command re-enters the event loop we might process * commands from stdin before the current command is finished. Among other * things, this will trash the text of the command being evaluated. */ Tcl_CreateChannelHandler(chan, 0, StdinProc, isPtr); code = Tcl_RecordAndEval(interp, cmd, TCL_EVAL_GLOBAL); | < | | | < | | > | | | | > > > | > > > > > > > | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | * otherwise if the command re-enters the event loop we might process * commands from stdin before the current command is finished. Among other * things, this will trash the text of the command being evaluated. */ Tcl_CreateChannelHandler(chan, 0, StdinProc, isPtr); code = Tcl_RecordAndEval(interp, cmd, TCL_EVAL_GLOBAL); isPtr->input = chan = Tcl_GetStdChannel(TCL_STDIN); if (chan != NULL) { Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc, isPtr); } Tcl_DStringFree(&isPtr->command); if (code != TCL_OK) { chan = Tcl_GetStdChannel(TCL_STDERR); if (chan != NULL) { Tcl_WriteObj(chan, Tcl_GetObjResult(interp)); Tcl_WriteChars(chan, "\n", 1); } } else if (isPtr->tty) { Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); chan = Tcl_GetStdChannel(TCL_STDOUT); Tcl_IncrRefCount(resultPtr); (void)Tcl_GetStringFromObj(resultPtr, &length); if ((length > 0) && (chan != NULL)) { Tcl_WriteObj(chan, resultPtr); Tcl_WriteChars(chan, "\n", 1); } Tcl_DecrRefCount(resultPtr); } /* * If a tty stdin is still around, output a prompt. */ prompt: |
︙ | ︙ | |||
506 507 508 509 510 511 512 | } } } else { code = Tcl_EvalObjEx(interp, promptCmdPtr, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (script that generates prompt)"); | < | | | | < | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | } } } else { code = Tcl_EvalObjEx(interp, promptCmdPtr, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (script that generates prompt)"); chan = Tcl_GetStdChannel(TCL_STDERR); if (chan != NULL) { Tcl_WriteObj(chan, Tcl_GetObjResult(interp)); Tcl_WriteChars(chan, "\n", 1); } goto defaultPrompt; } } chan = Tcl_GetStdChannel(TCL_STDOUT); if (chan != NULL) { |
︙ | ︙ |
Changes to generic/tkMenu.c.
1 2 3 4 5 6 7 8 | /* * tkMenu.c -- * * This file contains most of the code for implementing menus in Tk. It takes * care of all of the generic (platform-independent) parts of menus, and is * supplemented by platform-specific files. The geometry calculation and * drawing code for menus is in the file tkMenuDraw.c * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMenu.c -- * * This file contains most of the code for implementing menus in Tk. It takes * care of all of the generic (platform-independent) parts of menus, and is * supplemented by platform-specific files. The geometry calculation and * drawing code for menus is in the file tkMenuDraw.c * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ /* * Notes on implementation of menus: |
︙ | ︙ | |||
97 98 99 100 101 102 103 | TCL_DECLARE_MUTEX(menuMutex) /* * Configuration specs for individual menu entries. If this changes, be sure * to update code in TkpMenuInit that changes the font string entry. */ | < < < < < < < < < < < | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | TCL_DECLARE_MUTEX(menuMutex) /* * Configuration specs for individual menu entries. If this changes, be sure * to update code in TkpMenuInit that changes the font string entry. */ static const char *const menuEntryTypeStrings[] = { "cascade", "checkbutton", "command", "radiobutton", "separator", NULL }; static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", NULL, NULL, DEF_MENU_ENTRY_ACTIVE_BG, offsetof(TkMenuEntry, activeBorderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-activeforeground", NULL, NULL, DEF_MENU_ENTRY_ACTIVE_FG, offsetof(TkMenuEntry, activeFgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, |
︙ | ︙ | |||
136 137 138 139 140 141 142 | DEF_MENU_ENTRY_COLUMN_BREAK, TCL_INDEX_NONE, offsetof(TkMenuEntry, columnBreak), 0, NULL, 0}, {TK_OPTION_STRING, "-command", NULL, NULL, DEF_MENU_ENTRY_COMMAND, offsetof(TkMenuEntry, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_MENU_ENTRY_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuEntry, compound), 0, | | | | | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | DEF_MENU_ENTRY_COLUMN_BREAK, TCL_INDEX_NONE, offsetof(TkMenuEntry, columnBreak), 0, NULL, 0}, {TK_OPTION_STRING, "-command", NULL, NULL, DEF_MENU_ENTRY_COMMAND, offsetof(TkMenuEntry, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_MENU_ENTRY_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuEntry, compound), 0, tkCompoundStrings, 0}, {TK_OPTION_FONT, "-font", NULL, NULL, DEF_MENU_ENTRY_FONT, offsetof(TkMenuEntry, fontPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-foreground", NULL, NULL, DEF_MENU_ENTRY_FG, offsetof(TkMenuEntry, fgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-hidemargin", NULL, NULL, DEF_MENU_ENTRY_HIDE_MARGIN, TCL_INDEX_NONE, offsetof(TkMenuEntry, hideMargin), 0, NULL, 0}, {TK_OPTION_STRING, "-image", NULL, NULL, DEF_MENU_ENTRY_IMAGE, offsetof(TkMenuEntry, imagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-label", NULL, NULL, DEF_MENU_ENTRY_LABEL, offsetof(TkMenuEntry, labelPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_STRING_TABLE, "-state", NULL, NULL, DEF_MENU_ENTRY_STATE, TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0, tkStateStrings, 0}, {TK_OPTION_INDEX, "-underline", NULL, NULL, TK_OPTION_UNDERLINE_DEF(TkMenuEntry, underline), 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; static const Tk_OptionSpec tkSeparatorEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, offsetof(TkMenuEntry, borderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, |
︙ | ︙ | |||
224 225 226 227 228 229 230 | }; static const Tk_OptionSpec tkTearoffEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, offsetof(TkMenuEntry, borderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-state", NULL, NULL, | | | | | | | | | | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | }; static const Tk_OptionSpec tkTearoffEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, offsetof(TkMenuEntry, borderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-state", NULL, NULL, DEF_MENU_ENTRY_STATE, TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0, tkStateStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; static const Tk_OptionSpec *specsArray[] = { tkCascadeEntryConfigSpecs, tkCheckButtonEntryConfigSpecs, tkBasicMenuEntryConfigSpecs, tkRadioButtonEntryConfigSpecs, tkSeparatorEntryConfigSpecs, tkTearoffEntryConfigSpecs }; /* * Menu type strings for use with Tcl_GetIndexFromObj. */ static const char *const menuTypeStrings[] = { "menubar", "normal", "tearoff", NULL }; static const Tk_OptionSpec tkMenuConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENU_ACTIVE_BG_COLOR, offsetof(TkMenu, activeBorderPtr), TCL_INDEX_NONE, 0, DEF_MENU_ACTIVE_BG_MONO, 0}, {TK_OPTION_PIXELS, "-activeborderwidth", "activeBorderWidth", "BorderWidth", DEF_MENU_ACTIVE_BORDER_WIDTH, offsetof(TkMenu, activeBorderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_MENU_ACTIVE_FG_COLOR, offsetof(TkMenu, activeFgPtr), TCL_INDEX_NONE, 0, DEF_MENU_ACTIVE_FG_MONO, 0}, {TK_OPTION_RELIEF, "-activerelief", "activeRelief", "Relief", DEF_MENU_ACTIVE_RELIEF, offsetof(TkMenu, activeReliefPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_MENU_BG_COLOR, offsetof(TkMenu, borderPtr), TCL_INDEX_NONE, 0, DEF_MENU_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MENU_BORDER_WIDTH, offsetof(TkMenu, borderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MENU_CURSOR, offsetof(TkMenu, cursorPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_MENU_DISABLED_FG_COLOR, offsetof(TkMenu, disabledFgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, DEF_MENU_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_MENU_FONT, offsetof(TkMenu, fontPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_MENU_FG, offsetof(TkMenu, fgPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_STRING, "-postcommand", "postCommand", "Command", DEF_MENU_POST_COMMAND, offsetof(TkMenu, postCommandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_MENU_RELIEF, offsetof(TkMenu, reliefPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_COLOR, "-selectcolor", "selectColor", "Background", DEF_MENU_SELECT_COLOR, offsetof(TkMenu, indicatorFgPtr), TCL_INDEX_NONE, 0, DEF_MENU_SELECT_MONO, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MENU_TAKE_FOCUS, offsetof(TkMenu, takeFocusPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-tearoff", "tearOff", "TearOff", DEF_MENU_TEAROFF, TCL_INDEX_NONE, offsetof(TkMenu, tearoff), 0, NULL, 0}, {TK_OPTION_STRING, "-tearoffcommand", "tearOffCommand", "TearOffCommand", DEF_MENU_TEAROFF_CMD, offsetof(TkMenu, tearoffCommandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-title", "title", "Title", DEF_MENU_TITLE, offsetof(TkMenu, titlePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-type", "type", "Type", DEF_MENU_TYPE, offsetof(TkMenu, menuTypePtr), TCL_INDEX_NONE, 0, menuTypeStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; /* * Command line options. Put here because MenuCmd has to look at them along * with MenuWidgetObjCmd. */ |
︙ | ︙ | |||
576 577 578 579 580 581 582 | if (menuRefPtr->topLevelListPtr != NULL) { TkMenuTopLevelList *topLevelListPtr = menuRefPtr->topLevelListPtr; TkMenuTopLevelList *nextPtr; Tk_Window listtkwin; while (topLevelListPtr != NULL) { /* | | | | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | if (menuRefPtr->topLevelListPtr != NULL) { TkMenuTopLevelList *topLevelListPtr = menuRefPtr->topLevelListPtr; TkMenuTopLevelList *nextPtr; Tk_Window listtkwin; while (topLevelListPtr != NULL) { /* * Need to get the next pointer first. Tk_SetWindowMenubar changes * the list, so that the next pointer is different after calling * it. */ nextPtr = topLevelListPtr->nextPtr; listtkwin = topLevelListPtr->tkwin; Tk_SetWindowMenubar(menuPtr->interp, listtkwin, Tk_PathName(menuPtr->tkwin), Tk_PathName(menuPtr->tkwin)); topLevelListPtr = nextPtr; } } Tcl_SetObjResult(interp, Tk_NewWindowObj(menuPtr->tkwin)); return TCL_OK; |
︙ | ︙ | |||
839 840 841 842 843 844 845 846 | if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index == TCL_INDEX_NONE) { | > | > | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } #if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) if (index == TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_NewObj()); } else #endif Tcl_SetObjResult(interp, TkNewIndexObj(index)); break; } case MENU_INSERT: if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "index type ?-option value ...?"); |
︙ | ︙ | |||
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 | */ DestroyMenuEntry(menuPtr->entries[i]); menuPtr->numEntries = i; } if (menuPtr->entries != NULL) { ckfree(menuPtr->entries); } TkMenuFreeDrawOptions(menuPtr); Tk_FreeConfigOptions((char *) menuPtr, tsdPtr->menuOptionTable, menuPtr->tkwin); if (menuPtr->tkwin != NULL) { Tk_Window tkwin = menuPtr->tkwin; | > | 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 | */ DestroyMenuEntry(menuPtr->entries[i]); menuPtr->numEntries = i; } if (menuPtr->entries != NULL) { ckfree(menuPtr->entries); menuPtr->entries = NULL; } TkMenuFreeDrawOptions(menuPtr); Tk_FreeConfigOptions((char *) menuPtr, tsdPtr->menuOptionTable, menuPtr->tkwin); if (menuPtr->tkwin != NULL) { Tk_Window tkwin = menuPtr->tkwin; |
︙ | ︙ | |||
1706 1707 1708 1709 1710 1711 1712 | * Tk_ConfigureWidget, such as special processing for defaults, sizing * strings, graphics contexts, etc. */ if (mePtr->labelPtr == NULL) { mePtr->labelLength = 0; } else { | | | | 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 | * Tk_ConfigureWidget, such as special processing for defaults, sizing * strings, graphics contexts, etc. */ if (mePtr->labelPtr == NULL) { mePtr->labelLength = 0; } else { (void)Tcl_GetStringFromObj(mePtr->labelPtr, &mePtr->labelLength); } if (mePtr->accelPtr == NULL) { mePtr->accelLength = 0; } else { (void)Tcl_GetStringFromObj(mePtr->accelPtr, &mePtr->accelLength); } /* * If this is a cascade entry, the platform-specific data of the child * menu has to be updated. Also, the links that point to parents and * cascades have to be updated. */ |
︙ | ︙ | |||
2124 2125 2126 2127 2128 2129 2130 | { int i; const char *string; if (TkGetIntForIndex(objPtr, menuPtr->numEntries - 1, lastOK, indexPtr) == TCL_OK) { /* TCL_INDEX_NONE is only accepted if it does not result from a negative number */ if (*indexPtr != TCL_INDEX_NONE || Tcl_GetString(objPtr)[0] != '-') { | | > > > > > > | 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 | { int i; const char *string; if (TkGetIntForIndex(objPtr, menuPtr->numEntries - 1, lastOK, indexPtr) == TCL_OK) { /* TCL_INDEX_NONE is only accepted if it does not result from a negative number */ if (*indexPtr != TCL_INDEX_NONE || Tcl_GetString(objPtr)[0] != '-') { if (*indexPtr + 1 >= menuPtr->numEntries + 1) { *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1); } return TCL_OK; } } string = Tcl_GetString(objPtr); if ((string[0] == 'a') && (strcmp(string, "active") == 0)) { *indexPtr = menuPtr->active; goto success; } if ((string[0] == 'l') && (strcmp(string, "last") == 0)) { *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1); goto success; } if (string[0] == 0) { *indexPtr = TCL_INDEX_NONE; goto success; } #if !defined(TK_NO_DEPRECATED) && TK_MAJOR_VERSION < 9 if ((string[0] == 'n') && (strcmp(string, "none") == 0)) { *indexPtr = TCL_INDEX_NONE; goto success; } #endif if (string[0] == '@') { if (GetIndexFromCoords(NULL, menuPtr, string, indexPtr) == TCL_OK) { goto success; } } |
︙ | ︙ | |||
2272 2273 2274 2275 2276 2277 2278 | mePtr = (TkMenuEntry *)ckalloc(sizeof(TkMenuEntry)); menuPtr->entries[index] = mePtr; mePtr->type = type; mePtr->optionTable = tsdPtr->entryOptionTables[type]; mePtr->menuPtr = menuPtr; mePtr->labelPtr = NULL; mePtr->labelLength = 0; | | | 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 | mePtr = (TkMenuEntry *)ckalloc(sizeof(TkMenuEntry)); menuPtr->entries[index] = mePtr; mePtr->type = type; mePtr->optionTable = tsdPtr->entryOptionTables[type]; mePtr->menuPtr = menuPtr; mePtr->labelPtr = NULL; mePtr->labelLength = 0; mePtr->underline = INT_MIN; mePtr->bitmapPtr = NULL; mePtr->imagePtr = NULL; mePtr->image = NULL; mePtr->selectImagePtr = NULL; mePtr->selectImage = NULL; mePtr->accelPtr = NULL; mePtr->accelLength = 0; |
︙ | ︙ | |||
2510 2511 2512 2513 2514 2515 2516 | name = Tcl_GetString(mePtr->namePtr); /* * If the variable is being unset, then re-establish the trace. */ if (flags & TCL_TRACE_UNSETS) { | | | | 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 | name = Tcl_GetString(mePtr->namePtr); /* * If the variable is being unset, then re-establish the trace. */ if (flags & TCL_TRACE_UNSETS) { void *probe = NULL; mePtr->entryFlags &= ~ENTRY_SELECTED; do { probe = Tcl_VarTraceInfo(interp, name, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, probe); if (probe == (void *)mePtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * namePtr, which means it is not unset and not |
︙ | ︙ | |||
2689 2690 2691 2692 2693 2694 2695 | CloneMenu( TkMenu *menuPtr, /* The menu we are going to clone. */ Tcl_Obj *newMenuNamePtr, /* The name to give the new menu. */ Tcl_Obj *newMenuTypePtr) /* What kind of menu is this, a normal menu a * menubar, or a tearoff? */ { int returnResult; | | > | 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 | CloneMenu( TkMenu *menuPtr, /* The menu we are going to clone. */ Tcl_Obj *newMenuNamePtr, /* The name to give the new menu. */ Tcl_Obj *newMenuTypePtr) /* What kind of menu is this, a normal menu a * menubar, or a tearoff? */ { int returnResult; int menuType; TkSizeT i; TkMenuReferences *menuRefPtr; Tcl_Obj *menuDupCommandArray[4]; if (newMenuTypePtr == NULL) { menuType = MAIN_MENU; } else { if (Tcl_GetIndexFromObjStruct(menuPtr->interp, newMenuTypePtr, |
︙ | ︙ | |||
2729 2730 2731 2732 2733 2734 2735 | if ((returnResult == TCL_OK) && ((menuRefPtr = TkFindMenuReferencesObj(menuPtr->interp, newMenuNamePtr)) != NULL) && (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) { TkMenu *newMenuPtr = menuRefPtr->menuPtr; Tcl_Obj *newObjv[3]; | | | 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 | if ((returnResult == TCL_OK) && ((menuRefPtr = TkFindMenuReferencesObj(menuPtr->interp, newMenuNamePtr)) != NULL) && (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) { TkMenu *newMenuPtr = menuRefPtr->menuPtr; Tcl_Obj *newObjv[3]; TkSizeT numElements; /* * Now put this newly created menu into the parent menu's instance * chain. */ if (menuPtr->nextInstancePtr == NULL) { |
︙ | ︙ | |||
2800 2801 2802 2803 2804 2805 2806 | Tcl_DecrRefCount(newObjv[1]); Tcl_ResetResult(menuPtr->interp); /* * Clone all of the cascade menus that this menu points to. */ | | | 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 | Tcl_DecrRefCount(newObjv[1]); Tcl_ResetResult(menuPtr->interp); /* * Clone all of the cascade menus that this menu points to. */ for (i = 0; i < menuPtr->numEntries; i++) { TkMenuReferences *cascadeRefPtr; TkMenu *oldCascadePtr; if ((menuPtr->entries[i]->type == CASCADE_ENTRY) && (menuPtr->entries[i]->namePtr != NULL)) { cascadeRefPtr = TkFindMenuReferencesObj(menuPtr->interp, |
︙ | ︙ | |||
3127 3128 3129 3130 3131 3132 3133 | Tcl_DecrRefCount(childPtr); return resultPtr; } /* *---------------------------------------------------------------------- * | | | | 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 | Tcl_DecrRefCount(childPtr); return resultPtr; } /* *---------------------------------------------------------------------- * * Tk_SetWindowMenubar -- * * Associates a menu with a window. Called by ConfigureFrame in in * response to a "-menu .foo" configuration option for a top level. * * Results: * None. * * Side effects: * The old menu clones for the menubar are thrown away, and a handler is * set up to allocate the new ones. * *---------------------------------------------------------------------- */ void Tk_SetWindowMenubar( Tcl_Interp *interp, /* The interpreter the toplevel lives in. */ Tk_Window tkwin, /* The toplevel window. */ const char *oldMenuName, /* The name of the menubar previously set in * this toplevel. NULL means no menu was set * previously. */ const char *menuName) /* The name of the new menubar that the * toplevel needs to be set to. NULL means |
︙ | ︙ | |||
3285 3286 3287 3288 3289 3290 3291 | topLevelListPtr = (TkMenuTopLevelList *)ckalloc(sizeof(TkMenuTopLevelList)); topLevelListPtr->tkwin = tkwin; topLevelListPtr->nextPtr = menuRefPtr->topLevelListPtr; menuRefPtr->topLevelListPtr = topLevelListPtr; } else { TkpSetWindowMenuBar(tkwin, NULL); } | | | 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 | topLevelListPtr = (TkMenuTopLevelList *)ckalloc(sizeof(TkMenuTopLevelList)); topLevelListPtr->tkwin = tkwin; topLevelListPtr->nextPtr = menuRefPtr->topLevelListPtr; menuRefPtr->topLevelListPtr = topLevelListPtr; } else { TkpSetWindowMenuBar(tkwin, NULL); } Tk_SetMainMenubar(interp, tkwin, menuName); } /* *---------------------------------------------------------------------- * * DestroyMenuHashTable -- * |
︙ | ︙ |
Changes to generic/tkMenu.h.
1 2 3 4 5 6 | /* * tkMenu.h -- * * Declarations shared among all of the files that implement menu * widgets. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkMenu.h -- * * Declarations shared among all of the files that implement menu * widgets. * * Copyright © 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKMENU #define _TKMENU |
︙ | ︙ | |||
240 241 242 243 244 245 246 | #define TEAROFF_ENTRY 5 /* * Menu states */ #define ENTRY_ACTIVE 0 | | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | #define TEAROFF_ENTRY 5 /* * Menu states */ #define ENTRY_ACTIVE 0 #define ENTRY_DISABLED 1 #define ENTRY_NORMAL 2 /* * A data structure of the following type is kept for each menu widget: */ typedef struct TkMenu { Tk_Window tkwin; /* Window that embodies the pane. NULL means |
︙ | ︙ | |||
457 458 459 460 461 462 463 | * a menu bar, a MENUBAR instance is created. All instances have the same * configuration information. If the main instance is deleted, all instances * are deleted. If one of the other instances is deleted, only that instance * is deleted. */ #define UNKNOWN_TYPE -1 | > | | < | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | * a menu bar, a MENUBAR instance is created. All instances have the same * configuration information. If the main instance is deleted, all instances * are deleted. If one of the other instances is deleted, only that instance * is deleted. */ #define UNKNOWN_TYPE -1 #define MENUBAR 0 #define MAIN_MENU 1 #define TEAROFF_MENU 2 /* * Various geometry definitions: */ #define CASCADE_ARROW_HEIGHT 10 #define CASCADE_ARROW_WIDTH 8 |
︙ | ︙ | |||
511 512 513 514 515 516 517 | int imgHeight); MODULE_SCOPE Tcl_Obj * TkNewMenuName(Tcl_Interp *interp, Tcl_Obj *parentNamePtr, TkMenu *menuPtr); MODULE_SCOPE int TkPostCommand(TkMenu *menuPtr); MODULE_SCOPE int TkPostSubmenu(Tcl_Interp *interp, TkMenu *menuPtr, TkMenuEntry *mePtr); MODULE_SCOPE int TkPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, | | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | int imgHeight); MODULE_SCOPE Tcl_Obj * TkNewMenuName(Tcl_Interp *interp, Tcl_Obj *parentNamePtr, TkMenu *menuPtr); MODULE_SCOPE int TkPostCommand(TkMenu *menuPtr); MODULE_SCOPE int TkPostSubmenu(Tcl_Interp *interp, TkMenu *menuPtr, TkMenuEntry *mePtr); MODULE_SCOPE int TkPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, int x, int y); MODULE_SCOPE int TkPreprocessMenu(TkMenu *menuPtr); MODULE_SCOPE void TkRecomputeMenu(TkMenu *menuPtr); /* * These routines are the platform-dependent routines called by the common * code. */ |
︙ | ︙ | |||
536 537 538 539 540 541 542 | int drawingParameters); MODULE_SCOPE void TkpMenuInit(void); MODULE_SCOPE int TkpMenuNewEntry(TkMenuEntry *mePtr); MODULE_SCOPE int TkpNewMenu(TkMenu *menuPtr); MODULE_SCOPE int TkpPostMenu(Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, int index); MODULE_SCOPE int TkpPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, | | | 536 537 538 539 540 541 542 543 544 545 546 | int drawingParameters); MODULE_SCOPE void TkpMenuInit(void); MODULE_SCOPE int TkpMenuNewEntry(TkMenuEntry *mePtr); MODULE_SCOPE int TkpNewMenu(TkMenu *menuPtr); MODULE_SCOPE int TkpPostMenu(Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, int index); MODULE_SCOPE int TkpPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, int index); MODULE_SCOPE void TkpSetWindowMenuBar(Tk_Window tkwin, TkMenu *menuPtr); #endif /* _TKMENU */ |
Changes to generic/tkMenuDraw.c.
1 2 3 4 5 6 | /* * tkMenuDraw.c -- * * This module implements the platform-independent drawing and geometry * calculations of menu widgets. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkMenuDraw.c -- * * This module implements the platform-independent drawing and geometry * calculations of menu widgets. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkMenu.h" |
︙ | ︙ | |||
771 772 773 774 775 776 777 | if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawMenu(menuPtr, NULL); } else if (eventPtr->type == ConfigureNotify) { TkEventuallyRecomputeMenu(menuPtr); TkEventuallyRedrawMenu(menuPtr, NULL); } else if (eventPtr->type == ActivateNotify) { if (menuPtr->menuType == TEAROFF_MENU) { | | | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawMenu(menuPtr, NULL); } else if (eventPtr->type == ConfigureNotify) { TkEventuallyRecomputeMenu(menuPtr); TkEventuallyRedrawMenu(menuPtr, NULL); } else if (eventPtr->type == ActivateNotify) { if (menuPtr->menuType == TEAROFF_MENU) { Tk_SetMainMenubar(menuPtr->interp, menuPtr->tkwin, NULL); } } else if (eventPtr->type == DestroyNotify) { if (menuPtr->tkwin != NULL) { if (!(menuPtr->menuFlags & MENU_DELETION_PENDING)) { TkDestroyMenu(menuPtr); } menuPtr->tkwin = NULL; |
︙ | ︙ |
Changes to generic/tkMenubutton.c.
1 2 3 4 5 6 | /* * tkMenubutton.c -- * * This module implements button-like widgets that are used to invoke * pull-down menus. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMenubutton.c -- * * This module implements button-like widgets that are used to invoke * pull-down menus. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkMenubutton.h" |
︙ | ︙ | |||
31 32 33 34 35 36 37 | * is used together with the "enum direction" declaration in tkMenubutton.h. */ static const char *const directionStrings[] = { "above", "below", "flush", "left", "right", NULL }; | < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | * is used together with the "enum direction" declaration in tkMenubutton.h. */ static const char *const directionStrings[] = { "above", "below", "flush", "left", "right", NULL }; /* * Information used for parsing configuration specs: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENUBUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkMenuButton, activeBorder), 0, DEF_MENUBUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_MENUBUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkMenuButton, activeFg), 0, DEF_MENUBUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MENUBUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkMenuButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_MENUBUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkMenuButton, normalBorder), 0, DEF_MENUBUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", DEF_MENUBUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkMenuButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MENUBUTTON_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(TkMenuButton, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MENUBUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkMenuButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", DEF_MENUBUTTON_DIRECTION, TCL_INDEX_NONE, offsetof(TkMenuButton, direction), TK_OPTION_ENUM_VAR, directionStrings, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_MENUBUTTON_DISABLED_FG_COLOR, TCL_INDEX_NONE, offsetof(TkMenuButton, disabledFg), TK_OPTION_NULL_OK, DEF_MENUBUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_MENUBUTTON_FONT, TCL_INDEX_NONE, offsetof(TkMenuButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_MENUBUTTON_FG, TCL_INDEX_NONE, offsetof(TkMenuButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_MENUBUTTON_HEIGHT, TCL_INDEX_NONE, offsetof(TkMenuButton, heightString), 0, 0, 0}, |
︙ | ︙ | |||
127 128 129 130 131 132 133 | {TK_OPTION_PIXELS, "-pady", "padY", "Pad", DEF_MENUBUTTON_PADY, TCL_INDEX_NONE, offsetof(TkMenuButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_MENUBUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkMenuButton, relief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", | | | | | | < | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | {TK_OPTION_PIXELS, "-pady", "padY", "Pad", DEF_MENUBUTTON_PADY, TCL_INDEX_NONE, offsetof(TkMenuButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_MENUBUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkMenuButton, relief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuButton, compound), 0, tkCompoundStrings, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_MENUBUTTON_STATE, TCL_INDEX_NONE, offsetof(TkMenuButton, state), TK_OPTION_ENUM_VAR, tkStateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MENUBUTTON_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_MENUBUTTON_TEXT, TCL_INDEX_NONE, offsetof(TkMenuButton, text), 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_MENUBUTTON_TEXT_VARIABLE, TCL_INDEX_NONE, offsetof(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(TkMenuButton, underline), 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_MENUBUTTON_WIDTH, TCL_INDEX_NONE, offsetof(TkMenuButton, widthString), 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_MENUBUTTON_WRAP_LENGTH, TCL_INDEX_NONE, offsetof(TkMenuButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} |
︙ | ︙ | |||
257 258 259 260 261 262 263 | mbPtr->interp = interp; mbPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(mbPtr->tkwin), MenuButtonWidgetObjCmd, mbPtr, MenuButtonCmdDeletedProc); mbPtr->optionTable = optionTable; mbPtr->menuName = NULL; mbPtr->text = NULL; | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | mbPtr->interp = interp; mbPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(mbPtr->tkwin), MenuButtonWidgetObjCmd, mbPtr, MenuButtonCmdDeletedProc); mbPtr->optionTable = optionTable; mbPtr->menuName = NULL; mbPtr->text = NULL; mbPtr->underline = INT_MIN; mbPtr->textVarName = NULL; mbPtr->bitmap = None; mbPtr->imageString = NULL; mbPtr->image = NULL; mbPtr->state = STATE_NORMAL; mbPtr->normalBorder = NULL; mbPtr->activeBorder = NULL; |
︙ | ︙ | |||
885 886 887 888 889 890 891 | /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && mbPtr->textVarName) { | | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && mbPtr->textVarName) { void *probe = NULL; do { probe = Tcl_VarTraceInfo(interp, mbPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuButtonTextVarProc, probe); if (probe == (void *)mbPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * textVarName, which means it is not unset and not |
︙ | ︙ |
Changes to generic/tkMenubutton.h.
1 2 3 4 5 6 | /* * tkMenubutton.h -- * * Declarations of types and functions used to implement the menubutton * widget. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkMenubutton.h -- * * Declarations of types and functions used to implement the menubutton * widget. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKMENUBUTTON #define _TKMENUBUTTON |
︙ | ︙ | |||
60 61 62 63 64 65 66 | /* * Information about what's displayed in the menu button: */ char *text; /* Text to display in button (malloc'ed) or * NULL. */ | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | /* * Information about what's displayed in the menu button: */ char *text; /* Text to display in button (malloc'ed) or * NULL. */ int underline; /* Index of character to underline. INT_MIN means no underline */ char *textVarName; /* Name of variable (malloc'ed) or NULL. If * non-NULL, button displays the contents of * this variable. */ Pixmap bitmap; /* Bitmap to display or None. If not None then * text and textVar and underline are * ignored. */ char *imageString; /* Name of image to display (malloc'ed), or |
︙ | ︙ |
Changes to generic/tkMessage.c.
1 2 3 4 5 6 7 | /* * tkMessage.c -- * * This module implements a message widgets for the Tk toolkit. A message * widget displays a multi-line string in a window according to a * particular aspect ratio. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMessage.c -- * * This module implements a message widgets for the Tk toolkit. A message * widget displays a multi-line string in a window according to a * particular aspect ratio. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1998-2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "default.h" |
︙ | ︙ | |||
708 709 710 711 712 713 714 | } if (msgPtr->highlightWidth != 0) { GC fgGC, bgGC; bgGC = Tk_GCForColor(msgPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); if (msgPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(msgPtr->highlightColorPtr,Tk_WindowId(tkwin)); | | | | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | } if (msgPtr->highlightWidth != 0) { GC fgGC, bgGC; bgGC = Tk_GCForColor(msgPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); if (msgPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(msgPtr->highlightColorPtr,Tk_WindowId(tkwin)); Tk_DrawHighlightBorder(tkwin, fgGC, bgGC, msgPtr->highlightWidth, Tk_WindowId(tkwin)); } else { Tk_DrawHighlightBorder(tkwin, bgGC, bgGC, msgPtr->highlightWidth, Tk_WindowId(tkwin)); } } } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
844 845 846 847 848 849 850 | /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && msgPtr->textVarName) { | | | | 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && msgPtr->textVarName) { void *probe = NULL; do { probe = Tcl_VarTraceInfo(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, probe); if (probe == (void *)msgPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * textVarName, which means it is not unset and not |
︙ | ︙ |
Changes to generic/tkObj.c.
1 2 3 4 5 | /* * tkObj.c -- * * This file contains functions that implement the common Tk object types * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkObj.c -- * * This file contains functions that implement the common Tk object types * * Copyright © 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
46 47 48 49 50 51 52 | * "dataKey" below is used to locate the ThreadSpecificData for the current * thread. */ typedef struct { const Tcl_ObjType *doubleTypePtr; const Tcl_ObjType *intTypePtr; | < | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | * "dataKey" below is used to locate the ThreadSpecificData for the current * thread. */ typedef struct { const Tcl_ObjType *doubleTypePtr; const Tcl_ObjType *intTypePtr; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * The following structure is the internal representation for mm objects. */ |
︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | static ThreadSpecificData *GetTypeCache(void); static void UpdateStringOfMM(Tcl_Obj *objPtr); static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); #if TCL_MAJOR_VERSION < 9 #if defined(USE_TCL_STUBS) /* Little hack to eliminate the need for "tclInt.h" here: Just copy a small portion of TclIntStubs, just enough to make it work */ typedef struct TclIntStubs { int magic; void *hooks; void (*dummy[34]) (void); /* dummy entries 0-33, not used */ int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */ } TclIntStubs; | > > > | > > > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | static ThreadSpecificData *GetTypeCache(void); static void UpdateStringOfMM(Tcl_Obj *objPtr); static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); #if TCL_MAJOR_VERSION < 9 #ifdef __cplusplus extern "C" { #endif #if defined(USE_TCL_STUBS) /* Little hack to eliminate the need for "tclInt.h" here: Just copy a small portion of TclIntStubs, just enough to make it work */ typedef struct TclIntStubs { int magic; void *hooks; void (*dummy[34]) (void); /* dummy entries 0-33, not used */ int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */ } TclIntStubs; extern const TclIntStubs *tclIntStubsPtr; # undef Tcl_GetIntForIndex # define Tcl_GetIntForIndex(interp, obj, max, ptr) ((tclIntStubsPtr->tclGetIntForIndex == NULL)? \ ((int (*)(Tcl_Interp*, Tcl_Obj *, int, int*))(void *)((&(tclStubsPtr->tcl_PkgProvideEx))[645]))((interp), (obj), (max), (ptr)): \ tclIntStubsPtr->tclGetIntForIndex((interp), (obj), (max), (ptr))) #elif TCL_MINOR_VERSION < 7 extern int TclGetIntForIndex(Tcl_Interp*, Tcl_Obj *, int, int*); # define Tcl_GetIntForIndex(interp, obj, max, ptr) TclGetIntForIndex(interp, obj, max, ptr) #endif #ifdef __cplusplus } #endif #endif /* * The following structure defines the implementation of the "pixel" Tcl * object, used for measuring distances. The pixel object remembers its * initial display-independent settings. |
︙ | ︙ | |||
180 181 182 183 184 185 186 | ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == NULL) { /* Smart initialization of doubleTypePtr/intTypePtr without * hash-table lookup or creating complete Tcl_Obj's */ Tcl_Obj obj; | < < < < < | | < > | < > | > > > | | < < < < < < | | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == NULL) { /* Smart initialization of doubleTypePtr/intTypePtr without * hash-table lookup or creating complete Tcl_Obj's */ Tcl_Obj obj; obj.bytes = (char *)"0.0"; obj.length = 3; obj.typePtr = NULL; Tcl_GetDoubleFromObj(NULL, &obj, &obj.internalRep.doubleValue); tsdPtr->doubleTypePtr = obj.typePtr; obj.bytes = (char *)"0"; obj.length = 1; obj.typePtr = NULL; Tcl_GetLongFromObj(NULL, &obj, &obj.internalRep.longValue); tsdPtr->intTypePtr = obj.typePtr; } return tsdPtr; } /* *---------------------------------------------------------------------- * * TkGetIntForIndex -- * * Almost the same as Tcl_GetIntForIndex, but it return an int. Accepts * "" (empty string) as well. * * Results: * The return value is a standard Tcl object result. * * Side effects: * None * *---------------------------------------------------------------------- */ int TkGetIntForIndex( Tcl_Obj *indexObj, TkSizeT end, int lastOK, TkSizeT *indexPtr) { if (indexObj == NULL) { *indexPtr = TCL_INDEX_NONE; return TCL_OK; } if (Tcl_GetIntForIndex(NULL, indexObj, end + lastOK, indexPtr) != TCL_OK) { const char *value = Tcl_GetString(indexObj); if (!*value) { *indexPtr = TCL_INDEX_NONE; return TCL_OK; } return TCL_ERROR; } #if TCL_MAJOR_VERSION < 9 if (*indexPtr < -1) { *indexPtr = TCL_INDEX_NONE; } else if (end >= -1) #endif if ((*indexPtr + 1) > (end + 1)) { *indexPtr = end + 1; } return TCL_OK; } |
︙ | ︙ | |||
1054 1055 1056 1057 1058 1059 1060 | } /* *---------------------------------------------------------------------- * * Tk_NewWindowObj -- * | | | | 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 | } /* *---------------------------------------------------------------------- * * Tk_NewWindowObj -- * * This function allocates a new Tcl_Obj that refers to a particular * Tk window. * * Results: * A standard Tcl object reference, with refcount 0. * * Side effects: * None. * |
︙ | ︙ | |||
1115 1116 1117 1118 1119 1120 1121 | Tk_Window tkwin, /* A window. Needed by Tk_GetPixels() */ Tcl_Obj *specObj, /* The argument to "-padx", "-pady", "-ipadx", * or "-ipady". The thing to be parsed. */ int *halfPtr, /* Write the left/top part of padding here */ int *allPtr) /* Write the total padding here */ { int firstInt, secondInt; /* The two components of the padding */ | | | 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | Tk_Window tkwin, /* A window. Needed by Tk_GetPixels() */ Tcl_Obj *specObj, /* The argument to "-padx", "-pady", "-ipadx", * or "-ipady". The thing to be parsed. */ int *halfPtr, /* Write the left/top part of padding here */ int *allPtr) /* Write the total padding here */ { int firstInt, secondInt; /* The two components of the padding */ TkSizeT objc; /* The length of the list (should be 1 or 2) */ Tcl_Obj **objv; /* The objects in the list */ /* * Check for a common case where a single object would otherwise be * shimmered between a list and a pixel spec. */ |
︙ | ︙ |
Changes to generic/tkOldConfig.c.
1 2 3 4 5 6 7 | /* * tkOldConfig.c -- * * This file contains the Tk_ConfigureWidget function. THIS FILE IS HERE * FOR BACKWARD COMPATIBILITY; THE NEW CONFIGURATION PACKAGE SHOULD BE * USED FOR NEW PROJECTS. * | | | < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * tkOldConfig.c -- * * This file contains the Tk_ConfigureWidget function. THIS FILE IS HERE * FOR BACKWARD COMPATIBILITY; THE NEW CONFIGURATION PACKAGE SHOULD BE * USED FOR NEW PROJECTS. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" /* * Values for "flags" field of Tk_ConfigSpec structures. Be sure to coordinate * these values with those defined in tk.h (TK_CONFIG_COLOR_ONLY, etc.) There * must not be overlap! */ #ifndef TK_CONFIG_OPTION_SPECIFIED # define TK_CONFIG_OPTION_SPECIFIED (1 << 4) #endif /* * Forward declarations for functions defined later in this file: */ |
︙ | ︙ | |||
348 349 350 351 352 353 354 | * Values must be properly initialized. */ { void *ptr; Tk_Uid uid; int nullValue; nullValue = 0; | | | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | * Values must be properly initialized. */ { void *ptr; Tk_Uid uid; int nullValue; nullValue = 0; if ((*value == 0) && (specPtr->specFlags & (TK_CONFIG_NULL_OK|TCL_NULL_OK))) { nullValue = 1; } do { ptr = (char *)widgRec + specPtr->offset; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: |
︙ | ︙ |
Changes to generic/tkOldTest.c.
1 2 3 4 5 6 7 8 | /* * tkOldTest.c -- * * This file contains C command functions for additional Tcl * commands that are used to test Tk's support for legacy * interfaces. These commands are not normally included in Tcl/Tk * applications; they're only used for testing. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tkOldTest.c -- * * This file contains C command functions for additional Tcl * commands that are used to test Tk's support for legacy * interfaces. These commands are not normally included in Tcl/Tk * applications; they're only used for testing. * * Copyright © 1993-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. * Contributions by Don Porter, NIST, 2007. (not subject to US copyright) * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #define USE_OLD_IMAGE |
︙ | ︙ |
Changes to generic/tkOption.c.
1 2 3 4 5 6 7 | /* * tkOption.c -- * * This module contains functions to manage the option database, which * allows various strings to be associated with windows either by name or * by class or both. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkOption.c -- * * This module contains functions to manage the option database, which * allows various strings to be associated with windows either by name or * by class or both. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
747 748 749 750 751 752 753 | * If this window is in the option stacks, then clear the stacks. * * XXX: OptionThreadExitProc will be invoked before DeleteWindowsExitProc * XXX: if it is thread-specific (which it should be), invalidating the * XXX: tsd. Tk shutdown needs to be verified to handle this correctly. */ | | | | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | * If this window is in the option stacks, then clear the stacks. * * XXX: OptionThreadExitProc will be invoked before DeleteWindowsExitProc * XXX: if it is thread-specific (which it should be), invalidating the * XXX: tsd. Tk shutdown needs to be verified to handle this correctly. */ if (tsdPtr->initialized && (winPtr->optionLevel != TCL_INDEX_NONE)) { int i; for (i = 1; i <= tsdPtr->curLevel; i++) { tsdPtr->levels[i].winPtr->optionLevel = TCL_INDEX_NONE; } tsdPtr->curLevel = -1; tsdPtr->cachedWindow = NULL; } /* * If this window was a main window, then delete its option database. |
︙ | ︙ | |||
795 796 797 798 799 800 801 | TkWindow *winPtr) /* Window whose class changed. */ { int i, j, *basePtr; ElArray *arrayPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | TkWindow *winPtr) /* Window whose class changed. */ { int i, j, *basePtr; ElArray *arrayPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->optionLevel == TCL_INDEX_NONE) { return; } /* * Find the lowest stack level that refers to this window, then flush all * of the levels above the matching one. */ for (i = 1; i <= tsdPtr->curLevel; i++) { if (tsdPtr->levels[i].winPtr == winPtr) { for (j = i; j <= tsdPtr->curLevel; j++) { tsdPtr->levels[j].winPtr->optionLevel = TCL_INDEX_NONE; } tsdPtr->curLevel = i-1; basePtr = tsdPtr->levels[i].bases; for (j = 0; j < NUM_STACKS; j++) { arrayPtr = tsdPtr->stacks[j]; arrayPtr->numUsed = basePtr[j]; arrayPtr->nextToUse = &arrayPtr->els[arrayPtr->numUsed]; |
︙ | ︙ | |||
1265 1266 1267 1268 1269 1270 1271 | /* * Step 2: pop extra unneeded information off the stacks and mark those * windows as no longer having cached information. */ if (tsdPtr->curLevel >= level) { while (tsdPtr->curLevel >= level) { | | | 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | /* * Step 2: pop extra unneeded information off the stacks and mark those * windows as no longer having cached information. */ if (tsdPtr->curLevel >= level) { while (tsdPtr->curLevel >= level) { tsdPtr->levels[tsdPtr->curLevel].winPtr->optionLevel = TCL_INDEX_NONE; tsdPtr->curLevel--; } levelPtr = &tsdPtr->levels[level]; for (i = 0; i < NUM_STACKS; i++) { arrayPtr = tsdPtr->stacks[i]; arrayPtr->numUsed = levelPtr->bases[i]; arrayPtr->nextToUse = &arrayPtr->els[arrayPtr->numUsed]; |
︙ | ︙ |
Changes to generic/tkPack.c.
1 2 3 4 5 6 | /* * tkPack.c -- * * This file contains code to implement the "packer" geometry manager for * Tk. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* * tkPack.c -- * * This file contains code to implement the "packer" geometry manager for * Tk. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" typedef enum {BOTTOM, LEFT, RIGHT, TOP} Side; static const char *const sideNames[] = { "bottom", "left", "right", "top", NULL }; /* * For each window that the packer cares about (either because the window is * managed by the packer or because the window has content that are managed by * the packer), there is a structure of the following type: */ |
︙ | ︙ | |||
220 221 222 223 224 225 226 | } } if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option arg ?arg ...?"); return TCL_ERROR; } | | | | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | } } if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option arg ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(NULL, objv[1], optionStrings, "option", 0, &index) != TCL_OK) { /* * Call it again without the deprecated ones to get a proper error * message. This works well since there can't be any ambiguity between * deprecated and new options. */ Tcl_GetIndexFromObj(interp, objv[1], optionStringsNoDep, "option", 0, &index); return TCL_ERROR; } argv2 = Tcl_GetString(objv[2]); switch ((enum options) index) { #ifndef TK_NO_DEPRECATED case PACK_AFTER: { |
︙ | ︙ | |||
822 823 824 825 826 827 828 | x = frameX + borderLeft; y = frameY + (borderTop + frameHeight - height - borderBtm)/2; break; case TK_ANCHOR_NW: x = frameX + borderLeft; y = frameY + borderTop; break; | | < < | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | x = frameX + borderLeft; y = frameY + (borderTop + frameHeight - height - borderBtm)/2; break; case TK_ANCHOR_NW: x = frameX + borderLeft; y = frameY + borderTop; break; default: x = frameX + (borderLeft + frameWidth - width - borderRight)/2; y = frameY + (borderTop + frameHeight - height - borderBtm)/2; break; } width -= contentPtr->doubleBw; height -= contentPtr->doubleBw; /* * The final step is to set the position, size, and mapped/unmapped * state of the content. If the content is a child of the container, then do |
︙ | ︙ | |||
1109 1110 1111 1112 1113 1114 1115 | Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements: * window name and side against which to * pack. */ { Packer *packPtr; Tk_Window tkwin, ancestor, parent; Tcl_Obj **options; | > | | 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements: * window name and side against which to * pack. */ { Packer *packPtr; Tk_Window tkwin, ancestor, parent; Tcl_Obj **options; int c; TkSizeT index, optionCount; /* * Iterate over all of the window specifiers, each consisting of two * arguments. The first argument contains the window name and the * additional arguments contain options such as "top" or "padx 20". */ |
︙ | ︙ | |||
1177 1178 1179 1180 1181 1182 1183 | packPtr->padLeft = packPtr->padTop = 0; packPtr->iPadX = packPtr->iPadY = 0; packPtr->flags &= ~(FILLX|FILLY|EXPAND); packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; TkSizeT length; | | | 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | packPtr->padLeft = packPtr->padTop = 0; packPtr->iPadX = packPtr->iPadY = 0; packPtr->flags &= ~(FILLX|FILLY|EXPAND); packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; TkSizeT length; const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); c = curOpt[0]; if ((c == 't') && (strncmp(curOpt, "top", length)) == 0) { packPtr->side = TOP; } else if ((c == 'b') |
︙ | ︙ | |||
1204 1205 1206 1207 1208 1209 1210 | && (strcmp(curOpt, "fill")) == 0) { packPtr->flags |= FILLX|FILLY; } else if ((length == 5) && (strcmp(curOpt, "fillx")) == 0) { packPtr->flags |= FILLX; } else if ((length == 5) && (strcmp(curOpt, "filly")) == 0) { packPtr->flags |= FILLY; } else if ((c == 'p') && (strcmp(curOpt, "padx")) == 0) { | | | | | 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | && (strcmp(curOpt, "fill")) == 0) { packPtr->flags |= FILLX|FILLY; } else if ((length == 5) && (strcmp(curOpt, "fillx")) == 0) { packPtr->flags |= FILLX; } else if ((length == 5) && (strcmp(curOpt, "filly")) == 0) { packPtr->flags |= FILLY; } else if ((c == 'p') && (strcmp(curOpt, "padx")) == 0) { if (optionCount <= (index+1)) { missingPad: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # args: \"%s\" option must be" " followed by screen distance", curOpt)); Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", NULL); return TCL_ERROR; } if (TkParsePadAmount(interp, tkwin, options[index+1], &packPtr->padLeft, &packPtr->padX) != TCL_OK) { return TCL_ERROR; } packPtr->padX /= 2; packPtr->padLeft /= 2; packPtr->iPadX = 0; index++; } else if ((c == 'p') && (strcmp(curOpt, "pady")) == 0) { if (optionCount <= (index+1)) { goto missingPad; } if (TkParsePadAmount(interp, tkwin, options[index+1], &packPtr->padTop, &packPtr->padY) != TCL_OK) { return TCL_ERROR; } packPtr->padY /= 2; packPtr->padTop /= 2; packPtr->iPadY = 0; index++; } else if ((c == 'f') && (length > 1) && (strncmp(curOpt, "frame", length) == 0)) { if (optionCount <= (index+1)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "wrong # args: \"frame\"" " option must be followed by anchor point", -1)); Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | static void DestroyPacker( void *memPtr) /* Info about packed window that is now * dead. */ { Packer *packPtr = (Packer *)memPtr; ckfree(packPtr); } /* *---------------------------------------------------------------------- * * PackStructureProc -- | > > > | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 | static void DestroyPacker( void *memPtr) /* Info about packed window that is now * dead. */ { Packer *packPtr = (Packer *)memPtr; if (packPtr->flags & REQUESTED_REPACK) { Tcl_CancelIdleCall(ArrangePacking, packPtr); } ckfree(packPtr); } /* *---------------------------------------------------------------------- * * PackStructureProc -- |
︙ | ︙ | |||
1606 1607 1608 1609 1610 1611 1612 | if ((i+2) > objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "extra option \"%s\" (option with no value?)", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "PACK", "BAD_PARAMETER", NULL); return TCL_ERROR; } | | | | 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 | if ((i+2) > objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "extra option \"%s\" (option with no value?)", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "PACK", "BAD_PARAMETER", NULL); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum options) index) { case CONF_AFTER: if (j == 0) { if (TkGetWindowFromObj(interp, tkwin, objv[i+1], &other) |
︙ | ︙ | |||
1738 1739 1740 1741 1742 1743 1744 | case CONF_PADY: if (TkParsePadAmount(interp, content, objv[i+1], &contentPtr->padTop, &contentPtr->padY) != TCL_OK) { return TCL_ERROR; } break; case CONF_SIDE: | | | | 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 | case CONF_PADY: if (TkParsePadAmount(interp, content, objv[i+1], &contentPtr->padTop, &contentPtr->padY) != TCL_OK) { return TCL_ERROR; } break; case CONF_SIDE: if (Tcl_GetIndexFromObj(interp, objv[i+1], sideNames, "side", TCL_EXACT, &side) != TCL_OK) { return TCL_ERROR; } contentPtr->side = (Side) side; break; } } |
︙ | ︙ |
Changes to generic/tkPanedWindow.c.
1 2 3 4 5 6 7 8 | /* * tkPanedWindow.c -- * * This module implements "paned window" widgets that are object based. A * "paned window" is a widget that manages the geometry for some number * of other widgets, placing a movable "sash" between them, which can be * used to alter the relative sizes of adjacent widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkPanedWindow.c -- * * This module implements "paned window" widgets that are object based. A * "paned window" is a widget that manages the geometry for some number * of other widgets, placing a movable "sash" between them, which can be * used to alter the relative sizes of adjacent widgets. * * Copyright © 1997 Sun Microsystems, Inc. * Copyright © 2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "default.h" |
︙ | ︙ | |||
179 180 181 182 183 184 185 | #define PROXY_REDRAW_PENDING 0x0010 #define RESIZE_PENDING 0x0020 /* * Forward declarations for functions defined later in this file: */ | | | | | | | | | | | | | | | | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | #define PROXY_REDRAW_PENDING 0x0010 #define RESIZE_PENDING 0x0020 /* * Forward declarations for functions defined later in this file: */ int Tk_PanedWindowObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void PanedWindowCmdDeletedProc(void *clientData); static int ConfigurePanedWindow(Tcl_Interp *interp, PanedWindow *pwPtr, int objc, Tcl_Obj *const objv[]); static void DestroyPanedWindow(PanedWindow *pwPtr); static void DisplayPanedWindow(void *clientData); static void PanedWindowEventProc(void *clientData, XEvent *eventPtr); static void ProxyWindowEventProc(void *clientData, XEvent *eventPtr); static void DisplayProxyWindow(void *clientData); static void PanedWindowWorldChanged(void *instanceData); static int PanedWindowWidgetObjCmd(void *clientData, Tcl_Interp *, int objc, Tcl_Obj * const objv[]); static void PanedWindowLostPaneProc(void *clientData, Tk_Window tkwin); static void PanedWindowReqProc(void *clientData, Tk_Window tkwin); static void ArrangePanes(void *clientData); static void Unlink(Pane *panePtr); static Pane * GetPane(PanedWindow *pwPtr, Tk_Window tkwin); static void GetFirstLastVisiblePane(PanedWindow *pwPtr, int *firstPtr, int *lastPtr); static void PaneStructureProc(void *clientData, XEvent *eventPtr); static int PanedWindowSashCommand(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static int PanedWindowProxyCommand(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static void ComputeGeometry(PanedWindow *pwPtr); static int ConfigurePanes(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static void DestroyOptionTables(void *clientData, Tcl_Interp *interp); static int SetSticky(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *recordPtr, TkSizeT internalOffset, char *oldInternalPtr, int flags); static Tcl_Obj * GetSticky(void *clientData, Tk_Window tkwin, char *recordPtr, TkSizeT internalOffset); static void RestoreSticky(void *clientData, Tk_Window tkwin, char *internalPtr, char *oldInternalPtr); static void AdjustForSticky(int sticky, int cavityWidth, int cavityHeight, int *xPtr, int *yPtr, int *paneWidthPtr, int *paneHeightPtr); static void MoveSash(PanedWindow *pwPtr, int sash, int diff); static int ObjectIsEmpty(Tcl_Obj *objPtr); static void * ComputeSlotAddress(void *recordPtr, TkSizeT offset); |
︙ | ︙ | |||
271 272 273 274 275 276 277 | RestoreSticky, /* restoreProc */ NULL, /* freeProc */ 0 }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | RestoreSticky, /* restoreProc */ NULL, /* freeProc */ 0 }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", DEF_PANEDWINDOW_BG_COLOR, TCL_INDEX_NONE, offsetof(PanedWindow, background), 0, DEF_PANEDWINDOW_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_PANEDWINDOW_BORDERWIDTH, TCL_INDEX_NONE, offsetof(PanedWindow, borderWidth), 0, 0, GEOMETRY}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad", DEF_PANEDWINDOW_HANDLEPAD, TCL_INDEX_NONE, offsetof(PanedWindow, handlePad), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize", DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr), offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightPtr), offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize", DEF_PANEDWINDOW_OPAQUERESIZE, TCL_INDEX_NONE, offsetof(PanedWindow, resizeOpaque), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", DEF_PANEDWINDOW_ORIENT, TCL_INDEX_NONE, offsetof(PanedWindow, orient), TK_OPTION_ENUM_VAR, orientStrings, GEOMETRY}, {TK_OPTION_BORDER, "-proxybackground", "proxyBackground", "ProxyBackground", 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyBackground), TK_OPTION_NULL_OK, (void *)DEF_PANEDWINDOW_BG_MONO, 0}, {TK_OPTION_PIXELS, "-proxyborderwidth", "proxyBorderWidth", "ProxyBorderWidth", DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthPtr), offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-proxyrelief", "proxyRelief", "Relief", 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_PANEDWINDOW_RELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, relief), 0, 0, 0}, {TK_OPTION_CURSOR, "-sashcursor", "sashCursor", "Cursor", DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad", DEF_PANEDWINDOW_SASHPAD, TCL_INDEX_NONE, offsetof(PanedWindow, sashPad), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief", DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief), 0, 0, 0}, {TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width", DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthPtr), offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle", DEF_PANEDWINDOW_SHOWHANDLE, TCL_INDEX_NONE, offsetof(PanedWindow, showHandle), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-width", "width", "Width", DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthPtr), offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; static const Tk_OptionSpec paneOptionSpecs[] = { {TK_OPTION_WINDOW, "-after", NULL, NULL, DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Pane, after), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_WINDOW, "-before", NULL, NULL, DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Pane, before), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", NULL, NULL, DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightPtr), offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY}, {TK_OPTION_PIXELS, "-minsize", NULL, NULL, DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0}, {TK_OPTION_CUSTOM, "-sticky", NULL, NULL, DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky), 0, &stickyOption, 0}, {TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch", DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch), TK_OPTION_ENUM_VAR, stretchStrings, 0}, {TK_OPTION_PIXELS, "-width", NULL, NULL, DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthPtr), offsetof(Pane, width), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* *-------------------------------------------------------------- * * Tk_PanedWindowObjCmd -- |
︙ | ︙ | |||
379 380 381 382 383 384 385 | * A new widget is created and configured. * *-------------------------------------------------------------- */ int Tk_PanedWindowObjCmd( | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | * A new widget is created and configured. * *-------------------------------------------------------------- */ int Tk_PanedWindowObjCmd( TCL_UNUSED(void *), /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { PanedWindow *pwPtr; Tk_Window tkwin, parent; OptionTables *pwOpts; |
︙ | ︙ | |||
406 407 408 409 410 411 412 | pwOpts = (OptionTables *) Tcl_GetAssocData(interp, "PanedWindowOptionTables", NULL); if (pwOpts == NULL) { /* * The first time this function is invoked, the option tables will be * NULL. We then create the option tables from the templates and store | | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | pwOpts = (OptionTables *) Tcl_GetAssocData(interp, "PanedWindowOptionTables", NULL); if (pwOpts == NULL) { /* * The first time this function is invoked, the option tables will be * NULL. We then create the option tables from the templates and store * a pointer to the tables as the command's clientData so we'll have * easy access to it in the future. */ pwOpts = (OptionTables *)ckalloc(sizeof(OptionTables)); /* * Set up an exit handler to free the optionTables struct. |
︙ | ︙ | |||
526 527 528 529 530 531 532 | * See the user documentation. * *-------------------------------------------------------------- */ static int PanedWindowWidgetObjCmd( | | | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | * See the user documentation. * *-------------------------------------------------------------- */ static int PanedWindowWidgetObjCmd( void *clientData, /* Information about square widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; int result = TCL_OK; static const char *const optionStrings[] = { |
︙ | ︙ | |||
1011 1012 1013 1014 1015 1016 1017 1018 | i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes); newPanes = (Pane **)ckalloc(i); memset(newPanes, 0, i); if (index == -1) { /* * If none of the existing panes have to be moved, just copy the old * and append the new. */ | > > > | | > | | | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes); newPanes = (Pane **)ckalloc(i); memset(newPanes, 0, i); if (index == -1) { /* * If none of the existing panes have to be moved, just copy the old * and append the new. * Be careful about the case pwPtr->numPanes == 0 since in this case * pwPtr->panes is NULL, and the memcpy would have undefined behavior. */ if (pwPtr->numPanes) { memcpy(newPanes, pwPtr->panes, sizeof(Pane *) * pwPtr->numPanes); } memcpy(&newPanes[pwPtr->numPanes], inserts, sizeof(Pane *) * numNewPanes); } else { /* * If some of the existing panes were moved, the old panes array * will be partially populated, with some valid and some invalid * entries. Walk through it, copying valid entries to the new panes * array as we go; when we get to the insert location for the new * panes, copy the inserts array over, then finish off the old panes * array. */ for (i = 0, j = 0; i < index; i++) { if (pwPtr->panes[i] != NULL) { newPanes[j] = pwPtr->panes[i]; j++; } } memcpy(&newPanes[j], inserts, sizeof(Pane *)*insertIndex); j += firstOptionArg - 2; for (i = index; i < pwPtr->numPanes; i++) { if (pwPtr->panes[i] != NULL) { newPanes[j] = pwPtr->panes[i]; j++; } |
︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 | * Paned window will be relayed out and redisplayed. * *---------------------------------------------------------------------- */ static void PanedWindowWorldChanged( | | | 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 | * Paned window will be relayed out and redisplayed. * *---------------------------------------------------------------------- */ static void PanedWindowWorldChanged( void *instanceData) /* Information about the paned window. */ { XGCValues gcValues; GC newGC; PanedWindow *pwPtr = (PanedWindow *)instanceData; /* * Allocated a graphics context for drawing the paned window widget |
︙ | ︙ | |||
1344 1345 1346 1347 1348 1349 1350 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void PanedWindowEventProc( | | | 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void PanedWindowEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; int i; if (eventPtr->type == Expose) { if (pwPtr->tkwin != NULL && !(pwPtr->flags & REDRAW_PENDING)) { |
︙ | ︙ | |||
1398 1399 1400 1401 1402 1403 1404 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void PanedWindowCmdDeletedProc( | | | 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void PanedWindowCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; /* * This function could be invoked either because the window was destroyed * and the command was then deleted or because the command was deleted, * and then this function destroys the widget. The WIDGET_DELETED flag |
︙ | ︙ | |||
1435 1436 1437 1438 1439 1440 1441 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayPanedWindow( | | | 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayPanedWindow( void *clientData) /* Information about window. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; Pane *panePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; int i, sashWidth, sashHeight; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); |
︙ | ︙ | |||
1620 1621 1622 1623 1624 1625 1626 | * the next idle point. * *-------------------------------------------------------------- */ static void PanedWindowReqProc( | | | 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 | * the next idle point. * *-------------------------------------------------------------- */ static void PanedWindowReqProc( void *clientData, /* Paned window's information about window * that got new preferred geometry. */ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; |
︙ | ︙ | |||
1666 1667 1668 1669 1670 1671 1672 | * recomputed for the panedwindow. * *-------------------------------------------------------------- */ static void PanedWindowLostPaneProc( | | | 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 | * recomputed for the panedwindow. * *-------------------------------------------------------------- */ static void PanedWindowLostPaneProc( void *clientData, /* Grid structure for the pane that was * stolen away. */ TCL_UNUSED(Tk_Window)) /* Tk's handle for the pane. */ { Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; if (pwPtr->tkwin != Tk_Parent(panePtr->tkwin)) { |
︙ | ︙ | |||
1706 1707 1708 1709 1710 1711 1712 | * The panes of containerPtr may get resized or moved. * *-------------------------------------------------------------- */ static void ArrangePanes( | | | 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 | * The panes of containerPtr may get resized or moved. * *-------------------------------------------------------------- */ static void ArrangePanes( void *clientData) /* Structure describing parent whose panes * are to be re-layed out. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; Pane *panePtr; int i, newPaneWidth, newPaneHeight, paneX, paneY; int paneWidth, paneHeight, paneSize, paneMinSize; int doubleBw; |
︙ | ︙ | |||
2152 2153 2154 2155 2156 2157 2158 | * window which managed it. * *-------------------------------------------------------------- */ static void PaneStructureProc( | | | 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 | * window which managed it. * *-------------------------------------------------------------- */ static void PaneStructureProc( void *clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = panePtr->containerPtr; if (eventPtr->type == DestroyNotify) { Unlink(panePtr); |
︙ | ︙ | |||
2364 2365 2366 2367 2368 2369 2370 | * Frees memory. * *---------------------------------------------------------------------- */ static void DestroyOptionTables( | | | 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 | * Frees memory. * *---------------------------------------------------------------------- */ static void DestroyOptionTables( void *clientData, /* Pointer to the OptionTables struct */ TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */ { ckfree(clientData); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2747 2748 2749 2750 2751 2752 2753 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ProxyWindowEventProc( | | | 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ProxyWindowEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; if (eventPtr->type == Expose) { if (pwPtr->proxywin != NULL &&!(pwPtr->flags & PROXY_REDRAW_PENDING)) { Tcl_DoWhenIdle(DisplayProxyWindow, pwPtr); |
︙ | ︙ | |||
2780 2781 2782 2783 2784 2785 2786 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayProxyWindow( | | | 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayProxyWindow( void *clientData) /* Information about window. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; Pixmap pixmap; Tk_Window tkwin = pwPtr->proxywin; pwPtr->flags &= ~PROXY_REDRAW_PENDING; if ((tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; |
︙ | ︙ |
Changes to generic/tkPkgConfig.c.
1 2 3 4 5 6 | /* * tkPkgConfig.c -- * * This file contains the configuration information to embed into the tcl * binary library. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkPkgConfig.c -- * * This file contains the configuration information to embed into the tcl * binary library. * * Copyright © 2002 Andreas Kupries <[email protected]> * Copyright © 2017 Stuart Cassoff <[email protected]> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ /* Note, the definitions in this module are influenced by the following C * preprocessor macros: |
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 | #elif defined(HAVE_XFT) # define CFG_FONTSYSTEM "xft" #else # define CFG_FONTSYSTEM "x11" #endif static const Tcl_Config cfg[] = { {"debug", CFG_DEBUG}, {"threaded", CFG_THREADED}, {"profiled", CFG_PROFILED}, {"64bit", CFG_64}, {"optimized", CFG_OPTIMIZED}, | > | < < | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | #elif defined(HAVE_XFT) # define CFG_FONTSYSTEM "xft" #else # define CFG_FONTSYSTEM "x11" #endif static const Tcl_Config cfg[] = { #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 {"debug", CFG_DEBUG}, {"threaded", CFG_THREADED}, {"profiled", CFG_PROFILED}, {"64bit", CFG_64}, {"optimized", CFG_OPTIMIZED}, {"mem_debug", CFG_MEMDEBUG}, #endif {"fontsystem", CFG_FONTSYSTEM}, /* Runtime paths to various stuff */ #ifdef CFG_RUNTIME_LIBDIR {"libdir,runtime", CFG_RUNTIME_LIBDIR}, #endif |
︙ | ︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 134 135 | #endif #ifdef CFG_RUNTIME_DOCDIR {"docdir,runtime", CFG_RUNTIME_DOCDIR}, #endif #ifdef CFG_RUNTIME_DEMODIR {"demodir,runtime", CFG_RUNTIME_DEMODIR}, #endif /* Installation paths to various stuff */ #ifdef CFG_INSTALL_LIBDIR {"libdir,install", CFG_INSTALL_LIBDIR}, #endif #ifdef CFG_INSTALL_BINDIR | > > > | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #endif #ifdef CFG_RUNTIME_DOCDIR {"docdir,runtime", CFG_RUNTIME_DOCDIR}, #endif #ifdef CFG_RUNTIME_DEMODIR {"demodir,runtime", CFG_RUNTIME_DEMODIR}, #endif #if !defined(STATIC_BUILD) {"dllfile,runtime", CFG_RUNTIME_DLLFILE}, #endif /* Installation paths to various stuff */ #ifdef CFG_INSTALL_LIBDIR {"libdir,install", CFG_INSTALL_LIBDIR}, #endif #ifdef CFG_INSTALL_BINDIR |
︙ | ︙ |
Changes to generic/tkPlace.c.
1 2 3 4 5 6 | /* * tkPlace.c -- * * This file contains code to implement a simple geometry manager for Tk * based on absolute placement or "rubber-sheet" placement. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /* * tkPlace.c -- * * This file contains code to implement a simple geometry manager for Tk * based on absolute placement or "rubber-sheet" placement. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" /* * Border modes for relative placement: * * BM_INSIDE: relative distances computed using area inside all * borders of container window. * BM_OUTSIDE: relative distances computed using outside area that * includes all borders of container. * BM_IGNORE: border issues are ignored: place relative to container's * actual window size. */ static const char *const borderModeStrings[] = { "inside", "ignore", "outside", NULL }; typedef enum {BM_INSIDE, BM_IGNORE, BM_OUTSIDE} BorderMode; /* * For each window whose geometry is managed by the placer there is a * structure of the following type: */ typedef struct Content { |
︙ | ︙ | |||
66 67 68 69 70 71 72 | double relWidth, relHeight; /* Dimensions for tkwin relative to size of * container. */ Tcl_Obj *relWidthPtr; Tcl_Obj *relHeightPtr; Tk_Anchor anchor; /* Which point on tkwin is placed at the given * position. */ BorderMode borderMode; /* How to treat borders of container window. */ | < < | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | double relWidth, relHeight; /* Dimensions for tkwin relative to size of * container. */ Tcl_Obj *relWidthPtr; Tcl_Obj *relHeightPtr; Tk_Anchor anchor; /* Which point on tkwin is placed at the given * position. */ BorderMode borderMode; /* How to treat borders of container window. */ } Content; /* * Type masks for options: */ #define IN_MASK 1 static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE, offsetof(Content, anchor), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE, offsetof(Content, borderMode), TK_OPTION_ENUM_VAR, borderModeStrings, 0}, {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Content, heightPtr), offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin), 0, 0, IN_MASK}, {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "", offsetof(Content, relHeightPtr), offsetof(Content, relHeight), TK_OPTION_NULL_OK, 0, 0}, |
︙ | ︙ | |||
104 105 106 107 108 109 110 | {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xPtr), offsetof(Content, x), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yPtr), offsetof(Content, y), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; | < < < < < < < < < < < < < < | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xPtr), offsetof(Content, x), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yPtr), offsetof(Content, y), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; /* * For each container window that has a content managed by the placer there is a * structure of the following form: */ typedef struct Container { Tk_Window tkwin; /* Tk's token for container window. */ |
︙ | ︙ | |||
275 276 277 278 279 280 281 | dispPtr = ((TkWindow *) tkwin)->dispPtr; if (!dispPtr->placeInit) { Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS); dispPtr->placeInit = 1; } | | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | dispPtr = ((TkWindow *) tkwin)->dispPtr; if (!dispPtr->placeInit) { Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS); dispPtr->placeInit = 1; } if (Tcl_GetIndexFromObj(NULL, objv[1], optionStrings, "option", 0, &index) != TCL_OK) { /* * Call it again without the deprecated ones to get a proper error * message. This works well since there can't be any ambiguity between * deprecated and new options. */ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep, |
︙ | ︙ | |||
406 407 408 409 410 411 412 413 414 415 416 417 418 419 | contentPtr = (Content *)ckalloc(sizeof(Content)); memset(contentPtr, 0, sizeof(Content)); contentPtr->tkwin = tkwin; contentPtr->inTkwin = NULL; contentPtr->anchor = TK_ANCHOR_NW; contentPtr->borderMode = BM_INSIDE; contentPtr->optionTable = table; Tcl_SetHashValue(hPtr, contentPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, contentPtr); return contentPtr; } | > > > > | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | contentPtr = (Content *)ckalloc(sizeof(Content)); memset(contentPtr, 0, sizeof(Content)); contentPtr->tkwin = tkwin; contentPtr->inTkwin = NULL; contentPtr->anchor = TK_ANCHOR_NW; contentPtr->borderMode = BM_INSIDE; contentPtr->width = INT_MIN; contentPtr->height = INT_MIN; contentPtr->relWidth = NAN; contentPtr->relHeight = NAN; contentPtr->optionTable = table; Tcl_SetHashValue(hPtr, contentPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, contentPtr); return contentPtr; } |
︙ | ︙ | |||
433 434 435 436 437 438 439 440 441 442 443 444 445 446 | *---------------------------------------------------------------------- */ static void FreeContent( Content *contentPtr) { Tk_FreeConfigOptions((char *) contentPtr, contentPtr->optionTable, contentPtr->tkwin); ckfree(contentPtr); } /* *---------------------------------------------------------------------- | > > > | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | *---------------------------------------------------------------------- */ static void FreeContent( Content *contentPtr) { if (contentPtr->containerPtr && (contentPtr->containerPtr->flags & PARENT_RECONFIG_PENDING)) { Tcl_CancelIdleCall(RecomputePlacement, contentPtr->containerPtr); } Tk_FreeConfigOptions((char *) contentPtr, contentPtr->optionTable, contentPtr->tkwin); ckfree(contentPtr); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
642 643 644 645 646 647 648 | contentPtr = CreateContent(tkwin, table); if (Tk_SetOptions(interp, contentPtr, table, objc, objv, contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) { goto error; } | < < < < < < < < < < < < < < < < < < < < < | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | contentPtr = CreateContent(tkwin, table); if (Tk_SetOptions(interp, contentPtr, table, objc, objv, contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) { goto error; } if (!(mask & IN_MASK) && (contentPtr->containerPtr != NULL)) { /* * If no -in option was passed and the content is already placed then * just recompute the placement. */ containerPtr = contentPtr->containerPtr; |
︙ | ︙ | |||
820 821 822 823 824 825 826 | Tcl_ListObjAppendElement(NULL, infoObj, Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_AppendToObj(infoObj, " ", -1); } Tcl_AppendPrintfToObj(infoObj, "-x %d -relx %.4g -y %d -rely %.4g", contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY); | | | | | | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | Tcl_ListObjAppendElement(NULL, infoObj, Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_AppendToObj(infoObj, " ", -1); } Tcl_AppendPrintfToObj(infoObj, "-x %d -relx %.4g -y %d -rely %.4g", contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY); if (contentPtr->widthPtr) { Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width); } else { Tcl_AppendToObj(infoObj, " -width {}", -1); } if (contentPtr->relWidthPtr) { Tcl_AppendPrintfToObj(infoObj, " -relwidth %.4g", contentPtr->relWidth); } else { Tcl_AppendToObj(infoObj, " -relwidth {}", -1); } if (contentPtr->heightPtr) { Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height); } else { Tcl_AppendToObj(infoObj, " -height {}", -1); } if (contentPtr->relHeightPtr) { Tcl_AppendPrintfToObj(infoObj, " -relheight %.4g", contentPtr->relHeight); } else { Tcl_AppendToObj(infoObj, " -relheight {}", -1); } Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s", |
︙ | ︙ | |||
932 933 934 935 936 937 938 | * and location of anchor point within container. */ x1 = contentPtr->x + containerX + (contentPtr->relX*containerWidth); x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5)); y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight); y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5)); | | | | | | | | 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | * and location of anchor point within container. */ x1 = contentPtr->x + containerX + (contentPtr->relX*containerWidth); x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5)); y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight); y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5)); if ((contentPtr->widthPtr) || contentPtr->relWidthPtr) { width = 0; if (contentPtr->widthPtr) { width += contentPtr->width; } if (contentPtr->relWidthPtr) { /* * The code below is a bit tricky. In order to round correctly * when both relX and relWidth are specified, compute the * location of the right edge and round that, then compute * width. If we compute the width and round it, rounding * errors in relX and relWidth accumulate. */ x2 = x1 + (contentPtr->relWidth*containerWidth); tmp = (int) (x2 + ((x2 > 0) ? 0.5 : -0.5)); width += tmp - x; } } else { width = Tk_ReqWidth(contentPtr->tkwin) + 2*Tk_Changes(contentPtr->tkwin)->border_width; } if (contentPtr->heightPtr || contentPtr->relHeightPtr) { height = 0; if (contentPtr->heightPtr) { height += contentPtr->height; } if (contentPtr->relHeightPtr) { /* * See note above for rounding errors in width computation. */ y2 = y1 + (contentPtr->relHeight*containerHeight); tmp = (int) (y2 + ((y2 > 0) ? 0.5 : -0.5)); height += tmp - y; |
︙ | ︙ | |||
1006 1007 1008 1009 1010 1011 1012 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; | | | 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; default: x -= width/2; y -= height/2; break; } /* * Step 4: adjust width and height again to reflect inside dimensions |
︙ | ︙ | |||
1210 1211 1212 1213 1214 1215 1216 | PlaceRequestProc( ClientData clientData, /* Pointer to our record for content. */ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { Content *contentPtr = (Content *)clientData; Container *containerPtr; | | | | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | PlaceRequestProc( ClientData clientData, /* Pointer to our record for content. */ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { Content *contentPtr = (Content *)clientData; Container *containerPtr; if ((contentPtr->widthPtr || contentPtr->relWidthPtr) && (contentPtr->heightPtr || contentPtr->relHeightPtr)) { /* * Send a ConfigureNotify to indicate that the size change * request was rejected. */ TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin)); return; |
︙ | ︙ |
Changes to generic/tkPlatDecls.h.
1 2 3 4 5 | /* * tkPlatDecls.h -- * * Declarations of functions in the platform-specific public Tcl API. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkPlatDecls.h -- * * Declarations of functions in the platform-specific public Tcl API. * * Copyright (c) 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKPLATDECLS #define _TKPLATDECLS |
︙ | ︙ |
Changes to generic/tkPointer.c.
1 2 3 4 5 6 7 8 | /* * tkPointer.c -- * * This file contains functions for emulating the X server pointer and * grab state machine. This file is used by the Mac and Windows platforms * to generate appropriate enter/leave events, and to update the global * grab window information. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkPointer.c -- * * This file contains functions for emulating the X server pointer and * grab state machine. This file is used by the Mac and Windows platforms * to generate appropriate enter/leave events, and to update the global * grab window information. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
498 499 500 501 502 503 504 | TkPointerDeadWindow( TkWindow *winPtr) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr == tsdPtr->lastWinPtr) { | | | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | TkPointerDeadWindow( TkWindow *winPtr) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr == tsdPtr->lastWinPtr) { tsdPtr->lastWinPtr = TkGetContainer(winPtr); } if (winPtr == tsdPtr->grabWinPtr) { tsdPtr->grabWinPtr = NULL; } if (winPtr == tsdPtr->restrictWinPtr) { tsdPtr->restrictWinPtr = NULL; } |
︙ | ︙ |
Changes to generic/tkRectOval.c.
1 2 3 4 5 | /* * tkRectOval.c -- * * This file implements rectangle and oval items for canvas widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkRectOval.c -- * * This file implements rectangle and oval items for canvas widgets. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ |
Changes to generic/tkScale.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tkScale.c -- * * This module implements a scale widgets for the Tk toolkit. A scale * displays a slider that can be adjusted to change a value; it also * displays numeric labels and a textual label, if desired. * * The modifications to use floating-point values are based on an * implementation by Paul Mackerras. The -variable option is due to * Henning Schulzrinne. All of these are used with permission. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tkScale.c -- * * This module implements a scale widgets for the Tk toolkit. A scale * displays a slider that can be adjusted to change a value; it also * displays numeric labels and a textual label, if desired. * * The modifications to use floating-point values are based on an * implementation by Paul Mackerras. The -variable option is due to * Henning Schulzrinne. All of these are used with permission. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScale.h" |
︙ | ︙ | |||
30 31 32 33 34 35 36 | * used together with the "enum orient" declaration in tkScale.h. */ static const char *const orientStrings[] = { "horizontal", "vertical", NULL }; | < < < < < < < < < | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | * used together with the "enum orient" declaration in tkScale.h. */ static const char *const orientStrings[] = { "horizontal", "vertical", NULL }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_SCALE_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, activeBorder), 0, DEF_SCALE_ACTIVE_BG_MONO, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_SCALE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, bgBorder), 0, DEF_SCALE_BG_MONO, 0}, |
︙ | ︙ | |||
71 72 73 74 75 76 77 | 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_SCALE_FONT, TCL_INDEX_NONE, offsetof(TkScale, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_SCALE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, textColorPtr), 0, | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_SCALE_FONT, TCL_INDEX_NONE, offsetof(TkScale, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_SCALE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, textColorPtr), 0, DEF_SCALE_FG_MONO, 0}, {TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SCALE_FROM, TCL_INDEX_NONE, offsetof(TkScale, fromValue), 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_SCALE_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, highlightBorder), 0, DEF_SCALE_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_SCALE_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkScale, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, offsetof(TkScale, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-label", "label", "Label", DEF_SCALE_LABEL, TCL_INDEX_NONE, offsetof(TkScale, label), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_SCALE_LENGTH, TCL_INDEX_NONE, offsetof(TkScale, length), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", DEF_SCALE_ORIENT, TCL_INDEX_NONE, offsetof(TkScale, orient), TK_OPTION_ENUM_VAR, orientStrings, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_SCALE_RELIEF, TCL_INDEX_NONE, offsetof(TkScale, relief), 0, 0, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", DEF_SCALE_REPEAT_DELAY, TCL_INDEX_NONE, offsetof(TkScale, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", DEF_SCALE_REPEAT_INTERVAL, TCL_INDEX_NONE, offsetof(TkScale, repeatInterval), |
︙ | ︙ | |||
114 115 116 117 118 119 120 | DEF_SCALE_SLIDER_LENGTH, TCL_INDEX_NONE, offsetof(TkScale, sliderLength), 0, 0, 0}, {TK_OPTION_RELIEF, "-sliderrelief", "sliderRelief", "SliderRelief", DEF_SCALE_SLIDER_RELIEF, TCL_INDEX_NONE, offsetof(TkScale, sliderRelief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_SCALE_STATE, TCL_INDEX_NONE, offsetof(TkScale, state), | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | DEF_SCALE_SLIDER_LENGTH, TCL_INDEX_NONE, offsetof(TkScale, sliderLength), 0, 0, 0}, {TK_OPTION_RELIEF, "-sliderrelief", "sliderRelief", "SliderRelief", DEF_SCALE_SLIDER_RELIEF, TCL_INDEX_NONE, offsetof(TkScale, sliderRelief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_SCALE_STATE, TCL_INDEX_NONE, offsetof(TkScale, state), TK_OPTION_ENUM_VAR, tkStateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_SCALE_TAKE_FOCUS, offsetof(TkScale, takeFocusPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-tickinterval", "tickInterval", "TickInterval", DEF_SCALE_TICK_INTERVAL, TCL_INDEX_NONE, offsetof(TkScale, tickInterval), 0, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", |
︙ | ︙ | |||
1355 1356 1357 1358 1359 1360 1361 | /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && scalePtr->varNamePtr) { | | | | 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 | /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && scalePtr->varNamePtr) { void *probe = NULL; do { probe = Tcl_VarTraceInfo(interp, Tcl_GetString(scalePtr->varNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, probe); if (probe == (void *)scalePtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * varNamePtr, which means it is not unset and not |
︙ | ︙ |
Changes to generic/tkScale.h.
1 2 3 4 5 6 | /* * tkScale.h -- * * Declarations of types and functions used to implement the scale * widget. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkScale.h -- * * Declarations of types and functions used to implement the scale * widget. * * Copyright © 1996 Sun Microsystems, Inc. * Copyright © 1999-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKSCALE #define _TKSCALE |
︙ | ︙ |
Changes to generic/tkScrollbar.c.
1 2 3 4 5 6 7 | /* * tkScrollbar.c -- * * This module implements a scrollbar widgets for the Tk toolkit. A * scrollbar displays a slider and two arrows; mouse clicks on features * within the scrollbar cause scrolling commands to be invoked. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkScrollbar.c -- * * This module implements a scrollbar widgets for the Tk toolkit. A * scrollbar displays a slider and two arrows; mouse clicks on features * within the scrollbar cause scrolling commands to be invoked. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScrollbar.h" |
︙ | ︙ | |||
267 268 269 270 271 272 273 | Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); goto done; } if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "activate element"); goto error; } | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); goto done; } if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "activate element"); goto error; } c = Tcl_GetStringFromObj(objv[2], &len)[0]; oldActiveField = scrollPtr->activeField; if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow1") == 0)) { scrollPtr->activeField = TOP_ARROW; } else if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow2") == 0)) { scrollPtr->activeField = BOTTOM_ARROW; } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", len) == 0)) { scrollPtr->activeField = SLIDER; |
︙ | ︙ |
Changes to generic/tkScrollbar.h.
1 2 3 4 5 6 | /* * tkScrollbar.h -- * * Declarations of types and functions used to implement the scrollbar * widget. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkScrollbar.h -- * * Declarations of types and functions used to implement the scrollbar * widget. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKSCROLLBAR #define _TKSCROLLBAR |
︙ | ︙ |
Changes to generic/tkSelect.c.
1 2 3 4 5 6 | /* * tkSelect.c -- * * This file manages the selection for the Tk toolkit, translating * between the standard X ICCCM conventions and Tcl commands. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkSelect.c -- * * This file manages the selection for the Tk toolkit, translating * between the standard X ICCCM conventions and Tcl commands. * * Copyright © 1990-1993 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkSelect.h" |
︙ | ︙ | |||
896 897 898 899 900 901 902 | if (count > 3) { format = Tk_InternAtom(tkwin, Tcl_GetString(objs[3])); } else if (formatName != NULL) { format = Tk_InternAtom(tkwin, formatName); } else { format = XA_STRING; } | | | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | if (count > 3) { format = Tk_InternAtom(tkwin, Tcl_GetString(objs[3])); } else if (formatName != NULL) { format = Tk_InternAtom(tkwin, formatName); } else { format = XA_STRING; } string = Tcl_GetStringFromObj(objs[1], &cmdLength); if (cmdLength == 0) { Tk_DeleteSelHandler(tkwin, selection, target); } else { cmdInfoPtr = (CommandInfo *)ckalloc(offsetof(CommandInfo, command) + 1 + cmdLength); cmdInfoPtr->interp = interp; cmdInfoPtr->charOffset = 0; |
︙ | ︙ | |||
1187 1188 1189 1190 1191 1192 1193 | dispPtr->clipboardAtom = Tk_InternAtom(tkwin, "CLIPBOARD"); dispPtr->atomPairAtom = Tk_InternAtom(tkwin, "ATOM_PAIR"); /* * Using UTF8_STRING instead of the XA_UTF8_STRING macro allows us to * support older X servers that didn't have UTF8_STRING yet. This is * necessary on Unix systems. For more information, see: | | | 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | dispPtr->clipboardAtom = Tk_InternAtom(tkwin, "CLIPBOARD"); dispPtr->atomPairAtom = Tk_InternAtom(tkwin, "ATOM_PAIR"); /* * Using UTF8_STRING instead of the XA_UTF8_STRING macro allows us to * support older X servers that didn't have UTF8_STRING yet. This is * necessary on Unix systems. For more information, see: * https://www.cl.cam.ac.uk/~mgk25/unicode.html#x11 */ #if !defined(_WIN32) dispPtr->utf8Atom = Tk_InternAtom(tkwin, "UTF8_STRING"); #else dispPtr->utf8Atom = (Atom) 0; #endif |
︙ | ︙ | |||
1395 1396 1397 1398 1399 1400 1401 | */ if (cmdInfoPtr->interp != NULL) { if (length <= (int)maxBytes) { cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, -1); cmdInfoPtr->buffer[0] = '\0'; } else { | | | | 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 | */ if (cmdInfoPtr->interp != NULL) { if (length <= (int)maxBytes) { cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, -1); cmdInfoPtr->buffer[0] = '\0'; } else { Tcl_UniChar ch = 0; p = string; string += count; numChars = 0; while (p < string) { p += Tcl_UtfToUniChar(p, &ch); numChars++; } cmdInfoPtr->charOffset += numChars; length = p - string; if (length > 0) { strncpy(cmdInfoPtr->buffer, string, length); } |
︙ | ︙ |
Changes to generic/tkSelect.h.
1 2 3 4 5 6 | /* * tkSelect.h -- * * Declarations of types shared among the files that implement selection * support. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkSelect.h -- * * Declarations of types shared among the files that implement selection * support. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKSELECT #define _TKSELECT |
︙ | ︙ |
Changes to generic/tkSquare.c.
1 2 3 4 5 6 7 8 9 | /* * tkSquare.c -- * * This module implements "square" widgets that are object based. A * "square" is a widget that displays a single square that can be moved * around and resized. This file is intended as an example of how to * build a widget; it isn't included in the normal wish, but it is * included in "tktest". * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkSquare.c -- * * This module implements "square" widgets that are object based. A * "square" is a widget that displays a single square that can be moved * around and resized. This file is intended as an example of how to * build a widget; it isn't included in the normal wish, but it is * included in "tktest". * * Copyright © 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #if 0 #define __NO_OLD_CONFIG |
︙ | ︙ |
Changes to generic/tkStubInit.c.
1 2 3 4 5 | /* * tkStubInit.c -- * * This file contains the initializers for the Tk stub vectors. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkStubInit.c -- * * This file contains the initializers for the Tk stub vectors. * * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "tkWinInt.h" #endif #if defined(MAC_OSX_TK) /* we could have used _TKMACINT */ #include "tkMacOSXInt.h" #include "tkMacOSXPrivate.h" #endif /* TODO: These ought to come in some other way */ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" MODULE_SCOPE const TkStubs tkStubs; | > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include "tkWinInt.h" #endif #if defined(MAC_OSX_TK) /* we could have used _TKMACINT */ #include "tkMacOSXInt.h" #include "tkMacOSXPrivate.h" #else # define Tk_ClipDrawableToRect 0 #endif /* TODO: These ought to come in some other way */ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" MODULE_SCOPE const TkStubs tkStubs; |
︙ | ︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | return 2; } #else # define Tk_TranslateWinEvent 0 # define Tk_PointerEvent 0 # define TkWinGetPlatformId 0 #endif static int doNothing(void) { /* dummy implementation, no need to do anything */ return 0; } | > > > > > > > > > > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | return 2; } #else # define Tk_TranslateWinEvent 0 # define Tk_PointerEvent 0 # define TkWinGetPlatformId 0 #endif #if defined(TK_NO_DEPRECATED) || (TCL_MAJOR_VERSION > 8) # define TkSetWindowMenuBar 0 # define TkpDrawHighlightBorder 0 # define TkpUseWindow 0 # define TkpSetMainMenubar 0 # define TkpGetOtherWindow 0 # define TkpGetSystemDefault 0 # define TkpMakeContainer 0 # define TkpMakeWindow 0 #endif static int doNothing(void) { /* dummy implementation, no need to do anything */ return 0; } |
︙ | ︙ | |||
103 104 105 106 107 108 109 | #define Tk_CanvasTagsParseProc \ (int (*) (void *, Tcl_Interp *,Tk_Window, const char *, char *, \ int offset))(void *)TkCanvasTagsParseProc #define Tk_CanvasTagsPrintProc \ (const char *(*) (void *,Tk_Window, char *, int, \ Tcl_FreeProc **))(void *)TkCanvasTagsPrintProc | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | #define Tk_CanvasTagsParseProc \ (int (*) (void *, Tcl_Interp *,Tk_Window, const char *, char *, \ int offset))(void *)TkCanvasTagsParseProc #define Tk_CanvasTagsPrintProc \ (const char *(*) (void *,Tk_Window, char *, int, \ Tcl_FreeProc **))(void *)TkCanvasTagsPrintProc #if !defined(MAC_OSX_TK) # undef TkpWillDrawWidget # undef TkpRedrawWidget # define TkpWillDrawWidget ((int (*)(Tk_Window))(void *)doNothing) # define TkpRedrawWidget ((void (*)(Tk_Window))(void *)doNothing) #endif #ifdef _WIN32 |
︙ | ︙ | |||
497 498 499 500 501 502 503 | TkOrientPrintProc, /* 178 */ TkSmoothParseProc, /* 179 */ TkSmoothPrintProc, /* 180 */ TkDrawAngledTextLayout, /* 181 */ TkUnderlineAngledTextLayout, /* 182 */ TkIntersectAngledTextLayout, /* 183 */ TkDrawAngledChars, /* 184 */ | < < < < < < < < < < < < < < < < | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | TkOrientPrintProc, /* 178 */ TkSmoothParseProc, /* 179 */ TkSmoothPrintProc, /* 180 */ TkDrawAngledTextLayout, /* 181 */ TkUnderlineAngledTextLayout, /* 182 */ TkIntersectAngledTextLayout, /* 183 */ TkDrawAngledChars, /* 184 */ TkpRedrawWidget, /* 185 */ TkpWillDrawWidget, /* 186 */ TkDebugPhotoStringMatchDef, /* 187 */ }; static const TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, 0, #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ |
︙ | ︙ | |||
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 | Tk_CreateOldPhotoImageFormat, /* 273 */ Tk_AlwaysShowSelection, /* 274 */ Tk_GetButtonMask, /* 275 */ Tk_GetDoublePixelsFromObj, /* 276 */ Tk_NewWindowObj, /* 277 */ Tk_SendVirtualEvent, /* 278 */ Tk_FontGetDescription, /* 279 */ }; /* !END!: Do not edit above this line. */ #ifdef __CYGWIN__ void *Tk_GetHINSTANCE(void) | > > > > > > > > > > > | 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 | Tk_CreateOldPhotoImageFormat, /* 273 */ Tk_AlwaysShowSelection, /* 274 */ Tk_GetButtonMask, /* 275 */ Tk_GetDoublePixelsFromObj, /* 276 */ Tk_NewWindowObj, /* 277 */ Tk_SendVirtualEvent, /* 278 */ Tk_FontGetDescription, /* 279 */ Tk_CreatePhotoImageFormatVersion3, /* 280 */ Tk_DrawHighlightBorder, /* 281 */ Tk_SetMainMenubar, /* 282 */ Tk_SetWindowMenubar, /* 283 */ Tk_ClipDrawableToRect, /* 284 */ Tk_GetSystemDefault, /* 285 */ Tk_UseWindow, /* 286 */ Tk_MakeContainer, /* 287 */ Tk_GetOtherWindow, /* 288 */ Tk_Get3DBorderColors, /* 289 */ Tk_MakeWindow, /* 290 */ }; /* !END!: Do not edit above this line. */ #ifdef __CYGWIN__ void *Tk_GetHINSTANCE(void) |
︙ | ︙ |
Changes to generic/tkStubLib.c.
1 2 3 4 5 6 | /* * tkStubLib.c -- * * Stub object that will be statically linked into extensions that want * to access Tk. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkStubLib.c -- * * Stub object that will be statically linked into extensions that want * to access Tk. * * Copyright © 1998-1999 Scriptics Corporation. * Copyright © 1998 Paul Duffin. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
71 72 73 74 75 76 77 | #undef Tk_InitStubs MODULE_SCOPE const char * Tk_InitStubs( Tcl_Interp *interp, const char *version, int exact) { | | < > > > > | > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #undef Tk_InitStubs MODULE_SCOPE const char * Tk_InitStubs( Tcl_Interp *interp, const char *version, int exact) { const char *packageName = "tk"; const char *errMsg = NULL; void *clientData = NULL; const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, 0, &clientData); if (actualVersion == NULL) { packageName = "Tk"; actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, 0, &clientData); if (actualVersion == NULL) { return NULL; } } if (exact) { const char *p = version; int count = 0; while (*p) { |
︙ | ︙ | |||
109 110 111 112 113 114 115 | actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, 1, NULL); if (actualVersion == NULL) { return NULL; } } } | | | | | | | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, 1, NULL); if (actualVersion == NULL) { return NULL; } } } if (clientData == NULL) { errMsg = "missing stub table pointer"; } else { tkStubsPtr = (const TkStubs *)clientData; if (tkStubsPtr->hooks) { tkPlatStubsPtr = tkStubsPtr->hooks->tkPlatStubs; tkIntStubsPtr = tkStubsPtr->hooks->tkIntStubs; tkIntPlatStubsPtr = tkStubsPtr->hooks->tkIntPlatStubs; tkIntXlibStubsPtr = tkStubsPtr->hooks->tkIntXlibStubs; } else { tkPlatStubsPtr = NULL; tkIntStubsPtr = NULL; tkIntPlatStubsPtr = NULL; tkIntXlibStubsPtr = NULL; } return actualVersion; |
︙ | ︙ |
Changes to generic/tkStyle.c.
1 2 3 4 5 | /* * tkStyle.c -- * * This file implements the widget styles and themes support. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkStyle.c -- * * This file implements the widget styles and themes support. * * Copyright © 1990-1993 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to generic/tkTest.c.
1 2 3 4 5 6 7 8 | /* * tkTest.c -- * * This file contains C command functions for a bunch of additional Tcl * commands that are used for testing out Tcl's C interfaces. These * commands are not normally included in Tcl applications; they're only * used for testing. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tkTest.c -- * * This file contains C command functions for a bunch of additional Tcl * commands that are used for testing out Tcl's C interfaces. These * commands are not normally included in Tcl applications; they're only * used for testing. * * Copyright © 1993-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #undef STATIC_BUILD #ifndef USE_TCL_STUBS |
︙ | ︙ | |||
83 84 85 86 87 88 89 | } TImageInstance; /* * The type record for test images: */ static int ImageCreate(Tcl_Interp *interp, | | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | } TImageInstance; /* * The type record for test images: */ static int ImageCreate(Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImageGet(Tk_Window tkwin, ClientData clientData); static void ImageDisplay(ClientData clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, |
︙ | ︙ | |||
243 244 245 246 247 248 249 | return TCL_ERROR; } /* * Create additional commands for testing Tk. */ | | | | | | | | | | | | | | | | | | | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | return TCL_ERROR; } /* * Create additional commands for testing Tk. */ if (Tcl_PkgProvideEx(interp, "tk::test", TK_PATCH_LEVEL, NULL) == TCL_ERROR) { return TCL_ERROR; } Tcl_CreateObjCommand(interp, "square", SquareObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testbitmap", TestbitmapObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testborder", TestborderObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testcolor", TestcolorObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testcursor", TestcursorObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testdeleteapps", TestdeleteappsObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testembed", TkpTestembedCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testobjconfig", TestobjconfigObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testfont", TestfontObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testmakeexist", TestmakeexistObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testprop", TestpropObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testprintf", TestprintfObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testtext", TkpTesttextCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testphotostringmatch", TestPhotoStringMatchCmd, Tk_MainWindow(interp), NULL); #if defined(_WIN32) Tcl_CreateObjCommand(interp, "testmetrics", TestmetricsObjCmd, Tk_MainWindow(interp), NULL); #elif !defined(__CYGWIN__) && !defined(MAC_OSX_TK) Tcl_CreateObjCommand(interp, "testmenubar", TestmenubarObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testsend", TkpTestsendCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testwrapper", TestwrapperObjCmd, Tk_MainWindow(interp), NULL); #endif /* _WIN32 */ /* * Create test image type. */ if (!initialized) { |
︙ | ︙ | |||
363 364 365 366 367 368 369 | * None. * *---------------------------------------------------------------------- */ static int TestborderObjCmd( | | | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | * None. * *---------------------------------------------------------------------- */ static int TestborderObjCmd( TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "border"); return TCL_ERROR; |
︙ | ︙ | |||
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | typedef struct { TrivialCommandHeader header; Tcl_Obj *booleanPtr; Tcl_Obj *integerPtr; Tcl_Obj *doublePtr; Tcl_Obj *stringPtr; Tcl_Obj *stringTablePtr; Tcl_Obj *colorPtr; Tcl_Obj *fontPtr; Tcl_Obj *bitmapPtr; Tcl_Obj *borderPtr; Tcl_Obj *reliefPtr; Tcl_Obj *cursorPtr; Tcl_Obj *activeCursorPtr; Tcl_Obj *justifyPtr; Tcl_Obj *anchorPtr; Tcl_Obj *pixelPtr; Tcl_Obj *mmPtr; Tcl_Obj *customPtr; } TypesRecord; TypesRecord *recordPtr; static const char *const stringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec typesSpecs[] = { | > > > > | | > > > > | | | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | typedef struct { TrivialCommandHeader header; Tcl_Obj *booleanPtr; Tcl_Obj *integerPtr; Tcl_Obj *doublePtr; Tcl_Obj *stringPtr; Tcl_Obj *stringTablePtr; Tcl_Obj *stringTablePtr2; Tcl_Obj *colorPtr; Tcl_Obj *fontPtr; Tcl_Obj *bitmapPtr; Tcl_Obj *borderPtr; Tcl_Obj *reliefPtr; Tcl_Obj *cursorPtr; Tcl_Obj *activeCursorPtr; Tcl_Obj *justifyPtr; Tcl_Obj *anchorPtr; Tcl_Obj *pixelPtr; Tcl_Obj *mmPtr; Tcl_Obj *customPtr; } TypesRecord; TypesRecord *recordPtr; static const char *const stringTable[] = { "one", "two", "three", "four", NULL }; static const char *const stringTable2[] = { "one", "two", NULL }; static const Tk_OptionSpec typesSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", NULL, offsetof(TypesRecord, booleanPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "7", offsetof(TypesRecord, integerPtr), TCL_INDEX_NONE, 0, 0, 0x2}, {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159", offsetof(TypesRecord, doublePtr), TCL_INDEX_NONE, 0, 0, 0x4}, {TK_OPTION_STRING, "-string", "string", "String", "foo", offsetof(TypesRecord, stringPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x8}, {TK_OPTION_STRING_TABLE, "-stringtable", "StringTable", "stringTable", "one", offsetof(TypesRecord, stringTablePtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, stringTable, 0x10}, {TK_OPTION_STRING_TABLE, "-stringtable2", "StringTable2", "stringTable2", "two", offsetof(TypesRecord, stringTablePtr2), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, stringTable2, 0x10}, {TK_OPTION_COLOR, "-color", "color", "Color", "red", offsetof(TypesRecord, colorPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, "black", 0x20}, {TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12", offsetof(TypesRecord, fontPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x40}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50", offsetof(TypesRecord, bitmapPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x80}, {TK_OPTION_BORDER, "-border", "border", "Border", "blue", offsetof(TypesRecord, borderPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, "white", 0x100}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, offsetof(TypesRecord, reliefPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x200}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm", offsetof(TypesRecord, cursorPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x400}, {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left", offsetof(TypesRecord, justifyPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x800}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", offsetof(TypesRecord, anchorPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x1000}, {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1", offsetof(TypesRecord, pixelPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, 0, 0x2000}, {TK_OPTION_CUSTOM, "-custom", NULL, NULL, "", offsetof(TypesRecord, customPtr), TCL_INDEX_NONE, |
︙ | ︙ | |||
664 665 666 667 668 669 670 671 672 673 674 675 676 | recordPtr->reliefPtr = NULL; recordPtr->cursorPtr = NULL; recordPtr->justifyPtr = NULL; recordPtr->anchorPtr = NULL; recordPtr->pixelPtr = NULL; recordPtr->mmPtr = NULL; recordPtr->stringTablePtr = NULL; recordPtr->customPtr = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, | > | | | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | recordPtr->reliefPtr = NULL; recordPtr->cursorPtr = NULL; recordPtr->justifyPtr = NULL; recordPtr->anchorPtr = NULL; recordPtr->pixelPtr = NULL; recordPtr->mmPtr = NULL; recordPtr->stringTablePtr = NULL; recordPtr->stringTablePtr2 = NULL; recordPtr->customPtr = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, recordPtr); result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); if (result != TCL_OK) { Tk_DestroyWindow(tkwin); } } else { Tk_DestroyWindow(tkwin); |
︙ | ︙ | |||
718 719 720 721 722 723 724 | if (result != TCL_OK) { Tk_FreeConfigOptions(recordPtr, optionTable, tkwin); } } if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, | | | | | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | if (result != TCL_OK) { Tk_FreeConfigOptions(recordPtr, optionTable, tkwin); } } if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, recordPtr); Tcl_SetObjResult(interp, objv[2]); } break; } case CHAIN2: case CHAIN3: { ExtensionWidgetRecord *recordPtr; static const Tk_OptionSpec extensionSpecs[] = { {TK_OPTION_STRING, "-three", "three", "Three", "three", offsetof(ExtensionWidgetRecord, extension3ObjPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_STRING, "-four", "four", "Four", "four", offsetof(ExtensionWidgetRecord, extension4ObjPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_STRING, "-two", "two", "Two", "two and a half", offsetof(ExtensionWidgetRecord, base2ObjPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_STRING, "-oneAgain", "oneAgain", "OneAgain", "one again", offsetof(ExtensionWidgetRecord, extension5ObjPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, baseSpecs, 0} }; Tk_OptionTable optionTable; tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; |
︙ | ︙ | |||
771 772 773 774 775 776 777 | if (result != TCL_OK) { Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin); } } if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, | | | | | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | if (result != TCL_OK) { Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin); } } if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, recordPtr); Tcl_SetObjResult(interp, objv[2]); } break; } case CONFIG_ERROR: { typedef struct { Tcl_Obj *intPtr; } ErrorWidgetRecord; ErrorWidgetRecord widgetRecord; static const Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-int", "integer", "Integer", "bogus", offsetof(ErrorWidgetRecord, intPtr), 0, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; widgetRecord.intPtr = NULL; optionTable = Tk_CreateOptionTable(interp, errorSpecs); tables[index] = optionTable; |
︙ | ︙ | |||
860 861 862 863 864 865 866 | } InternalRecord; InternalRecord *recordPtr; static const char *const internalStringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec internalSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", | | | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | } InternalRecord; InternalRecord *recordPtr; static const char *const internalStringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec internalSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", TCL_INDEX_NONE, offsetof(InternalRecord, boolean), TK_CONFIG_NULL_OK, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "148962237", TCL_INDEX_NONE, offsetof(InternalRecord, integer), 0, 0, 0x2}, {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159", TCL_INDEX_NONE, offsetof(InternalRecord, doubleValue), 0, 0, 0x4}, {TK_OPTION_STRING, "-string", "string", "String", "foo", TCL_INDEX_NONE, offsetof(InternalRecord, string), TK_CONFIG_NULL_OK, 0, 0x8}, |
︙ | ︙ | |||
884 885 886 887 888 889 890 | TK_CONFIG_NULL_OK, 0, 0x40}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50", TCL_INDEX_NONE, offsetof(InternalRecord, bitmap), TK_CONFIG_NULL_OK, 0, 0x80}, {TK_OPTION_BORDER, "-border", "border", "Border", "blue", TCL_INDEX_NONE, offsetof(InternalRecord, border), TK_CONFIG_NULL_OK, "white", 0x100}, | | | | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | TK_CONFIG_NULL_OK, 0, 0x40}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50", TCL_INDEX_NONE, offsetof(InternalRecord, bitmap), TK_CONFIG_NULL_OK, 0, 0x80}, {TK_OPTION_BORDER, "-border", "border", "Border", "blue", TCL_INDEX_NONE, offsetof(InternalRecord, border), TK_CONFIG_NULL_OK, "white", 0x100}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, TCL_INDEX_NONE, offsetof(InternalRecord, relief), TK_CONFIG_NULL_OK, 0, 0x200}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm", TCL_INDEX_NONE, offsetof(InternalRecord, cursor), TK_CONFIG_NULL_OK, 0, 0x400}, {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left", TCL_INDEX_NONE, offsetof(InternalRecord, justify), TK_CONFIG_NULL_OK, 0, 0x800}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", TCL_INDEX_NONE, offsetof(InternalRecord, anchor), TK_CONFIG_NULL_OK, 0, 0x1000}, {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1", TCL_INDEX_NONE, offsetof(InternalRecord, pixels), TK_CONFIG_NULL_OK, 0, 0x2000}, {TK_OPTION_WINDOW, "-window", "window", "Window", NULL, TCL_INDEX_NONE, offsetof(InternalRecord, tkwin), |
︙ | ︙ | |||
936 937 938 939 940 941 942 | recordPtr->colorPtr = NULL; recordPtr->tkfont = NULL; recordPtr->bitmap = None; recordPtr->border = NULL; recordPtr->relief = TK_RELIEF_FLAT; recordPtr->cursor = NULL; recordPtr->justify = TK_JUSTIFY_LEFT; | | | 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | recordPtr->colorPtr = NULL; recordPtr->tkfont = NULL; recordPtr->bitmap = None; recordPtr->border = NULL; recordPtr->relief = TK_RELIEF_FLAT; recordPtr->cursor = NULL; recordPtr->justify = TK_JUSTIFY_LEFT; recordPtr->anchor = TK_ANCHOR_CENTER; recordPtr->pixels = 0; recordPtr->mm = 0.0; recordPtr->tkwin = NULL; recordPtr->custom = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { |
︙ | ︙ | |||
1011 1012 1013 1014 1015 1016 1017 | if (result == TCL_OK) { result = Tk_SetOptions(interp, recordPtr, recordPtr->header.optionTable, objc - 3, objv + 3, (Tk_Window) NULL, NULL, NULL); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, | | | 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | if (result == TCL_OK) { result = Tk_SetOptions(interp, recordPtr, recordPtr->header.optionTable, objc - 3, objv + 3, (Tk_Window) NULL, NULL, NULL); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, recordPtr, TrivialCmdDeletedProc); } else { Tk_FreeConfigOptions(recordPtr, recordPtr->header.optionTable, (Tk_Window) NULL); } } if (result != TCL_OK) { ckfree(recordPtr); |
︙ | ︙ | |||
1929 1930 1931 1932 1933 1934 1935 | ClientData dummy, /* Not used */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { char buffer[256]; Tcl_WideInt wideInt; | < < < < | | 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 | ClientData dummy, /* Not used */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { char buffer[256]; Tcl_WideInt wideInt; long long longLongInt; (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "wideint"); return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[1], &wideInt) != TCL_OK) { return TCL_ERROR; } longLongInt = wideInt; /* Just add a lot of arguments to sprintf. Reason: on AMD64, the first * 4 or 6 arguments (we assume 8, just in case) might be put in registers, * which still woudn't tell if the assumed size is correct: We want this * test-case to fail if the 64-bit value is printed as truncated to 32-bit. */ sprintf(buffer, "%s%s%s%s%s%s%s%s%" TCL_LL_MODIFIER "d %" TCL_LL_MODIFIER "u", "", "", "", "", "", "", "", "", longLongInt, (unsigned long long)longLongInt); Tcl_AppendResult(interp, buffer, NULL); return TCL_OK; } #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) /* *---------------------------------------------------------------------- |
︙ | ︙ |
Changes to generic/tkText.c.
1 2 3 4 5 6 7 8 | /* * tkText.c -- * * This module provides a big chunk of the implementation of multi-line * editable text widgets for Tk. Among other things, it provides the Tcl * command interfaces to text widgets. The B-tree representation of text * and its actual display are implemented elsewhere. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tkText.c -- * * This module provides a big chunk of the implementation of multi-line * editable text widgets for Tk. Among other things, it provides the Tcl * command interfaces to text widgets. The B-tree representation of text * and its actual display are implemented elsewhere. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1996 Sun Microsystems, Inc. * Copyright © 1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkUndo.h" |
︙ | ︙ | |||
38 39 40 41 42 43 44 | /* * Used to avoid having to allocate and deallocate arrays on the fly for * commonly used functions. Must be > 0. */ #define PIXEL_CLIENTS 5 | < < < < < < < < < < | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /* * Used to avoid having to allocate and deallocate arrays on the fly for * commonly used functions. Must be > 0. */ #define PIXEL_CLIENTS 5 /* * The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap * option of the Text widget. These values are used as indices into the string * table below. */ const char *const tkTextWrapStrings[] = { "char", "none", "word", NULL }; /* * The 'TkTextTabStyle' enum in tkText.h is used to define a type for the * -tabstyle option of the Text widget. These values are used as indices into * the string table below. */ const char *const tkTextTabStyleStrings[] = { "tabular", "wordprocessor", NULL }; /* * The 'TkTextInsertUnfocussed' enum in tkText.h is used to define a type for * the -insertunfocussed option of the Text widget. These values are used as * indice into the string table below. |
︙ | ︙ | |||
175 176 177 178 179 180 181 | {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_TEXT_INSERT_BG, TCL_INDEX_NONE, offsetof(TkText, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, TCL_INDEX_NONE, offsetof(TkText, insertBorderWidth), 0, | | | | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_TEXT_INSERT_BG, TCL_INDEX_NONE, offsetof(TkText, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, TCL_INDEX_NONE, offsetof(TkText, insertBorderWidth), 0, DEF_TEXT_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_TEXT_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(TkText, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", DEF_TEXT_INSERT_ON_TIME, TCL_INDEX_NONE, offsetof(TkText, insertOnTime), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-insertunfocussed", "insertUnfocussed", "InsertUnfocussed", DEF_TEXT_INSERT_UNFOCUSSED, TCL_INDEX_NONE, offsetof(TkText, insertUnfocussed), TK_OPTION_ENUM_VAR, insertUnfocussedStrings, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_TEXT_INSERT_WIDTH, TCL_INDEX_NONE, offsetof(TkText, insertWidth), 0, 0, 0}, {TK_OPTION_INT, "-maxundo", "maxUndo", "MaxUndo", DEF_TEXT_MAX_UNDO, TCL_INDEX_NONE, offsetof(TkText, maxUndo), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", |
︙ | ︙ | |||
226 227 228 229 230 231 232 | DEF_TEXT_SPACING3, TCL_INDEX_NONE, offsetof(TkText, spacing3), 0, 0 , TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_CUSTOM, "-startline", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkText, start), TK_OPTION_NULL_OK, &lineOption, TK_TEXT_LINE_RANGE}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_TEXT_STATE, TCL_INDEX_NONE, offsetof(TkText, state), | | | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | DEF_TEXT_SPACING3, TCL_INDEX_NONE, offsetof(TkText, spacing3), 0, 0 , TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_CUSTOM, "-startline", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkText, start), TK_OPTION_NULL_OK, &lineOption, TK_TEXT_LINE_RANGE}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_TEXT_STATE, TCL_INDEX_NONE, offsetof(TkText, state), 0, &tkStateStrings[1], 0}, {TK_OPTION_STRING, "-tabs", "tabs", "Tabs", DEF_TEXT_TABS, offsetof(TkText, tabOptionPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING_TABLE, "-tabstyle", "tabStyle", "TabStyle", DEF_TEXT_TABSTYLE, TCL_INDEX_NONE, offsetof(TkText, tabStyle), 0, tkTextTabStyleStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_TEXT_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(TkText, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-undo", "undo", "Undo", DEF_TEXT_UNDO, TCL_INDEX_NONE, offsetof(TkText, undo), TK_OPTION_DONT_SET_DEFAULT, 0 , 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_TEXT_WIDTH, TCL_INDEX_NONE, offsetof(TkText, width), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING_TABLE, "-wrap", "wrap", "Wrap", DEF_TEXT_WRAP, TCL_INDEX_NONE, offsetof(TkText, wrapMode), TK_OPTION_ENUM_VAR, tkTextWrapStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", DEF_TEXT_XSCROLL_COMMAND, TCL_INDEX_NONE, offsetof(TkText, xScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", DEF_TEXT_YSCROLL_COMMAND, TCL_INDEX_NONE, offsetof(TkText, yScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0} |
︙ | ︙ | |||
861 862 863 864 865 866 867 | result = TCL_ERROR; goto done; } for (i = 2; i < objc-2; i++) { int value; TkSizeT length; | | | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | result = TCL_ERROR; goto done; } for (i = 2; i < objc-2; i++) { int value; TkSizeT length; const char *option = Tcl_GetStringFromObj(objv[i], &length); char c; if (length < 2 || option[0] != '-') { goto badOption; } c = option[1]; if (c == 'c' && !strncmp("-chars", option, length)) { |
︙ | ︙ | |||
1271 1272 1273 1274 1275 1276 1277 | /* * Simple, restrictive argument parsing. The only options are -- and * -displaychars (or any unique prefix). */ i = 2; if (objc > 3) { | | | | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | /* * Simple, restrictive argument parsing. The only options are -- and * -displaychars (or any unique prefix). */ i = 2; if (objc > 3) { name = Tcl_GetStringFromObj(objv[i], &length); if (length > 1 && name[0] == '-') { if (strncmp("-displaychars", name, length) == 0) { i++; visible = 1; name = Tcl_GetStringFromObj(objv[i], &length); } if ((i < objc-1) && (length == 2) && !strcmp("--", name)) { i++; } } } |
︙ | ︙ | |||
1539 1540 1541 1542 1543 1544 1545 | if (TkTextPendingsync(textPtr)) { if (textPtr->afterSyncCmd) { Tcl_DecrRefCount(textPtr->afterSyncCmd); } textPtr->afterSyncCmd = cmd; } else { textPtr->afterSyncCmd = cmd; | | | 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 | if (TkTextPendingsync(textPtr)) { if (textPtr->afterSyncCmd) { Tcl_DecrRefCount(textPtr->afterSyncCmd); } textPtr->afterSyncCmd = cmd; } else { textPtr->afterSyncCmd = cmd; Tcl_DoWhenIdle(TkTextRunAfterSyncCmd, textPtr); } break; } else if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, "?-command command?"); result = TCL_ERROR; goto done; } |
︙ | ︙ | |||
2269 2270 2271 2272 2273 2274 2275 | if (textPtr->selTagPtr->selFgColor == NULL) { textPtr->selTagPtr->fgColor = textPtr->selFgColorPtr; } else { textPtr->selTagPtr->selFgColor = textPtr->selFgColorPtr; } textPtr->selTagPtr->affectsDisplay = 0; textPtr->selTagPtr->affectsDisplayGeometry = 0; | | > > | > > | | | 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 | if (textPtr->selTagPtr->selFgColor == NULL) { textPtr->selTagPtr->fgColor = textPtr->selFgColorPtr; } else { textPtr->selTagPtr->selFgColor = textPtr->selFgColorPtr; } textPtr->selTagPtr->affectsDisplay = 0; textPtr->selTagPtr->affectsDisplayGeometry = 0; if ((textPtr->selTagPtr->elide >= 0) || (textPtr->selTagPtr->tkfont != NULL) || (textPtr->selTagPtr->justifyString != NULL) || (textPtr->selTagPtr->lMargin1String != NULL) || (textPtr->selTagPtr->lMargin2String != NULL) || (textPtr->selTagPtr->offsetString != NULL) || (textPtr->selTagPtr->rMarginString != NULL) || (textPtr->selTagPtr->spacing1String != NULL) || (textPtr->selTagPtr->spacing2String != NULL) || (textPtr->selTagPtr->spacing3String != NULL) || (textPtr->selTagPtr->tabStringPtr != NULL) || (textPtr->selTagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) || (textPtr->selTagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR) || (textPtr->selTagPtr->wrapMode == TEXT_WRAPMODE_CHAR) || (textPtr->selTagPtr->wrapMode == TEXT_WRAPMODE_NONE) || (textPtr->selTagPtr->wrapMode == TEXT_WRAPMODE_WORD)) { textPtr->selTagPtr->affectsDisplay = 1; textPtr->selTagPtr->affectsDisplayGeometry = 1; } if ((textPtr->selTagPtr->border != NULL) || (textPtr->selTagPtr->selBorder != NULL) || (textPtr->selTagPtr->reliefString != NULL) || (textPtr->selTagPtr->bgStipple != None) || (textPtr->selTagPtr->fgColor != NULL) || (textPtr->selTagPtr->selFgColor != NULL) || (textPtr->selTagPtr->fgStipple != None) || (textPtr->selTagPtr->overstrike >= 0) || (textPtr->selTagPtr->overstrikeColor != NULL) || (textPtr->selTagPtr->underline >= 0) || (textPtr->selTagPtr->underlineColor != NULL) || (textPtr->selTagPtr->lMarginColor != NULL) || (textPtr->selTagPtr->rMarginColor != NULL)) { textPtr->selTagPtr->affectsDisplay = 1; } TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, 1); |
︙ | ︙ | |||
2632 2633 2634 2635 2636 2637 2638 | { int lineIndex; TkSizeT length; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; | | | 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 | { int lineIndex; TkSizeT length; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; const char *string = Tcl_GetStringFromObj(stringPtr, &length); if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; } /* * Don't allow insertions on the last (dummy) line of the text. This is |
︙ | ︙ | |||
2958 2959 2960 2961 2962 2963 2964 | Tcl_Interp *interp, /* Current interpreter. */ ClientData clientData, /* Passed from undo code, but contains our * shared text data structure. */ Tcl_Obj *objPtr) /* Arguments of a command to be handled by the * shared text data structure. */ { TkSharedText *sharedPtr = (TkSharedText *)clientData; | | > | 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 | Tcl_Interp *interp, /* Current interpreter. */ ClientData clientData, /* Passed from undo code, but contains our * shared text data structure. */ Tcl_Obj *objPtr) /* Arguments of a command to be handled by the * shared text data structure. */ { TkSharedText *sharedPtr = (TkSharedText *)clientData; int res; TkSizeT objc; Tcl_Obj **objv; TkText *textPtr; res = Tcl_ListObjGetElements(interp, objPtr, &objc, &objv); if (res != TCL_OK) { return res; } |
︙ | ︙ | |||
3123 3124 3125 3126 3127 3128 3129 | TkTextIndex index1, index2; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; Tcl_HashSearch search; Tcl_HashEntry *hPtr; | | | 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 | TkTextIndex index1, index2; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; Tcl_HashSearch search; Tcl_HashEntry *hPtr; TkSizeT i; if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; } /* * Prepare the starting and stopping indices. |
︙ | ︙ | |||
3169 3170 3171 3172 3173 3174 3175 | * deleted but tags might be removed. */ line1 = TkBTreeLinesTo(textPtr, index1.linePtr); line2 = TkBTreeLinesTo(textPtr, index2.linePtr); if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) { TkTextTag **arrayPtr; | | | 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 | * deleted but tags might be removed. */ line1 = TkBTreeLinesTo(textPtr, index1.linePtr); line2 = TkBTreeLinesTo(textPtr, index2.linePtr); if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) { TkTextTag **arrayPtr; TkSizeT arraySize; TkTextIndex oldIndex2; oldIndex2 = index2; TkTextIndexBackChars(NULL, &oldIndex2, 1, &index2, COUNT_INDICES); line2--; if ((index1.byteIndex == 0) && (line1 != 0)) { TkTextIndexBackChars(NULL, &index1, 1, &index1, COUNT_INDICES); |
︙ | ︙ | |||
3342 3343 3344 3345 3346 3347 3348 | */ TkTextMakeByteIndex(sharedTextPtr->tree, textPtr, line, byteIndex, &indexTmp); TkTextSetYView(tPtr, &indexTmp, 0); } } else { | | | > < < < | < < < < < | < | 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 | */ TkTextMakeByteIndex(sharedTextPtr->tree, textPtr, line, byteIndex, &indexTmp); TkTextSetYView(tPtr, &indexTmp, 0); } } else { TkTextMakeByteIndex(sharedTextPtr->tree, NULL, line, byteIndex, &indexTmp); /* * line may be before -startline of tPtr and must be * clamped to -startline before providing it to * TkTextSetYView otherwise lines before -startline * would be displayed. * There is no need to worry about -endline however, * because the view will only be reset if the deletion * involves the TOP line of the screen. That said, * the following call adjusts to both. */ TkTextIndexAdjustToStartEnd(tPtr, &indexTmp, 0); TkTextSetYView(tPtr, &indexTmp, 0); } } resetViewCount += 2; } if (sharedTextPtr->refCount > PIXEL_CLIENTS) { ckfree(lineAndByteIndex); |
︙ | ︙ | |||
3739 3740 3741 3742 3743 3744 3745 | int length = InsertChars(sharedTextPtr, textPtr, &index1, objv[j], viewUpdate); if (objc > (j+1)) { Tcl_Obj **tagNamePtrs; TkTextTag **oldTagArrayPtr; | | | | | 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 | int length = InsertChars(sharedTextPtr, textPtr, &index1, objv[j], viewUpdate); if (objc > (j+1)) { Tcl_Obj **tagNamePtrs; TkTextTag **oldTagArrayPtr; TkSizeT numTags; TkTextIndexForwBytes(textPtr, &index1, length, &index2); oldTagArrayPtr = TkBTreeGetTags(&index1, NULL, &numTags); if (oldTagArrayPtr != NULL) { TkSizeT i; for (i = 0; i < numTags; i++) { TkBTreeTag(&index1, &index2, oldTagArrayPtr[i], 0); } ckfree(oldTagArrayPtr); } if (Tcl_ListObjGetElements(interp, objv[j+1], &numTags, &tagNamePtrs) != TCL_OK) { return TCL_ERROR; } else { TkSizeT i; for (i = 0; i < numTags; i++) { const char *strTag = Tcl_GetString(tagNamePtrs[i]); TkBTreeTag(&index1, &index2, TkTextCreateTag(textPtr, strTag, NULL), 1); } |
︙ | ︙ | |||
3986 3987 3988 3989 3990 3991 3992 | /* *---------------------------------------------------------------------- * * TextSearchGetLineIndex -- * * Extract a row, text offset index position from an objPtr * | | | 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 | /* *---------------------------------------------------------------------- * * TextSearchGetLineIndex -- * * Extract a row, text offset index position from an objPtr * * This means we ignore any embedded windows/images and elided text * (unless we are searching that). * * Results: * Standard Tcl error code (with a message in the interpreter on error * conditions). * * The offset placed in offsetPosPtr is a utf-8 char* byte index for |
︙ | ︙ | |||
4058 4059 4060 4061 4062 4063 4064 | *---------------------------------------------------------------------- * * TextSearchIndexInLine -- * * Find textual index of 'byteIndex' in the searchable characters of * 'linePtr'. * | | | 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 | *---------------------------------------------------------------------- * * TextSearchIndexInLine -- * * Find textual index of 'byteIndex' in the searchable characters of * 'linePtr'. * * This means we ignore any embedded windows/images and elided text * (unless we are searching that). * * Results: * The returned index is a utf-8 char* byte index for exact searches, and * a Unicode character index for regexp searches. * * Side effects: |
︙ | ︙ | |||
4291 4292 4293 4294 4295 4296 4297 | (matchOffset + 1 >= searchSpecPtr->stopOffset + 1)) { return 0; } } /* * Calculate the character count, which may need augmenting if there are | | | 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 | (matchOffset + 1 >= searchSpecPtr->stopOffset + 1)) { return 0; } } /* * Calculate the character count, which may need augmenting if there are * embedded windows or elided text. */ if (searchSpecPtr->exact) { const char *startOfLine = Tcl_GetString(theLine); numChars = Tcl_NumUtfChars(startOfLine + matchOffset, matchLength); } else { |
︙ | ︙ | |||
4501 4502 4503 4504 4505 4506 4507 | TkTextTabArray * TkTextGetTabs( Tcl_Interp *interp, /* Used for error reporting. */ TkText *textPtr, /* Information about the text widget. */ Tcl_Obj *stringPtr) /* Description of the tab stops. See the text * manual entry for details. */ { | | | 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 | TkTextTabArray * TkTextGetTabs( Tcl_Interp *interp, /* Used for error reporting. */ TkText *textPtr, /* Information about the text widget. */ Tcl_Obj *stringPtr) /* Description of the tab stops. See the text * manual entry for details. */ { TkSizeT objc, i, count; Tcl_Obj **objv; TkTextTabArray *tabArrayPtr; TkTextTab *tabPtr; int ch; double prevStop, lastStop; /* * Map these strings to TkTextTabAlign values. |
︙ | ︙ | |||
4755 4756 4757 4758 4759 4760 4761 | } else { TkSizeT length; const char *str; if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) { return TCL_ERROR; } | | | 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 | } else { TkSizeT length; const char *str; if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) { return TCL_ERROR; } str = Tcl_GetStringFromObj(objv[arg], &length); if (strncmp(str, "end", length) == 0) { atEnd = 1; } } if (TkTextIndexCmp(&index1, &index2) >= 0) { return TCL_OK; } |
︙ | ︙ | |||
5609 5610 5611 5612 5613 5614 5615 | if (textPtr->refCount-- <= 1) { ckfree((char *) textPtr); } return; } | | | | 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 | if (textPtr->refCount-- <= 1) { ckfree((char *) textPtr); } return; } Tcl_Preserve(textPtr->interp); code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd, TCL_EVAL_GLOBAL); if (code == TCL_ERROR) { Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)"); Tcl_BackgroundException(textPtr->interp, TCL_ERROR); } Tcl_Release(textPtr->interp); Tcl_DecrRefCount(textPtr->afterSyncCmd); textPtr->afterSyncCmd = NULL; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
5824 5825 5826 5827 5828 5829 5830 | /* * We only need to set the matchLength once for exact searches, and we * do it here. It is also used below as the actual pattern length, so * it has dual purpose. */ | | | 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 | /* * We only need to set the matchLength once for exact searches, and we * do it here. It is also used below as the actual pattern length, so * it has dual purpose. */ pattern = Tcl_GetStringFromObj(patObj, &matchLength); nl = strchr(pattern, '\n'); /* * If there is no newline, or it is the very end of the string, then * we don't need any special treatment, since single-line matching * will work fine. */ |
︙ | ︙ |
Changes to generic/tkText.h.
︙ | ︙ | |||
278 279 280 281 282 283 284 | /* * One data structure of the following type is used for each tag in a text * widget. These structures are kept in sharedTextPtr->tagTable and referred * to in other structures. */ typedef enum { | | | > > | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | /* * One data structure of the following type is used for each tag in a text * widget. These structures are kept in sharedTextPtr->tagTable and referred * to in other structures. */ typedef enum { TEXT_WRAPMODE_NULL = -1, TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD } TkWrapMode; MODULE_SCOPE const char *const tkTextWrapStrings[]; typedef struct TkTextTag { const char *name; /* Name of this tag. This field is actually a * pointer to the key from the entry in * sharedTextPtr->tagTable, so it needn't be * freed explicitly. For 'sel' tags this is * just a static string, so again need not be |
︙ | ︙ | |||
331 332 333 334 335 336 337 | * value specified here. */ Pixmap fgStipple; /* Stipple bitmap for text and other * foreground stuff. None means no value * specified here.*/ char *justifyString; /* -justify option string (malloc-ed). NULL * means option not specified. */ Tk_Justify justify; /* How to justify text: TK_JUSTIFY_LEFT, | | | | | < | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | * value specified here. */ Pixmap fgStipple; /* Stipple bitmap for text and other * foreground stuff. None means no value * specified here.*/ char *justifyString; /* -justify option string (malloc-ed). NULL * means option not specified. */ Tk_Justify justify; /* How to justify text: TK_JUSTIFY_LEFT, * TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER, or TK_JUSTIFY_NULL. * Only valid if justifyString is non-NULL. */ char *lMargin1String; /* -lmargin1 option string (malloc-ed). NULL * means option not specified. */ int lMargin1; /* Left margin for first display line of each * text line, in pixels. Only valid if * lMargin1String is non-NULL. */ char *lMargin2String; /* -lmargin2 option string (malloc-ed). NULL * means option not specified. */ int lMargin2; /* Left margin for second and later display * lines of each text line, in pixels. Only * valid if lMargin2String is non-NULL. */ Tk_3DBorder lMarginColor; /* Used for drawing background in left margins. * This is used for both lmargin1 and lmargin2. * NULL means no value specified here. */ char *offsetString; /* -offset option string (malloc-ed). NULL * means option not specified. */ int offset; /* Vertical offset of text's baseline from * baseline of line. Used for superscripts and * subscripts. Only valid if offsetString is * non-NULL. */ Tcl_Obj *overstrikePtr; /* -overstrike option. NULL * means option not specified. */ int overstrike; /* > 0 means draw horizontal line through * middle of text. -1 means not specified. */ XColor *overstrikeColor; /* Color for the overstrike. NULL means same * color as foreground. */ char *rMarginString; /* -rmargin option string (malloc-ed). NULL * means option not specified. */ int rMargin; /* Right margin for text, in pixels. Only * valid if rMarginString is non-NULL. */ Tk_3DBorder rMarginColor; /* Used for drawing background in right margin. |
︙ | ︙ | |||
389 390 391 392 393 394 395 | * text line. Only valid if spacing3String is * non-NULL. */ Tcl_Obj *tabStringPtr; /* -tabs option string. NULL means option not * specified. */ struct TkTextTabArray *tabArrayPtr; /* Info about tabs for tag (malloc-ed) or * NULL. Corresponds to tabString. */ | | | | | | < | | | | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | * text line. Only valid if spacing3String is * non-NULL. */ Tcl_Obj *tabStringPtr; /* -tabs option string. NULL means option not * specified. */ struct TkTextTabArray *tabArrayPtr; /* Info about tabs for tag (malloc-ed) or * NULL. Corresponds to tabString. */ int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR * or TK_TEXT_TABSTYLE_NULL (if not specified). */ Tcl_Obj *underlinePtr; /* -underline option. NULL * means option not specified. */ int underline; /* > 0 means draw underline underneath * text. -1 means not specified. */ XColor *underlineColor; /* Color for the underline. NULL means same * color as foreground. */ TkWrapMode wrapMode; /* How to handle wrap-around for this tag. * Must be TEXT_WRAPMODE_CHAR, * TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD, or * TEXT_WRAPMODE_NULL to use wrapmode for * whole widget. */ Tcl_Obj *elidePtr; /* -elide option. NULL * means option not specified. */ int elide; /* > 0 means that data under this tag * should not be displayed. -1 means not specified. */ int affectsDisplay; /* Non-zero means that this tag affects the * way information is displayed on the screen * (so need to redisplay if tag changes). */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ int affectsDisplayGeometry; /* Non-zero means that this tag affects the * size with which information is displayed on |
︙ | ︙ | |||
462 463 464 465 466 467 468 | * in sync with the 'tabOptionStrings' array in the function 'TkTextGetTabs' */ typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign; /* * The following are the supported styles of tabbing, used for the -tabstyle | | | | | > > | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | * in sync with the 'tabOptionStrings' array in the function 'TkTextGetTabs' */ typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign; /* * The following are the supported styles of tabbing, used for the -tabstyle * option of the text widget. The first element is only used for tag options. */ typedef enum { TK_TEXT_TABSTYLE_NULL = -1, TK_TEXT_TABSTYLE_TABULAR, TK_TEXT_TABSTYLE_WORDPROCESSOR } TkTextTabStyle; MODULE_SCOPE const char *const tkTextTabStyleStrings[]; typedef struct TkTextTab { int location; /* Offset in pixels of this tab stop from the * left margin (lmargin2) of the text. */ TkTextTabAlign alignment; /* Where the tab stop appears relative to the * text. */ } TkTextTab; |
︙ | ︙ | |||
691 692 693 694 695 696 697 | int spacing3; /* Default extra spacing below last display * line for each text line. */ Tcl_Obj *tabOptionPtr; /* Value of -tabs option string. */ TkTextTabArray *tabArrayPtr; /* Information about tab stops (malloc'ed). * NULL means perform default tabbing * behavior. */ | | | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | int spacing3; /* Default extra spacing below last display * line for each text line. */ Tcl_Obj *tabOptionPtr; /* Value of -tabs option string. */ TkTextTabArray *tabArrayPtr; /* Information about tab stops (malloc'ed). * NULL means perform default tabbing * behavior. */ int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ /* * Additional information used for displaying: */ TkWrapMode wrapMode; /* How to handle wrap-around. Must be * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or |
︙ | ︙ | |||
1020 1021 1022 1023 1024 1025 1026 | MODULE_SCOPE TkSizeT TkBTreeEpoch(TkTextBTree tree); MODULE_SCOPE TkTextLine *TkBTreeFindLine(TkTextBTree tree, const TkText *textPtr, int line); MODULE_SCOPE TkTextLine *TkBTreeFindPixelLine(TkTextBTree tree, const TkText *textPtr, int pixels, int *pixelOffset); MODULE_SCOPE TkTextTag **TkBTreeGetTags(const TkTextIndex *indexPtr, | | | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 | MODULE_SCOPE TkSizeT TkBTreeEpoch(TkTextBTree tree); MODULE_SCOPE TkTextLine *TkBTreeFindLine(TkTextBTree tree, const TkText *textPtr, int line); MODULE_SCOPE TkTextLine *TkBTreeFindPixelLine(TkTextBTree tree, const TkText *textPtr, int pixels, int *pixelOffset); MODULE_SCOPE TkTextTag **TkBTreeGetTags(const TkTextIndex *indexPtr, const TkText *textPtr, TkSizeT *numTagsPtr); MODULE_SCOPE void TkBTreeInsertChars(TkTextBTree tree, TkTextIndex *indexPtr, const char *string); MODULE_SCOPE int TkBTreeLinesTo(const TkText *textPtr, TkTextLine *linePtr); MODULE_SCOPE int TkBTreePixelsTo(const TkText *textPtr, TkTextLine *linePtr); MODULE_SCOPE void TkBTreeLinkSegment(TkTextSegment *segPtr, |
︙ | ︙ | |||
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | MODULE_SCOPE int TkTextWindowIndex(TkText *textPtr, const char *name, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr, TkTextEmbWindowClient *client); MODULE_SCOPE void TkTextRunAfterSyncCmd(ClientData clientData); #endif /* _TKTEXT */ /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ | > > | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | MODULE_SCOPE int TkTextWindowIndex(TkText *textPtr, const char *name, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr, TkTextEmbWindowClient *client); MODULE_SCOPE void TkTextRunAfterSyncCmd(ClientData clientData); MODULE_SCOPE int TkTextIndexAdjustToStartEnd(TkText *textPtr, TkTextIndex *indexPtr, int err); #endif /* _TKTEXT */ /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkTextBTree.c.
1 2 3 4 5 6 7 | /* * tkTextBTree.c -- * * This file contains code that manages the B-tree representation of text * for Tk's text widget and implements character and toggle segment * types. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkTextBTree.c -- * * This file contains code that manages the B-tree representation of text * for Tk's text widget and implements character and toggle segment * types. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkText.h" |
︙ | ︙ | |||
1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 | linePtr->pixels[2 * pixelReference] < pixels; linePtr = linePtr->nextPtr) { if (linePtr == NULL) { Tcl_Panic("TkBTreeFindPixelLine ran out of lines"); } pixels -= linePtr->pixels[2 * pixelReference]; } if (pixelOffset != NULL && linePtr != NULL) { *pixelOffset = pixels; } return linePtr; } /* | > > > > > > > > > > > > > > > > > > > > | 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | linePtr->pixels[2 * pixelReference] < pixels; linePtr = linePtr->nextPtr) { if (linePtr == NULL) { Tcl_Panic("TkBTreeFindPixelLine ran out of lines"); } pixels -= linePtr->pixels[2 * pixelReference]; } /* * Check for any start/end offset for this text widget. */ if (textPtr->start != NULL) { int lineBoundary = TkBTreeLinesTo(NULL, textPtr->start); if (TkBTreeLinesTo(NULL, linePtr) < lineBoundary) { linePtr = TkBTreeFindLine(tree, NULL, lineBoundary); } } if (textPtr->end != NULL) { int lineBoundary = TkBTreeLinesTo(NULL, textPtr->end); if (TkBTreeLinesTo(NULL, linePtr) > lineBoundary) { linePtr = TkBTreeFindLine(tree, NULL, lineBoundary); } } if (pixelOffset != NULL && linePtr != NULL) { *pixelOffset = pixels; } return linePtr; } /* |
︙ | ︙ | |||
1874 1875 1876 1877 1878 1879 1880 | * TkBTreePixelsTo -- * * Given a pointer to a line in a B-tree, return the numerical pixel * index of the top of that line (i.e. the result does not include the * height of the given line). * * Since the last line of text (the artificial one) has zero height by | | | 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | * TkBTreePixelsTo -- * * Given a pointer to a line in a B-tree, return the numerical pixel * index of the top of that line (i.e. the result does not include the * height of the given line). * * Since the last line of text (the artificial one) has zero height by * definition, calling this with the last line will return the total * number of pixels in the widget. * * Results: * The result is the pixel height of the top of the given line. * * Side effects: * None. |
︙ | ︙ | |||
3337 3338 3339 3340 3341 3342 3343 | TkTextTag ** TkBTreeGetTags( const TkTextIndex *indexPtr,/* Indicates a particular position in the * B-tree. */ const TkText *textPtr, /* If non-NULL, then only return tags for this * text widget (when there are peer * widgets). */ | | | 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 | TkTextTag ** TkBTreeGetTags( const TkTextIndex *indexPtr,/* Indicates a particular position in the * B-tree. */ const TkText *textPtr, /* If non-NULL, then only return tags for this * text widget (when there are peer * widgets). */ TkSizeT *numTagsPtr) /* Store number of tags found at this * location. */ { Node *nodePtr; TkTextLine *siblingLinePtr; TkTextSegment *segPtr; TkTextLine *linePtr; int src, dst, index; |
︙ | ︙ | |||
3528 3529 3530 3531 3532 3533 3534 | index = 0; linePtr = indexPtr->linePtr; segPtr = linePtr->segPtr; while ((index + (int)segPtr->size) <= indexPtr->byteIndex) { if ((segPtr->typePtr == &tkTextToggleOnType) || (segPtr->typePtr == &tkTextToggleOffType)) { tagPtr = segPtr->body.toggle.tagPtr; | | | 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 | index = 0; linePtr = indexPtr->linePtr; segPtr = linePtr->segPtr; while ((index + (int)segPtr->size) <= indexPtr->byteIndex) { if ((segPtr->typePtr == &tkTextToggleOnType) || (segPtr->typePtr == &tkTextToggleOffType)) { tagPtr = segPtr->body.toggle.tagPtr; if (tagPtr->elide >= 0) { infoPtr->tagPtrs[tagPtr->priority] = tagPtr; infoPtr->tagCnts[tagPtr->priority]++; } } index += segPtr->size; segPtr = segPtr->nextPtr; |
︙ | ︙ | |||
3568 3569 3570 3571 3572 3573 3574 | siblingLinePtr != indexPtr->linePtr; siblingLinePtr = siblingLinePtr->nextPtr) { for (segPtr = siblingLinePtr->segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) { if ((segPtr->typePtr == &tkTextToggleOnType) || (segPtr->typePtr == &tkTextToggleOffType)) { tagPtr = segPtr->body.toggle.tagPtr; | | | 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 | siblingLinePtr != indexPtr->linePtr; siblingLinePtr = siblingLinePtr->nextPtr) { for (segPtr = siblingLinePtr->segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) { if ((segPtr->typePtr == &tkTextToggleOnType) || (segPtr->typePtr == &tkTextToggleOffType)) { tagPtr = segPtr->body.toggle.tagPtr; if (tagPtr->elide >= 0) { infoPtr->tagPtrs[tagPtr->priority] = tagPtr; infoPtr->tagCnts[tagPtr->priority]++; } } } } |
︙ | ︙ | |||
3592 3593 3594 3595 3596 3597 3598 | for (siblingPtr = nodePtr->parentPtr->children.nodePtr; siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) { for (summaryPtr = siblingPtr->summaryPtr; summaryPtr != NULL; summaryPtr = summaryPtr->nextPtr) { if (summaryPtr->toggleCount & 1) { tagPtr = summaryPtr->tagPtr; | | | | 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 | for (siblingPtr = nodePtr->parentPtr->children.nodePtr; siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) { for (summaryPtr = siblingPtr->summaryPtr; summaryPtr != NULL; summaryPtr = summaryPtr->nextPtr) { if (summaryPtr->toggleCount & 1) { tagPtr = summaryPtr->tagPtr; if (tagPtr->elide >= 0) { infoPtr->tagPtrs[tagPtr->priority] = tagPtr; infoPtr->tagCnts[tagPtr->priority] += summaryPtr->toggleCount; } } } } } /* * Now traverse from highest priority to lowest, take elided value from * first odd count (= on). */ infoPtr->elidePriority = -1; for (i = infoPtr->numTags-1; i >=0; i--) { if (infoPtr->tagCnts[i] & 1) { infoPtr->elide = infoPtr->tagPtrs[i]->elide > 0; /* * Note: i == infoPtr->tagPtrs[i]->priority */ infoPtr->elidePriority = i; break; |
︙ | ︙ |
Changes to generic/tkTextDisp.c.
1 2 3 4 5 6 7 8 | /* * tkTextDisp.c -- * * This module provides facilities to display text widgets. It is the * only place where information is kept about the screen layout of text * widgets. (Well, strictly, each TkTextLine and B-tree node caches its * last observed pixel height, but that information originates here). * | | | < < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* * tkTextDisp.c -- * * This module provides facilities to display text widgets. It is the * only place where information is kept about the screen layout of text * widgets. (Well, strictly, each TkTextLine and B-tree node caches its * last observed pixel height, but that information originates here). * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkText.h" #ifdef _WIN32 #include "tkWinInt.h" #elif defined(__CYGWIN__) #include "tkUnixInt.h" #elif defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #endif #define OK_TO_LOG (!TkpWillDrawWidget(textPtr->tkwin)) /* * "Calculations of line pixel heights and the size of the vertical * scrollbar." * * Given that tag, font and elide changes can happen to large numbers of * diverse chunks in a text widget containing megabytes of text, it is not |
︙ | ︙ | |||
149 150 151 152 153 154 155 | int rMargin; /* Right margin, in pixels. */ Tk_3DBorder rMarginColor; /* Color of right margin. */ int spacing1; /* Spacing above first dline in text line. */ int spacing2; /* Spacing between lines of dline. */ int spacing3; /* Spacing below last dline in text line. */ TkTextTabArray *tabArrayPtr;/* Locations and types of tab stops (may be * NULL). */ | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | int rMargin; /* Right margin, in pixels. */ Tk_3DBorder rMarginColor; /* Color of right margin. */ int spacing1; /* Spacing above first dline in text line. */ int spacing2; /* Spacing between lines of dline. */ int spacing3; /* Spacing below last dline in text line. */ TkTextTabArray *tabArrayPtr;/* Locations and types of tab stops (may be * NULL). */ int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ int underline; /* Non-zero means draw underline underneath * text. */ XColor *underlineColor; /* Foreground color for underline underneath * text. */ int elide; /* Zero means draw text, otherwise not. */ TkWrapMode wrapMode; /* How to handle wrap-around for this tag. * One of TEXT_WRAPMODE_CHAR, |
︙ | ︙ | |||
436 437 438 439 440 441 442 | } TextDInfo; /* * In TkTextDispChunk structures for character segments, the clientData field * points to one of the following structures: */ | | | 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | } TextDInfo; /* * In TkTextDispChunk structures for character segments, the clientData field * points to one of the following structures: */ #ifndef TK_LAYOUT_WITH_BASE_CHUNKS typedef struct CharInfo { int numBytes; /* Number of bytes to display. */ char chars[TKFLEXARRAY]; /* UTF characters to display. * Allocated as large as necessary. THIS MUST BE THE LAST * FIELD IN THE STRUCTURE. */ } CharInfo; |
︙ | ︙ | |||
773 774 775 776 777 778 779 | * information is wanted. */ { TkTextTag **tagPtrs; TkTextTag *tagPtr; StyleValues styleValues; TextStyle *stylePtr; Tcl_HashEntry *hPtr; | | > | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | * information is wanted. */ { TkTextTag **tagPtrs; TkTextTag *tagPtr; StyleValues styleValues; TextStyle *stylePtr; Tcl_HashEntry *hPtr; TkSizeT numTags, i; int isNew; int isSelected; XGCValues gcValues; unsigned long mask; /* * The variables below keep track of the highest-priority specification * that has occurred for each of the various fields of the StyleValues. */ |
︙ | ︙ | |||
921 922 923 924 925 926 927 | lMarginColorPrio = tagPtr->priority; } if ((tagPtr->offsetString != NULL) && (tagPtr->priority > offsetPrio)) { styleValues.offset = tagPtr->offset; offsetPrio = tagPtr->priority; } | | | | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | lMarginColorPrio = tagPtr->priority; } if ((tagPtr->offsetString != NULL) && (tagPtr->priority > offsetPrio)) { styleValues.offset = tagPtr->offset; offsetPrio = tagPtr->priority; } if ((tagPtr->overstrike >= 0) && (tagPtr->priority > overstrikePrio)) { styleValues.overstrike = tagPtr->overstrike > 0; overstrikePrio = tagPtr->priority; if (tagPtr->overstrikeColor != NULL) { styleValues.overstrikeColor = tagPtr->overstrikeColor; } else if (fgColor != NULL) { styleValues.overstrikeColor = fgColor; } } |
︙ | ︙ | |||
961 962 963 964 965 966 967 | spacing3Prio = tagPtr->priority; } if ((tagPtr->tabStringPtr != NULL) && (tagPtr->priority > tabPrio)) { styleValues.tabArrayPtr = tagPtr->tabArrayPtr; tabPrio = tagPtr->priority; } | > | | | | | > | > | 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 | spacing3Prio = tagPtr->priority; } if ((tagPtr->tabStringPtr != NULL) && (tagPtr->priority > tabPrio)) { styleValues.tabArrayPtr = tagPtr->tabArrayPtr; tabPrio = tagPtr->priority; } if (((tagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) || (tagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR)) && (tagPtr->priority > tabStylePrio)) { styleValues.tabStyle = tagPtr->tabStyle; tabStylePrio = tagPtr->priority; } if ((tagPtr->underline >= 0) && (tagPtr->priority > underlinePrio)) { styleValues.underline = tagPtr->underline > 0; underlinePrio = tagPtr->priority; if (tagPtr->underlineColor != NULL) { styleValues.underlineColor = tagPtr->underlineColor; } else if (fgColor != NULL) { styleValues.underlineColor = fgColor; } } if ((tagPtr->elide >= 0) && (tagPtr->priority > elidePrio)) { styleValues.elide = tagPtr->elide > 0; elidePrio = tagPtr->priority; } if (((tagPtr->wrapMode == TEXT_WRAPMODE_CHAR) || (tagPtr->wrapMode == TEXT_WRAPMODE_NONE) || (tagPtr->wrapMode == TEXT_WRAPMODE_WORD)) && (tagPtr->priority > wrapPrio)) { styleValues.wrapMode = tagPtr->wrapMode; wrapPrio = tagPtr->priority; } } if (tagPtrs != NULL) { ckfree(tagPtrs); |
︙ | ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | TkTextDispChunk *tabChunkPtr; /* Pointer to the chunk containing the * previous tab stop. */ int maxBytes; /* Maximum number of bytes to include in this * chunk. */ TkTextTabArray *tabArrayPtr;/* Tab stops for line; taken from style for * the first character on line. */ | | | 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | TkTextDispChunk *tabChunkPtr; /* Pointer to the chunk containing the * previous tab stop. */ int maxBytes; /* Maximum number of bytes to include in this * chunk. */ TkTextTabArray *tabArrayPtr;/* Tab stops for line; taken from style for * the first character on line. */ int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ int tabSize; /* Number of pixels consumed by current tab * stop. */ TkTextDispChunk *lastCharChunkPtr; /* Pointer to last chunk in display lines with * numBytes > 0. Used to drop 0-sized chunks * from the end of the line. */ TkSizeT byteOffset; |
︙ | ︙ | |||
1240 1241 1242 1243 1244 1245 1246 | /* * The elide state only changes if this tag is either the * current highest priority tag (and is therefore being * toggled off), or it's a new tag with higher priority. */ | | | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 | /* * The elide state only changes if this tag is either the * current highest priority tag (and is therefore being * toggled off), or it's a new tag with higher priority. */ if (tagPtr->elide >= 0) { info.tagCnts[tagPtr->priority]++; if (info.tagCnts[tagPtr->priority] & 1) { info.tagPtrs[tagPtr->priority] = tagPtr; } if (tagPtr->priority >= info.elidePriority) { if (segPtr->typePtr == &tkTextToggleOffType) { /* |
︙ | ︙ | |||
1266 1267 1268 1269 1270 1271 1272 | * elide will be zero, of course). */ elide = 0; while (--info.elidePriority > 0) { if (info.tagCnts[info.elidePriority] & 1) { elide = info.tagPtrs[info.elidePriority] | | | | 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 | * elide will be zero, of course). */ elide = 0; while (--info.elidePriority > 0) { if (info.tagCnts[info.elidePriority] & 1) { elide = info.tagPtrs[info.elidePriority] ->elide > 0; break; } } } else { elide = tagPtr->elide > 0; info.elidePriority = tagPtr->priority; } } } } } |
︙ | ︙ | |||
1387 1388 1389 1390 1391 1392 1393 | /* * If have we have a tag toggle, there is a chance that * invisibility state changed, so bail out. */ } else if ((segPtr->typePtr == &tkTextToggleOffType) || (segPtr->typePtr == &tkTextToggleOnType)) { | | | | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | /* * If have we have a tag toggle, there is a chance that * invisibility state changed, so bail out. */ } else if ((segPtr->typePtr == &tkTextToggleOffType) || (segPtr->typePtr == &tkTextToggleOnType)) { if (segPtr->body.toggle.tagPtr->elide >= 0) { elide = (segPtr->typePtr == &tkTextToggleOffType) ^ (segPtr->body.toggle.tagPtr->elide > 0); } } byteOffset = 0; segPtr = segPtr->nextPtr; if (segPtr == NULL) { |
︙ | ︙ | |||
2461 2462 2463 2464 2465 2466 2467 | y_off = dInfoPtr->y - dlPtr->y; height -= y_off; } else { y_off = 0; } #ifdef TK_NO_DOUBLE_BUFFERING | | | 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 | y_off = dInfoPtr->y - dlPtr->y; height -= y_off; } else { y_off = 0; } #ifdef TK_NO_DOUBLE_BUFFERING Tk_ClipDrawableToRect(display, pixmap, dInfoPtr->x, y + y_off, dInfoPtr->maxX - dInfoPtr->x, height); #endif /* TK_NO_DOUBLE_BUFFERING */ /* * First, clear the area of the line to the background color for the text * widget. */ |
︙ | ︙ | |||
2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 | } chunkPtr->displayProc(textPtr, chunkPtr, x, y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, display, pixmap, dlPtr->y + dlPtr->spaceAbove); } if (dInfoPtr->dLinesInvalidated) { return; } } #ifndef TK_NO_DOUBLE_BUFFERING /* * Copy the pixmap onto the screen. If this is the first or last line on * the screen then copy a piece of the line, so that it doesn't overflow * into the border area. Another special trick: copy the padding area to * the left of the line; this is because the insertion cursor sometimes * overflows onto that area and we want to get as much of the cursor as * possible. */ XCopyArea(display, pixmap, Tk_WindowId(textPtr->tkwin), dInfoPtr->copyGC, dInfoPtr->x, y + y_off, (unsigned) (dInfoPtr->maxX - dInfoPtr->x), (unsigned) height, dInfoPtr->x, dlPtr->y + y_off); #else | > > > > > > > | | 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 | } chunkPtr->displayProc(textPtr, chunkPtr, x, y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, display, pixmap, dlPtr->y + dlPtr->spaceAbove); } if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { /* * A displayProc called in the loop above invoked a binding * that caused the widget to be deleted. Don't do anything. */ return; } if (dInfoPtr->dLinesInvalidated) { return; } } #ifndef TK_NO_DOUBLE_BUFFERING /* * Copy the pixmap onto the screen. If this is the first or last line on * the screen then copy a piece of the line, so that it doesn't overflow * into the border area. Another special trick: copy the padding area to * the left of the line; this is because the insertion cursor sometimes * overflows onto that area and we want to get as much of the cursor as * possible. */ XCopyArea(display, pixmap, Tk_WindowId(textPtr->tkwin), dInfoPtr->copyGC, dInfoPtr->x, y + y_off, (unsigned) (dInfoPtr->maxX - dInfoPtr->x), (unsigned) height, dInfoPtr->x, dlPtr->y + y_off); #else Tk_ClipDrawableToRect(display, pixmap, 0, 0, -1, -1); #endif /* TK_NO_DOUBLE_BUFFERING */ linesRedrawn++; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
3073 3074 3075 3076 3077 3078 3079 | * Cancel any pending idle task which would try to run the command * after the afterSyncCmd pointer had been set to NULL. */ if (textPtr->afterSyncCmd) { int code; Tcl_CancelIdleCall(TkTextRunAfterSyncCmd, textPtr); | | | | 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 | * Cancel any pending idle task which would try to run the command * after the afterSyncCmd pointer had been set to NULL. */ if (textPtr->afterSyncCmd) { int code; Tcl_CancelIdleCall(TkTextRunAfterSyncCmd, textPtr); Tcl_Preserve(textPtr->interp); code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd, TCL_EVAL_GLOBAL); if (code == TCL_ERROR) { Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)"); Tcl_BackgroundException(textPtr->interp, TCL_ERROR); } Tcl_Release(textPtr->interp); Tcl_DecrRefCount(textPtr->afterSyncCmd); textPtr->afterSyncCmd = NULL; } /* * Fire the <<WidgetViewSync>> event since the widget view is in sync * with its internal data (actually it will be after the next trip |
︙ | ︙ | |||
4216 4217 4218 4219 4220 4221 4222 | numRedisplays++; if (tkTextDebug) { CLEAR("tk_textRedraw"); } /* * Choose a new current item if that is needed (this could cause event | | | 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 | numRedisplays++; if (tkTextDebug) { CLEAR("tk_textRedraw"); } /* * Choose a new current item if that is needed (this could cause event * handlers to be invoked, hence the refcount management and the loop, * since the handlers could conceivably necessitate yet another current * item calculation). The tkwin check is because the whole window could go * away in the Tcl_Release call. */ while (dInfoPtr->flags & REPICK_NEEDED) { textPtr->refCount++; |
︙ | ︙ | |||
4410 4411 4412 4413 4414 4415 4416 | GC fgGC, bgGC; bgGC = Tk_GCForColor(textPtr->highlightBgColorPtr, Tk_WindowId(textPtr->tkwin)); if (textPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(textPtr->highlightColorPtr, Tk_WindowId(textPtr->tkwin)); | | | | 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 | GC fgGC, bgGC; bgGC = Tk_GCForColor(textPtr->highlightBgColorPtr, Tk_WindowId(textPtr->tkwin)); if (textPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(textPtr->highlightColorPtr, Tk_WindowId(textPtr->tkwin)); Tk_DrawHighlightBorder(textPtr->tkwin, fgGC, bgGC, textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin)); } else { Tk_DrawHighlightBorder(textPtr->tkwin, bgGC, bgGC, textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin)); } } borders = textPtr->borderWidth + textPtr->highlightWidth; if (textPtr->padY > 0) { Tk_Fill3DRectangle(textPtr->tkwin, Tk_WindowId(textPtr->tkwin), textPtr->border, borders, borders, |
︙ | ︙ | |||
4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 | if (tkTextDebug) { char string[TK_POS_CHARS]; TkTextPrintIndex(textPtr, &dlPtr->index, string); LOG("tk_textRedraw", string); } DisplayDLine(textPtr, dlPtr, prevPtr, pixmap); if (dInfoPtr->dLinesInvalidated) { #ifndef TK_NO_DOUBLE_BUFFERING Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap); #endif /* TK_NO_DOUBLE_BUFFERING */ | > > > > > > > | | 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 | if (tkTextDebug) { char string[TK_POS_CHARS]; TkTextPrintIndex(textPtr, &dlPtr->index, string); LOG("tk_textRedraw", string); } DisplayDLine(textPtr, dlPtr, prevPtr, pixmap); if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { /* * DisplayDLine called a displayProc which invoked a binding * that caused the widget to be deleted. Don't do anything. */ goto end; } if (dInfoPtr->dLinesInvalidated) { #ifndef TK_NO_DOUBLE_BUFFERING Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap); #endif /* TK_NO_DOUBLE_BUFFERING */ goto end; } dlPtr->oldY = dlPtr->y; dlPtr->flags &= ~(NEW_LAYOUT | OLD_Y_INVALID); #ifdef MAC_OSX_TK } else if (dlPtr->chunkPtr != NULL) { /* * On macOS we need to redisplay all embedded windows which |
︙ | ︙ | |||
4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 | rect.x = x; rect.y = y; rect.width = width; rect.height = height; TkUnionRectWithRegion(&rect, damageRgn, damageRgn); TextInvalidateRegion(textPtr, damageRgn); if (!(dInfoPtr->flags & REDRAW_PENDING)) { dInfoPtr->flags |= REDRAW_PENDING; Tcl_DoWhenIdle(DisplayText, textPtr); } | > > > > > > < | 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 | rect.x = x; rect.y = y; rect.width = width; rect.height = height; TkUnionRectWithRegion(&rect, damageRgn, damageRgn); TextInvalidateRegion(textPtr, damageRgn); TkDestroyRegion(damageRgn); /* * Schedule the redisplay operation if there isn't one already scheduled. */ if (!(dInfoPtr->flags & REDRAW_PENDING)) { dInfoPtr->flags |= REDRAW_PENDING; Tcl_DoWhenIdle(DisplayText, textPtr); } } /* *---------------------------------------------------------------------- * * TextInvalidateRegion -- * |
︙ | ︙ | |||
4775 4776 4777 4778 4779 4780 4781 | dlPtr->flags |= OLD_Y_INVALID; } } if (dInfoPtr->topOfEof < maxY) { dInfoPtr->topOfEof = maxY; } | < < < < | 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 | dlPtr->flags |= OLD_Y_INVALID; } } if (dInfoPtr->topOfEof < maxY) { dInfoPtr->topOfEof = maxY; } inset = textPtr->borderWidth + textPtr->highlightWidth; if ((rect.x < (inset + textPtr->padX)) || (rect.y < (inset + textPtr->padY)) || ((int) (rect.x + rect.width) > (Tk_Width(textPtr->tkwin) - inset - textPtr->padX)) || (maxY > (Tk_Height(textPtr->tkwin) - inset - textPtr->padY))) { dInfoPtr->flags |= REDRAW_BORDERS; |
︙ | ︙ | |||
6178 6179 6180 6181 6182 6183 6184 | /* * Next, handle the old syntax: "pathName yview ?-pickplace? where" */ pickPlace = 0; if (Tcl_GetString(objv[2])[0] == '-') { const char *switchStr = | | | 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 | /* * Next, handle the old syntax: "pathName yview ?-pickplace? where" */ pickPlace = 0; if (Tcl_GetString(objv[2])[0] == '-') { const char *switchStr = Tcl_GetStringFromObj(objv[2], &switchLength); if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace", (unsigned) switchLength) == 0)) { pickPlace = 1; if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "lineNum|index"); return TCL_ERROR; |
︙ | ︙ | |||
6438 6439 6440 6441 6442 6443 6444 | } else if (c=='m' && strncmp(Tcl_GetString(objv[2]), "mark", length)==0) { dInfoPtr->scanMarkXPixel = dInfoPtr->newXPixelOffset; dInfoPtr->scanMarkX = x; dInfoPtr->scanTotalYScroll = 0; dInfoPtr->scanMarkY = y; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( | | | 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 | } else if (c=='m' && strncmp(Tcl_GetString(objv[2]), "mark", length)==0) { dInfoPtr->scanMarkXPixel = dInfoPtr->newXPixelOffset; dInfoPtr->scanMarkX = x; dInfoPtr->scanTotalYScroll = 0; dInfoPtr->scanMarkY = y; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad scan option \"%s\": must be dragto or mark", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "scan option", Tcl_GetString(objv[2]), NULL); return TCL_ERROR; } return TCL_OK; } |
︙ | ︙ | |||
7652 7653 7654 7655 7656 7657 7658 | p = segPtr->body.chars + byteOffset; tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; #ifdef TK_LAYOUT_WITH_BASE_CHUNKS if (baseCharChunkPtr == NULL) { baseCharChunkPtr = chunkPtr; | | | | | 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 | p = segPtr->body.chars + byteOffset; tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; #ifdef TK_LAYOUT_WITH_BASE_CHUNKS if (baseCharChunkPtr == NULL) { baseCharChunkPtr = chunkPtr; bciPtr = (BaseCharInfo *)ckalloc(sizeof(BaseCharInfo)); baseString = &bciPtr->baseChars; Tcl_DStringInit(baseString); bciPtr->width = 0; ciPtr = &bciPtr->ci; } else { bciPtr = (BaseCharInfo *)baseCharChunkPtr->clientData; ciPtr = (CharInfo *)ckalloc(sizeof(CharInfo)); baseString = &bciPtr->baseChars; } lineOffset = Tcl_DStringLength(baseString); line = Tcl_DStringAppend(baseString,p,maxBytes); chunkPtr->clientData = ciPtr; |
︙ | ︙ | |||
7763 7764 7765 7766 7767 7768 7769 | chunkPtr->numBytes = bytesThatFit; chunkPtr->minAscent = fm.ascent + chunkPtr->stylePtr->sValuePtr->offset; chunkPtr->minDescent = fm.descent - chunkPtr->stylePtr->sValuePtr->offset; chunkPtr->minHeight = 0; chunkPtr->width = nextX - chunkPtr->x; chunkPtr->breakIndex = -1; | | | 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 | chunkPtr->numBytes = bytesThatFit; chunkPtr->minAscent = fm.ascent + chunkPtr->stylePtr->sValuePtr->offset; chunkPtr->minDescent = fm.descent - chunkPtr->stylePtr->sValuePtr->offset; chunkPtr->minHeight = 0; chunkPtr->width = nextX - chunkPtr->x; chunkPtr->breakIndex = -1; #ifndef TK_LAYOUT_WITH_BASE_CHUNKS ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit); chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ ciPtr->numBytes = bytesThatFit; if (p[bytesThatFit - 1] == '\n') { |
︙ | ︙ | |||
7879 7880 7881 7882 7883 7884 7885 | int *nextXPtr) /* The function puts the newly calculated * right border x-position of the span * here. */ { Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; | | | 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 | int *nextXPtr) /* The function puts the newly calculated * right border x-position of the span * here. */ { Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; #ifndef TK_LAYOUT_WITH_BASE_CHUNKS if (chars == NULL) { chars = ciPtr->chars; charsLen = ciPtr->numBytes; } if (end == -1) { end = charsLen; } |
︙ | ︙ | |||
7984 7985 7986 7987 7988 7989 7990 | * The chunk is off-screen. */ return; } #ifdef TK_DRAW_IN_CONTEXT | | | 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 | * The chunk is off-screen. */ return; } #ifdef TK_DRAW_IN_CONTEXT bciPtr = (BaseCharInfo *)ciPtr->baseChunkPtr->clientData; numBytes = Tcl_DStringLength(&bciPtr->baseChars); string = Tcl_DStringValue(&bciPtr->baseChars); #elif defined(TK_LAYOUT_WITH_BASE_CHUNKS) if (ciPtr->baseChunkPtr != chunkPtr) { /* * Without context drawing only base chunks display their foreground. |
︙ | ︙ | |||
8895 8896 8897 8898 8899 8900 8901 | #ifdef TK_DRAW_IN_CONTEXT chunkPtr->x += widthAdjust; #endif /* TK_DRAW_IN_CONTEXT */ if (chunkPtr->displayProc != CharDisplayProc) { continue; } | | | | 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 | #ifdef TK_DRAW_IN_CONTEXT chunkPtr->x += widthAdjust; #endif /* TK_DRAW_IN_CONTEXT */ if (chunkPtr->displayProc != CharDisplayProc) { continue; } ciPtr = (CharInfo *)chunkPtr->clientData; if (ciPtr->baseChunkPtr != baseCharChunkPtr) { break; } ciPtr->chars = baseChars + ciPtr->baseOffset; #ifdef TK_DRAW_IN_CONTEXT newwidth = 0; CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth); if (newwidth < chunkPtr->width) { widthAdjust += newwidth - chunkPtr->width; chunkPtr->width = newwidth; } #endif /* TK_DRAW_IN_CONTEXT */ } if (addChunkPtr != NULL) { ciPtr = (CharInfo *)addChunkPtr->clientData; ciPtr->chars = baseChars + ciPtr->baseOffset; #ifdef TK_DRAW_IN_CONTEXT addChunkPtr->x += widthAdjust; CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0, &addChunkPtr->width); #endif /* TK_DRAW_IN_CONTEXT */ |
︙ | ︙ | |||
8963 8964 8965 8966 8967 8968 8969 | baseCharChunkPtr = NULL; } for (chunkPtr=baseChunkPtr; chunkPtr!=NULL; chunkPtr=chunkPtr->nextPtr) { if (chunkPtr->undisplayProc != CharUndisplayProc) { continue; } | | | 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 | baseCharChunkPtr = NULL; } for (chunkPtr=baseChunkPtr; chunkPtr!=NULL; chunkPtr=chunkPtr->nextPtr) { if (chunkPtr->undisplayProc != CharUndisplayProc) { continue; } ciPtr = (CharInfo *)chunkPtr->clientData; if (ciPtr->baseChunkPtr != baseChunkPtr) { break; } ciPtr->baseChunkPtr = NULL; ciPtr->chars = NULL; } |
︙ | ︙ | |||
9013 9014 9015 9016 9017 9018 9019 | StyleValues *sv1; StyleValues *sv2; if (style1 == style2) { return 1; } | | | 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 | StyleValues *sv1; StyleValues *sv2; if (style1 == style2) { return 1; } #ifndef TK_DRAW_IN_CONTEXT if ( #ifdef MAC_OSX_TK !TkMacOSXCompareColors(style1->fgGC->foreground, style2->fgGC->foreground) #else style1->fgGC->foreground != style2->fgGC->foreground #endif |
︙ | ︙ | |||
9083 9084 9085 9086 9087 9088 9089 | return; } /* * Reinstitute this base chunk for re-layout. */ | | | | 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 | return; } /* * Reinstitute this base chunk for re-layout. */ ciPtr = (CharInfo *)chunkPtr->clientData; baseCharChunkPtr = ciPtr->baseChunkPtr; /* * Remove the chunk data from the base chunk data. */ bciPtr = (BaseCharInfo *)baseCharChunkPtr->clientData; #ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS if ((ciPtr->baseOffset + ciPtr->numBytes) != Tcl_DStringLength(&bciPtr->baseChars)) { fprintf(stderr,"RemoveFromBaseChunk called with wrong chunk " "(not last)\n"); } |
︙ | ︙ |
Changes to generic/tkTextImage.c.
1 2 3 4 5 6 | /* * tkImage.c -- * * This file contains code that allows images to be nested inside text * widgets. It also implements the "image" widget command for texts. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkImage.c -- * * This file contains code that allows images to be nested inside text * widgets. It also implements the "image" widget command for texts. * * Copyright © 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkPort.h" #include "tkText.h" |
︙ | ︙ | |||
765 766 767 768 769 770 771 | * * TkTextImageIndex -- * * Given the name of an embedded image within a text widget, returns an * index corresponding to the image's position in the text. * * Results: | | | | | | > > > > > > > > > > > | | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | * * TkTextImageIndex -- * * Given the name of an embedded image within a text widget, returns an * index corresponding to the image's position in the text. * * Results: * The return value is TCL_OK if there is an embedded image by the given * name in the text widget, TCL_ERROR otherwise. If the image exists, * *indexPtr is filled in with its index. * * Side effects: * None. * *-------------------------------------------------------------- */ int TkTextImageIndex( TkText *textPtr, /* Text widget containing image. */ const char *name, /* Name of image. */ TkTextIndex *indexPtr) /* Index information gets stored here. */ { Tcl_HashEntry *hPtr; TkTextSegment *eiPtr; if (textPtr == NULL) { return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->imageTable, name); if (hPtr == NULL) { return TCL_ERROR; } eiPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = eiPtr->body.ei.linePtr; indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr); /* * If indexPtr refers to somewhere outside the -startline/-endline * range limits of the widget, error out since the image indeed is not * reachable from this text widget (it may be reachable from a peer). */ if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) { return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- * * EmbImageProc -- * |
︙ | ︙ |
Changes to generic/tkTextIndex.c.
1 2 3 4 5 6 | /* * tkTextIndex.c -- * * This module provides functions that manipulate indices for text * widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkTextIndex.c -- * * This module provides functions that manipulate indices for text * widgets. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkText.h" |
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | TkTextIndex *indexPtr); static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr, TkText *textPtr, const char *string, TkTextIndex *indexPtr, int *canCachePtr); static int IndexCountBytesOrdered(const TkText *textPtr, const TkTextIndex *indexPtr1, const TkTextIndex *indexPtr2); /* * The "textindex" Tcl_Obj definition: */ static void DupTextIndexInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); | > > > > > > > > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | TkTextIndex *indexPtr); static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr, TkText *textPtr, const char *string, TkTextIndex *indexPtr, int *canCachePtr); static int IndexCountBytesOrdered(const TkText *textPtr, const TkTextIndex *indexPtr1, const TkTextIndex *indexPtr2); #if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION < 9) # undef Tcl_UtfPrev # define Tcl_UtfPrev (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ ((const char * (*)(const char *, const char *))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[656])) \ : ((const char * (*)(const char *, const char *))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[331]))) #endif /* * The "textindex" Tcl_Obj definition: */ static void DupTextIndexInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); |
︙ | ︙ | |||
432 433 434 435 436 437 438 | * Prevent UTF-8 character from being split up by ensuring * that byteIndex falls on a character boundary. If the index * falls in the middle of a UTF-8 character, it will be * adjusted to the end of that UTF-8 character. */ start = segPtr->body.chars + (byteIndex - index); | | | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | * Prevent UTF-8 character from being split up by ensuring * that byteIndex falls on a character boundary. If the index * falls in the middle of a UTF-8 character, it will be * adjusted to the end of that UTF-8 character. */ start = segPtr->body.chars + (byteIndex - index); p = Tcl_UtfPrev(start, segPtr->body.chars); p += TkUtfToUniChar(p, &ch); indexPtr->byteIndex += p - start; } break; } index += segPtr->size; } |
︙ | ︙ | |||
476 477 478 479 480 481 482 | * of text). */ int charIndex, /* Index of desired character. */ TkTextIndex *indexPtr) /* Structure to fill in. */ { TkTextSegment *segPtr; char *p, *start, *end; int index, offset; | | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | * of text). */ int charIndex, /* Index of desired character. */ TkTextIndex *indexPtr) /* Structure to fill in. */ { TkTextSegment *segPtr; char *p, *start, *end; int index, offset; Tcl_UniChar ch = 0; indexPtr->tree = tree; if (lineIndex < 0) { lineIndex = 0; charIndex = 0; } if (charIndex < 0) { |
︙ | ︙ | |||
523 524 525 526 527 528 529 | end = start + segPtr->size; for (p = start; p < end; p += offset) { if (charIndex == 0) { indexPtr->byteIndex = index; return indexPtr; } charIndex--; | | | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | end = start + segPtr->size; for (p = start; p < end; p += offset) { if (charIndex == 0) { indexPtr->byteIndex = index; return indexPtr; } charIndex--; offset = Tcl_UtfToUniChar(p, &ch); index += offset; } } else { if (charIndex < (int)segPtr->size) { indexPtr->byteIndex = index; break; } |
︙ | ︙ | |||
757 758 759 760 761 762 763 | *--------------------------------------------------------------------- */ if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) { goto done; } | | | | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | *--------------------------------------------------------------------- */ if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) { goto done; } if (TkTextWindowIndex(textPtr, string, indexPtr) == TCL_OK) { goto done; } if (TkTextImageIndex(textPtr, string, indexPtr) == TCL_OK) { goto done; } /* *------------------------------------------------ * Stage 2: start again by parsing the base index. *------------------------------------------------ |
︙ | ︙ | |||
913 914 915 916 917 918 919 | * See if the base position is the name of an embedded window. */ c = *endOfBase; *endOfBase = 0; result = TkTextWindowIndex(textPtr, Tcl_DStringValue(©), indexPtr); *endOfBase = c; | | | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | * See if the base position is the name of an embedded window. */ c = *endOfBase; *endOfBase = 0; result = TkTextWindowIndex(textPtr, Tcl_DStringValue(©), indexPtr); *endOfBase = c; if (result == TCL_OK) { goto gotBase; } } if ((string[0] == 'e') && (strncmp(string, "end", endOfBase-Tcl_DStringValue(©)) == 0)) { /* |
︙ | ︙ | |||
950 951 952 953 954 955 956 | * See if the base position is the name of an embedded image. */ c = *endOfBase; *endOfBase = 0; result = TkTextImageIndex(textPtr, Tcl_DStringValue(©), indexPtr); *endOfBase = c; | | | 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | * See if the base position is the name of an embedded image. */ c = *endOfBase; *endOfBase = 0; result = TkTextImageIndex(textPtr, Tcl_DStringValue(©), indexPtr); *endOfBase = c; if (result == TCL_OK) { goto gotBase; } } goto error; /* *------------------------------------------------------------------- |
︙ | ︙ | |||
993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 | done: if (canCachePtr != NULL) { *canCachePtr = canCache; } if (indexPtr->linePtr == NULL) { Tcl_Panic("Bad index created"); } return TCL_OK; error: Tcl_DStringFree(©); Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad text index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "TEXT", "BAD_INDEX", NULL); return TCL_ERROR; } /* *--------------------------------------------------------------------------- * * TkTextPrintIndex -- * * This function generates a string description of an index, suitable for | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | done: if (canCachePtr != NULL) { *canCachePtr = canCache; } if (indexPtr->linePtr == NULL) { Tcl_Panic("Bad index created"); } TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 0); return TCL_OK; error: Tcl_DStringFree(©); Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad text index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "TEXT", "BAD_INDEX", NULL); return TCL_ERROR; } /* *--------------------------------------------------------------------------- * * TkTextIndexAdjustToStartEnd -- * * Adjust indexPtr to the -startline/-endline range, or just check * if indexPtr is out of this range. * * Results: * The return value is a standard Tcl return result. If check is true, * return TCL_ERROR if indexPtr is outside the -startline/-endline * range (indexPtr is not modified). * If check is false, adjust indexPtr to -startline/-endline. * * Side effects: * None. * *--------------------------------------------------------------------------- */ int TkTextIndexAdjustToStartEnd( TkText *textPtr, TkTextIndex *indexPtr, /* Pointer to index. */ int check) /* 1 means only check indexPtr against * the -startline/-endline range * 0 means adjust to this range */ { int bound; TkTextIndex indexBound; if (!textPtr) { return TCL_OK; } if (textPtr->start != NULL) { bound = TkBTreeLinesTo(NULL, textPtr->start); TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, &indexBound); if (TkTextIndexCmp(indexPtr, &indexBound) < 0) { if (check) { return TCL_ERROR; } TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, indexPtr); } } if (textPtr->end != NULL) { bound = TkBTreeLinesTo(NULL, textPtr->end); TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, &indexBound); if (TkTextIndexCmp(indexPtr, &indexBound) > 0) { if (check) { return TCL_ERROR; } TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, indexPtr); } } return TCL_OK; } /* *--------------------------------------------------------------------------- * * TkTextPrintIndex -- * * This function generates a string description of an index, suitable for |
︙ | ︙ | |||
1541 1542 1543 1544 1545 1546 1547 | /* * The elide state only changes if this tag is either the * current highest priority tag (and is therefore being * toggled off), or it's a new tag with higher priority. */ | | | 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 | /* * The elide state only changes if this tag is either the * current highest priority tag (and is therefore being * toggled off), or it's a new tag with higher priority. */ if (tagPtr->elide >= 0) { infoPtr->tagCnts[tagPtr->priority]++; if (infoPtr->tagCnts[tagPtr->priority] & 1) { infoPtr->tagPtrs[tagPtr->priority] = tagPtr; } if (tagPtr->priority >= infoPtr->elidePriority) { if (segPtr->typePtr == &tkTextToggleOffType) { |
︙ | ︙ | |||
1569 1570 1571 1572 1573 1574 1575 | */ elide = 0; while (--infoPtr->elidePriority > 0) { if (infoPtr->tagCnts[infoPtr->elidePriority] & 1) { elide = infoPtr->tagPtrs | | | | 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 | */ elide = 0; while (--infoPtr->elidePriority > 0) { if (infoPtr->tagCnts[infoPtr->elidePriority] & 1) { elide = infoPtr->tagPtrs [infoPtr->elidePriority]->elide > 0; break; } } } else { elide = tagPtr->elide > 0; infoPtr->elidePriority = tagPtr->priority; } } } } if (!elide) { |
︙ | ︙ | |||
1791 1792 1793 1794 1795 1796 1797 | /* * The elide state only changes if this tag is either the * current highest priority tag (and is therefore being * toggled off), or it's a new tag with higher priority. */ | | | 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 | /* * The elide state only changes if this tag is either the * current highest priority tag (and is therefore being * toggled off), or it's a new tag with higher priority. */ if (tagPtr->elide >= 0) { infoPtr->tagCnts[tagPtr->priority]++; if (infoPtr->tagCnts[tagPtr->priority] & 1) { infoPtr->tagPtrs[tagPtr->priority] = tagPtr; } if (tagPtr->priority >= infoPtr->elidePriority) { if (segPtr->typePtr == &tkTextToggleOffType) { /* |
︙ | ︙ | |||
1819 1820 1821 1822 1823 1824 1825 | */ elide = 0; while (--infoPtr->elidePriority > 0) { if (infoPtr->tagCnts[ infoPtr->elidePriority] & 1) { elide = infoPtr->tagPtrs[ | | | | 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | */ elide = 0; while (--infoPtr->elidePriority > 0) { if (infoPtr->tagCnts[ infoPtr->elidePriority] & 1) { elide = infoPtr->tagPtrs[ infoPtr->elidePriority]->elide > 0; break; } } } else { elide = tagPtr->elide > 0; infoPtr->elidePriority = tagPtr->priority; } } } } if (elide) { if (segPtr == seg2Ptr) { |
︙ | ︙ | |||
2080 2081 2082 2083 2084 2085 2086 | /* * The elide state only changes if this tag is either the current * highest priority tag (and is therefore being toggled off), or * it's a new tag with higher priority. */ | | | 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 | /* * The elide state only changes if this tag is either the current * highest priority tag (and is therefore being toggled off), or * it's a new tag with higher priority. */ if (tagPtr->elide >= 0) { infoPtr->tagCnts[tagPtr->priority]++; if (infoPtr->tagCnts[tagPtr->priority] & 1) { infoPtr->tagPtrs[tagPtr->priority] = tagPtr; } if (tagPtr->priority >= infoPtr->elidePriority) { if (segPtr->typePtr == &tkTextToggleOnType) { /* |
︙ | ︙ | |||
2106 2107 2108 2109 2110 2111 2112 | * will be zero, of course). */ elide = 0; while (--infoPtr->elidePriority > 0) { if (infoPtr->tagCnts[infoPtr->elidePriority] & 1) { elide = infoPtr->tagPtrs[ | | | | > > > > | > | 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 | * will be zero, of course). */ elide = 0; while (--infoPtr->elidePriority > 0) { if (infoPtr->tagCnts[infoPtr->elidePriority] & 1) { elide = infoPtr->tagPtrs[ infoPtr->elidePriority]->elide > 0; break; } } } else { elide = tagPtr->elide > 0; infoPtr->elidePriority = tagPtr->priority; } } } } if (!elide) { if (segPtr->typePtr == &tkTextCharType) { start = segPtr->body.chars; end = segPtr->body.chars + segSize; for (p = end; ; p = Tcl_UtfPrev(p, start)) { if (charCount == 0) { dstPtr->byteIndex -= (end - p); goto backwardCharDone; } if (p == start) { break; } if ((sizeof(Tcl_UniChar) == 2) && (unsigned)(UCHAR(*p) - 0xF0) <= 5) { charCount--; /* Characters > U+FFFF count as 2 here */ } if (charCount != 0) { charCount--; } } } else { if (type & COUNT_INDICES) { if (charCount <= segSize) { dstPtr->byteIndex -= charCount; goto backwardCharDone; } |
︙ | ︙ | |||
2363 2364 2365 2366 2367 2368 2369 | int ch; TkUtfToUniChar(segPtr->body.chars + offset, &ch); if (!Tcl_UniCharIsWordChar(ch)) { break; } if (offset + 1 > 1) { chSize = (segPtr->body.chars + offset | | | | | | | | | | | | | | | 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 | int ch; TkUtfToUniChar(segPtr->body.chars + offset, &ch); if (!Tcl_UniCharIsWordChar(ch)) { break; } if (offset + 1 > 1) { chSize = (segPtr->body.chars + offset - Tcl_UtfPrev(segPtr->body.chars + offset, segPtr->body.chars)); } firstChar = 0; } if (offset == 0) { if (modifier == TKINDEX_DISPLAY) { TkTextIndexBackChars(textPtr, indexPtr, 1, indexPtr, COUNT_DISPLAY_INDICES); } else { TkTextIndexBackChars(NULL, indexPtr, 1, indexPtr, COUNT_INDICES); } } else { indexPtr->byteIndex -= chSize; } offset -= chSize; if ((int)offset < 0) { if (indexPtr->byteIndex == 0) { goto done; } segPtr = TkTextIndexToSeg(indexPtr, &offset); } } |
︙ | ︙ |
Changes to generic/tkTextMark.c.
1 2 3 4 5 6 | /* * tkTextMark.c -- * * This file contains the functions that implement marks for text * widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkTextMark.c -- * * This file contains the functions that implement marks for text * widgets. * * Copyright © 1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkText.h" |
︙ | ︙ | |||
129 130 131 132 133 134 135 | TkSizeT length; const char *str; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?"); return TCL_ERROR; } | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | TkSizeT length; const char *str; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?"); return TCL_ERROR; } str = Tcl_GetStringFromObj(objv[3], &length); if (length == 6 && !strcmp(str, "insert")) { markPtr = textPtr->insertMarkPtr; } else if (length == 7 && !strcmp(str, "current")) { markPtr = textPtr->currentMarkPtr; } else { hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, str); if (hPtr == NULL) { |
︙ | ︙ | |||
156 157 158 159 160 161 162 | typeStr = "right"; } else { typeStr = "left"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, -1)); return TCL_OK; } | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | typeStr = "right"; } else { typeStr = "left"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, -1)); return TCL_OK; } str = Tcl_GetStringFromObj(objv[4],&length); c = str[0]; if ((c == 'l') && (strncmp(str, "left", length) == 0)) { newTypePtr = &tkTextLeftMarkType; } else if ((c == 'r') && (strncmp(str, "right", length) == 0)) { newTypePtr = &tkTextRightMarkType; } else { |
︙ | ︙ | |||
430 431 432 433 434 435 436 | int TkTextMarkNameToIndex( TkText *textPtr, /* Text widget containing mark. */ const char *name, /* Name of mark. */ TkTextIndex *indexPtr) /* Index information gets stored here. */ { TkTextSegment *segPtr; | < < > | < < < < | | | | < < < < < < < < | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | int TkTextMarkNameToIndex( TkText *textPtr, /* Text widget containing mark. */ const char *name, /* Name of mark. */ TkTextIndex *indexPtr) /* Index information gets stored here. */ { TkTextSegment *segPtr; if (textPtr == NULL) { return TCL_ERROR; } if (!strcmp(name, "insert")) { segPtr = textPtr->insertMarkPtr; } else if (!strcmp(name, "current")) { segPtr = textPtr->currentMarkPtr; } else { Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, name); if (hPtr == NULL) { return TCL_ERROR; } segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); } TkTextMarkSegToIndex(textPtr, segPtr, indexPtr); /* * If indexPtr refers to somewhere outside the -startline/-endline * range limits of the widget, error out since the mark indeed is not * reachable from this text widget (it may be reachable from a peer) * (bug 1630271). */ if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) { return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- * * MarkDeleteProc -- |
︙ | ︙ |
Changes to generic/tkTextTag.c.
1 2 3 4 5 6 7 | /* * tkTextTag.c -- * * This module implements the "tag" subcommand of the widget command for * text widgets, plus most of the other high-level functions related to * tags. * | | | < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | /* * tkTextTag.c -- * * This module implements the "tag" subcommand of the widget command for * text widgets, plus most of the other high-level functions related to * tags. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkText.h" #include "default.h" static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", NULL, NULL, NULL, offsetof(TkTextTag, borderWidthPtr), offsetof(TkTextTag, borderWidth), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-elide", NULL, NULL, NULL, offsetof(TkTextTag, elidePtr), offsetof(TkTextTag, elide), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BITMAP, "-fgstipple", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_FONT, "-font", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-foreground", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-justify", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, justifyString), TK_OPTION_NULL_OK, 0,0}, {TK_OPTION_STRING, "-lmargin1", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-lmargin2", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_BORDER, "-lmargincolor", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-offset", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL, NULL, offsetof(TkTextTag, overstrikePtr), offsetof(TkTextTag, overstrike), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-overstrikefg", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-relief", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-rmargin", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0}, {TK_OPTION_BORDER, "-rmargincolor", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, rMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-spacing1", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-spacing2", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-spacing3", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-tabs", NULL, NULL, NULL, offsetof(TkTextTag, tabStringPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tabStyle), TK_OPTION_NULL_OK, tkTextTabStyleStrings, 0}, {TK_OPTION_BOOLEAN, "-underline", NULL, NULL, NULL, offsetof(TkTextTag, underlinePtr), offsetof(TkTextTag, underline), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-underlinefg", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, underlineColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-wrap", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, wrapMode), TK_OPTION_NULL_OK|TK_OPTION_ENUM_VAR, tkTextWrapStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* * Forward declarations for functions defined later in this file: */ |
︙ | ︙ | |||
149 150 151 152 153 154 155 | "nextrange", "prevrange", "raise", "ranges", "remove", NULL }; enum tagOptions { TAG_ADD, TAG_BIND, TAG_CGET, TAG_CONFIGURE, TAG_DELETE, TAG_LOWER, TAG_NAMES, TAG_NEXTRANGE, TAG_PREVRANGE, TAG_RAISE, TAG_RANGES, TAG_REMOVE }; | | > | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | "nextrange", "prevrange", "raise", "ranges", "remove", NULL }; enum tagOptions { TAG_ADD, TAG_BIND, TAG_CGET, TAG_CONFIGURE, TAG_DELETE, TAG_LOWER, TAG_NAMES, TAG_NEXTRANGE, TAG_PREVRANGE, TAG_RAISE, TAG_RANGES, TAG_REMOVE }; int optionIndex; TkSizeT i; TkTextTag *tagPtr; TkTextIndex index1, index2; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
179 180 181 182 183 184 185 | } if (objc < 5) { Tcl_WrongNumArgs(interp, 3, objv, "tagName index1 ?index2 index1 index2 ...?"); return TCL_ERROR; } tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), NULL); | | | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | } if (objc < 5) { Tcl_WrongNumArgs(interp, 3, objv, "tagName index1 ?index2 index1 index2 ...?"); return TCL_ERROR; } tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), NULL); if (tagPtr->elide > 0) { /* * Indices are potentially obsolete after adding or removing * elided character ranges, especially indices having "display" * or "any" submodifier, therefore increase the epoch. */ textPtr->sharedTextPtr->stateEpoch++; } for (i = 4; i < (TkSizeT)objc; i += 2) { if (TkTextGetObjIndex(interp, textPtr, objv[i], &index1) != TCL_OK) { return TCL_ERROR; } if ((TkSizeT)objc > (i+1)) { if (TkTextGetObjIndex(interp, textPtr, objv[i+1], &index2) != TCL_OK) { return TCL_ERROR; } if (TkTextIndexCmp(&index1, &index2) >= 0) { return TCL_OK; } |
︙ | ︙ | |||
275 276 277 278 279 280 281 | int append = 0; unsigned long mask; const char *fifth = Tcl_GetString(objv[5]); if (fifth[0] == 0) { return Tk_DeleteBinding(interp, textPtr->sharedTextPtr->bindingTable, | | | | | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | int append = 0; unsigned long mask; const char *fifth = Tcl_GetString(objv[5]); if (fifth[0] == 0) { return Tk_DeleteBinding(interp, textPtr->sharedTextPtr->bindingTable, (void *) tagPtr->name, Tcl_GetString(objv[4])); } if (fifth[0] == '+') { fifth++; append = 1; } mask = Tk_CreateBinding(interp, textPtr->sharedTextPtr->bindingTable, (void *) tagPtr->name, Tcl_GetString(objv[4]), fifth, append); if (mask == 0) { return TCL_ERROR; } if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask |Button2MotionMask|Button3MotionMask|Button4MotionMask |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) { Tk_DeleteBinding(interp, textPtr->sharedTextPtr->bindingTable, (void *) tagPtr->name, Tcl_GetString(objv[4])); Tcl_SetObjResult(interp, Tcl_NewStringObj( "requested illegal events; only key, button, motion," " enter, leave, and virtual events may be used", -1)); Tcl_SetErrorCode(interp, "TK", "TEXT", "TAG_BIND_EVENT",NULL); return TCL_ERROR; } } else if (objc == 5) { const char *command; command = Tk_GetBinding(interp, textPtr->sharedTextPtr->bindingTable, (void *) tagPtr->name, Tcl_GetString(objv[4])); if (command == NULL) { const char *string = Tcl_GetString(Tcl_GetObjResult(interp)); /* * Ignore missing binding errors. This is a special hack that * relies on the error message returned by FindSequence in * tkBind.c. */ if (string[0] != '\0') { return TCL_ERROR; } Tcl_ResetResult(interp); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj(command, -1)); } } else { Tk_GetAllBindings(interp, textPtr->sharedTextPtr->bindingTable, (void *) tagPtr->name); } break; case TAG_CGET: if (objc != 5) { Tcl_WrongNumArgs(interp, 1, objv, "tag cget tagName option"); return TCL_ERROR; } else { |
︙ | ︙ | |||
414 415 416 417 418 419 420 | } } if (tagPtr->offsetString != NULL) { if (Tk_GetPixels(interp, textPtr->tkwin, tagPtr->offsetString, &tagPtr->offset) != TCL_OK) { return TCL_ERROR; } | < < < < < < | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | } } if (tagPtr->offsetString != NULL) { if (Tk_GetPixels(interp, textPtr->tkwin, tagPtr->offsetString, &tagPtr->offset) != TCL_OK) { return TCL_ERROR; } } if (tagPtr->rMarginString != NULL) { if (Tk_GetPixels(interp, textPtr->tkwin, tagPtr->rMarginString, &tagPtr->rMargin) != TCL_OK) { return TCL_ERROR; } } |
︙ | ︙ | |||
465 466 467 468 469 470 471 | if (tagPtr->tabStringPtr != NULL) { tagPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr, tagPtr->tabStringPtr); if (tagPtr->tabArrayPtr == NULL) { return TCL_ERROR; } } | < < < < < < | < < < < < | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | if (tagPtr->tabStringPtr != NULL) { tagPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr, tagPtr->tabStringPtr); if (tagPtr->tabArrayPtr == NULL) { return TCL_ERROR; } } if (tagPtr->elide >= 0) { /* * Indices are potentially obsolete after changing -elide, * especially those computed with "display" or "any" * submodifier, therefore increase the epoch. */ textPtr->sharedTextPtr->stateEpoch++; |
︙ | ︙ | |||
511 512 513 514 515 516 517 | } else { textPtr->selFgColorPtr = tagPtr->selFgColor; } } tagPtr->affectsDisplay = 0; tagPtr->affectsDisplayGeometry = 0; | | | > | > > | | | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | } else { textPtr->selFgColorPtr = tagPtr->selFgColor; } } tagPtr->affectsDisplay = 0; tagPtr->affectsDisplayGeometry = 0; if ((tagPtr->elide >= 0) || (tagPtr->tkfont != NULL) || (tagPtr->justifyString != NULL) || (tagPtr->lMargin1String != NULL) || (tagPtr->lMargin2String != NULL) || (tagPtr->offsetString != NULL) || (tagPtr->rMarginString != NULL) || (tagPtr->spacing1String != NULL) || (tagPtr->spacing2String != NULL) || (tagPtr->spacing3String != NULL) || (tagPtr->tabStringPtr != NULL) || (tagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) || (tagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR) || (tagPtr->wrapMode == TEXT_WRAPMODE_CHAR) || (tagPtr->wrapMode == TEXT_WRAPMODE_NONE) || (tagPtr->wrapMode == TEXT_WRAPMODE_WORD)) { tagPtr->affectsDisplay = 1; tagPtr->affectsDisplayGeometry = 1; } if ((tagPtr->border != NULL) || (tagPtr->selBorder != NULL) || (tagPtr->reliefString != NULL) || (tagPtr->bgStipple != None) || (tagPtr->fgColor != NULL) || (tagPtr->selFgColor != NULL) || (tagPtr->fgStipple != None) || (tagPtr->overstrike >= 0) || (tagPtr->overstrikeColor != NULL) || (tagPtr->underline >= 0) || (tagPtr->underlineColor != NULL) || (tagPtr->lMarginColor != NULL) || (tagPtr->rMarginColor != NULL)) { tagPtr->affectsDisplay = 1; } if (!newTag) { /* |
︙ | ︙ | |||
568 569 570 571 572 573 574 | case TAG_DELETE: { Tcl_HashEntry *hPtr; if (objc < 4) { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?tagName ...?"); return TCL_ERROR; } | | | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | case TAG_DELETE: { Tcl_HashEntry *hPtr; if (objc < 4) { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?tagName ...?"); return TCL_ERROR; } for (i = 3; i < (TkSizeT)objc; i++) { hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable, Tcl_GetString(objv[i])); if (hPtr == NULL) { /* * Either this tag doesn't exist or it's the 'sel' tag (which * is not in the hash table). Either way we don't want to * delete it. |
︙ | ︙ | |||
630 631 632 633 634 635 636 | */ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, NULL, NULL, tagPtr, 1); break; } case TAG_NAMES: { TkTextTag **arrayPtr; | | | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | */ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, NULL, NULL, tagPtr, 1); break; } case TAG_NAMES: { TkTextTag **arrayPtr; TkSizeT arraySize; Tcl_Obj *listObj; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 3, objv, "?index?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | tagPtr->reliefString = NULL; tagPtr->relief = TK_RELIEF_FLAT; tagPtr->bgStipple = None; tagPtr->fgColor = NULL; tagPtr->tkfont = NULL; tagPtr->fgStipple = None; tagPtr->justifyString = NULL; | | | | | | | | | | 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | tagPtr->reliefString = NULL; tagPtr->relief = TK_RELIEF_FLAT; tagPtr->bgStipple = None; tagPtr->fgColor = NULL; tagPtr->tkfont = NULL; tagPtr->fgStipple = None; tagPtr->justifyString = NULL; tagPtr->justify = TK_JUSTIFY_NULL; tagPtr->lMargin1String = NULL; tagPtr->lMargin1 = 0; tagPtr->lMargin2String = NULL; tagPtr->lMargin2 = 0; tagPtr->lMarginColor = NULL; tagPtr->offsetString = NULL; tagPtr->offset = 0; tagPtr->overstrikePtr = NULL; tagPtr->overstrike = -1; tagPtr->overstrikeColor = NULL; tagPtr->rMarginString = NULL; tagPtr->rMargin = 0; tagPtr->rMarginColor = NULL; tagPtr->selBorder = NULL; tagPtr->selFgColor = NULL; tagPtr->spacing1String = NULL; tagPtr->spacing1 = 0; tagPtr->spacing2String = NULL; tagPtr->spacing2 = 0; tagPtr->spacing3String = NULL; tagPtr->spacing3 = 0; tagPtr->tabStringPtr = NULL; tagPtr->tabArrayPtr = NULL; tagPtr->tabStyle = TK_TEXT_TABSTYLE_NULL; tagPtr->underlinePtr = NULL; tagPtr->underline = -1; tagPtr->underlineColor = NULL; tagPtr->elidePtr = NULL; tagPtr->elide = -1; tagPtr->wrapMode = TEXT_WRAPMODE_NULL; tagPtr->affectsDisplay = 0; tagPtr->affectsDisplayGeometry = 0; textPtr->sharedTextPtr->numTags++; if (!strcmp(tagName, "sel")) { tagPtr->textPtr = textPtr; textPtr->refCount++; |
︙ | ︙ | |||
1107 1108 1109 1110 1111 1112 1113 | TkText *textPtr, /* Widget in which tag is being used. */ Tcl_Obj *tagName) /* Name of desired tag. */ { Tcl_HashEntry *hPtr; TkSizeT len; const char *str; | | | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | TkText *textPtr, /* Widget in which tag is being used. */ Tcl_Obj *tagName) /* Name of desired tag. */ { Tcl_HashEntry *hPtr; TkSizeT len; const char *str; str = Tcl_GetStringFromObj(tagName, &len); if (len == 3 && !strcmp(str, "sel")) { return textPtr->selTagPtr; } hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable, Tcl_GetString(tagName)); if (hPtr != NULL) { return (TkTextTag *)Tcl_GetHashValue(hPtr); |
︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 | * Since all peer widgets have an independent "sel" tag, we * don't want removal of one sel tag to remove bindings which * are still valid in other peer widgets. */ if (textPtr->sharedTextPtr->bindingTable != NULL) { Tk_DeleteAllBindings(textPtr->sharedTextPtr->bindingTable, | | | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | * Since all peer widgets have an independent "sel" tag, we * don't want removal of one sel tag to remove bindings which * are still valid in other peer widgets. */ if (textPtr->sharedTextPtr->bindingTable != NULL) { Tk_DeleteAllBindings(textPtr->sharedTextPtr->bindingTable, (void *) tagPtr->name); } } /* * Update the tag priorities to reflect the deletion of this tag. */ |
︙ | ︙ | |||
1477 1478 1479 1480 1481 1482 1483 | if (eventPtr->xmotion.state & ALL_BUTTONS) { textPtr->flags |= BUTTON_DOWN; } else { textPtr->flags &= ~BUTTON_DOWN; } TkTextPickCurrent(textPtr, eventPtr); } | | | > > > > > | > > > > > > > > > > > > > > > | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | if (eventPtr->xmotion.state & ALL_BUTTONS) { textPtr->flags |= BUTTON_DOWN; } else { textPtr->flags &= ~BUTTON_DOWN; } TkTextPickCurrent(textPtr, eventPtr); } if ((textPtr->sharedTextPtr->bindingTable != NULL) && (textPtr->tkwin != NULL) && !(textPtr->flags & DESTROYED)) { if (textPtr->numCurTags > 0) { /* * The mouse is inside the text widget, the 'current' mark was updated. */ TagBindEvent(textPtr, eventPtr, textPtr->numCurTags, textPtr->curTagArrayPtr); } else if ((eventPtr->type == KeyPress) || (eventPtr->type == KeyRelease)) { /* * Key events fire independently of the 'current' mark and use the * 'insert' mark. */ TkTextIndex index; TkTextTag** tagArrayPtr; TkSizeT numTags; TkTextMarkNameToIndex(textPtr, "insert", &index); tagArrayPtr = TkBTreeGetTags(&index, textPtr, &numTags); SortTags(numTags, tagArrayPtr); TagBindEvent(textPtr, eventPtr, numTags, tagArrayPtr); } } if (repick) { unsigned int oldState; oldState = eventPtr->xbutton.state; eventPtr->xbutton.state &= ~(unsigned long)ALL_BUTTONS; if (!(textPtr->flags & DESTROYED)) { |
︙ | ︙ | |||
1536 1537 1538 1539 1540 1541 1542 | * ButtonRelease, or MotionNotify. */ { TkTextIndex index; TkTextTag **oldArrayPtr, **newArrayPtr; TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent compiler * warning. */ | | > | 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | * ButtonRelease, or MotionNotify. */ { TkTextIndex index; TkTextTag **oldArrayPtr, **newArrayPtr; TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent compiler * warning. */ int numOldTags, i, nearby; TkSizeT numNewTags, j; size_t size; XEvent event; /* * If a button is down, then don't do anything at all; we'll be called * again when all buttons are up, and we can repick then. This implements * a form of mouse grabbing. |
︙ | ︙ |
Changes to generic/tkTextWind.c.
1 2 3 4 5 6 7 | /* * tkTextWind.c -- * * This file contains code that allows arbitrary windows to be nested * inside text widgets. It also implements the "window" widget command * for texts. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkTextWind.c -- * * This file contains code that allows arbitrary windows to be nested * inside text widgets. It also implements the "window" widget command * for texts. * * Copyright © 1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkPort.h" #include "tkText.h" |
︙ | ︙ | |||
522 523 524 525 526 527 528 | static void EmbWinStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; | < < < < < | < | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | static void EmbWinStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; Tcl_HashEntry *hPtr; if (eventPtr->type != DestroyNotify) { return; } hPtr = Tcl_FindHashEntry(&ewPtr->body.ew.sharedTextPtr->windowTable, Tk_PathName(client->tkwin)); if (hPtr != NULL) { /* * This may not exist if the entire widget is being deleted. */ Tcl_DeleteHashEntry(hPtr); } ewPtr->body.ew.tkwin = NULL; client->tkwin = NULL; EmbWinRequestProc(client, NULL); } /* *-------------------------------------------------------------- * * EmbWinRequestProc -- * |
︙ | ︙ | |||
570 571 572 573 574 575 576 | * *-------------------------------------------------------------- */ static void EmbWinRequestProc( ClientData clientData, /* Pointer to record for window item. */ | | > > > > > > > > | | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | * *-------------------------------------------------------------- */ static void EmbWinRequestProc( ClientData clientData, /* Pointer to record for window item. */ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; index.tree = ewPtr->body.ew.sharedTextPtr->tree; index.linePtr = ewPtr->body.ew.linePtr; /* * ewPtr->body.ew.tkwin == NULL means the embedded window is already * destroyed. The ewPtr segment is no longer linked, TkTextSegToOffset * cannot find it within the line pointed by ewPtr->body.ew.linePtr. */ index.byteIndex = ewPtr->body.ew.tkwin ? TkTextSegToOffset(ewPtr, ewPtr->body.ew.linePtr) : 0; TkTextChanged(ewPtr->body.ew.sharedTextPtr, NULL, &index, &index); TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL, index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY); } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1316 1317 1318 1319 1320 1321 1322 | * * TkTextWindowIndex -- * * Given the name of an embedded window within a text widget, returns an * index corresponding to the window's position in the text. * * Results: | | | | | | > > > > > > > > > > > | | 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | * * TkTextWindowIndex -- * * Given the name of an embedded window within a text widget, returns an * index corresponding to the window's position in the text. * * Results: * The return value is TCL_OK if there is an embedded window by the given * name in the text widget, TCL_ERROR otherwise. If the window exists, * *indexPtr is filled in with its index. * * Side effects: * None. * *-------------------------------------------------------------- */ int TkTextWindowIndex( TkText *textPtr, /* Text widget containing window. */ const char *name, /* Name of window. */ TkTextIndex *indexPtr) /* Index information gets stored here. */ { Tcl_HashEntry *hPtr; TkTextSegment *ewPtr; if (textPtr == NULL) { return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable, name); if (hPtr == NULL) { return TCL_ERROR; } ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = ewPtr->body.ew.linePtr; indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr); /* * If indexPtr refers to somewhere outside the -startline/-endline * range limits of the widget, error out since the window indeed is not * reachable from this text widget (it may be reachable from a peer). */ if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) { return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- * * EmbWinGetClient -- * |
︙ | ︙ |
Changes to generic/tkTrig.c.
1 2 3 4 5 6 7 | /* * tkTrig.c -- * * This file contains a collection of trigonometry utility routines that * are used by Tk and in particular by the canvas code. It also has * miscellaneous geometry functions used by canvases. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkTrig.c -- * * This file contains a collection of trigonometry utility routines that * are used by Tk and in particular by the canvas code. It also has * miscellaneous geometry functions used by canvases. * * Copyright © 1992-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" |
︙ | ︙ | |||
35 36 37 38 39 40 41 | * None. * *-------------------------------------------------------------- */ double TkLineToPoint( | | | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | * None. * *-------------------------------------------------------------- */ double TkLineToPoint( double end1Ptr[], /* Coordinates of first end-point of line. */ double end2Ptr[], /* Coordinates of second end-point of line. */ double pointPtr[]) /* Points to coords for point. */ { double x, y; /* * Compute the point on the line that is closest to the point. This must * be done separately for vertical edges, horizontal edges, and other * edges. |
︙ | ︙ | |||
139 140 141 142 143 144 145 | * None. * *-------------------------------------------------------------- */ int TkLineToArea( | | | | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | * None. * *-------------------------------------------------------------- */ int TkLineToArea( double end1Ptr[], /* X and y coordinates for one endpoint of * line. */ double end2Ptr[], /* X and y coordinates for other endpoint of * line. */ double rectPtr[]) /* Points to coords for rectangle, in the * order x1, y1, x2, y2. X1 must be no larger * than x2, and y1 no larger than y2. */ { int inside1, inside2; /* * First check the two points individually to see whether they are inside |
︙ | ︙ | |||
649 650 651 652 653 654 655 | * None. * *-------------------------------------------------------------- */ double TkOvalToPoint( | | | | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | * None. * *-------------------------------------------------------------- */ double TkOvalToPoint( double ovalPtr[], /* Pointer to array of four coordinates (x1, * y1, x2, y2) defining oval's bounding * box. */ double width, /* Width of outline for oval. */ int filled, /* Non-zero means oval should be treated as * filled; zero means only consider * outline. */ double pointPtr[]) /* Coordinates of point. */ { double xDelta, yDelta, scaledDistance, distToOutline, distToCenter; double xDiam, yDiam; /* * Compute the distance between the center of the oval and the point in * question, using a coordinate system where the oval has been transformed |
︙ | ︙ |
Changes to generic/tkUndo.c.
1 2 3 4 5 | /* * tkUndo.c -- * * This module provides the implementation of an undo stack. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUndo.c -- * * This module provides the implementation of an undo stack. * * Copyright © 2002 Ludwig Callewaert. * Copyright © 2003-2004 Vincent Darley. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkUndo.h" |
︙ | ︙ |
Changes to generic/tkUndo.h.
1 2 3 4 5 | /* * tkUndo.h -- * * Declarations shared among the files that implement an undo stack. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkUndo.h -- * * Declarations shared among the files that implement an undo stack. * * Copyright © 2002 Ludwig Callewaert. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKUNDO #define _TKUNDO |
︙ | ︙ |
Changes to generic/tkUtil.c.
1 2 3 4 5 6 | /* * tkUtil.c -- * * This file contains miscellaneous utility functions that are used by * the rest of Tk, such as a function for drawing a focus highlight. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkUtil.c -- * * This file contains miscellaneous utility functions that are used by * the rest of Tk, such as a function for drawing a focus highlight. * * Copyright © 1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
580 581 582 583 584 585 586 | *---------------------------------------------------------------------- * * Tk_DrawFocusHighlight -- * * This function draws a rectangular ring around the outside of a widget * to indicate that it has received the input focus. * | | | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | *---------------------------------------------------------------------- * * Tk_DrawFocusHighlight -- * * This function draws a rectangular ring around the outside of a widget * to indicate that it has received the input focus. * * This function is now deprecated. Use Tk_DrawHighlightBorder instead, * since this function does not handle drawing the Focus ring properly on * the Macintosh - you need to know the background GC as well as the * foreground since the Mac focus ring separated from the widget by a 1 * pixel border. * * Results: * None. |
︙ | ︙ | |||
727 728 729 730 731 732 733 | Tcl_Obj *const objv[], /* Arguments for command. */ double *dblPtr, /* Filled in with argument "moveto" option, if * any. */ int *intPtr) /* Filled in with number of pages or lines to * scroll, if any. */ { TkSizeT length; | | | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | Tcl_Obj *const objv[], /* Arguments for command. */ double *dblPtr, /* Filled in with argument "moveto" option, if * any. */ int *intPtr) /* Filled in with number of pages or lines to * scroll, if any. */ { TkSizeT length; const char *arg = Tcl_GetStringFromObj(objv[2], &length); #define ArgPfxEq(str) \ ((arg[0] == str[0]) && !strncmp(arg, str, length)) if (ArgPfxEq("moveto")) { if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "moveto fraction"); |
︙ | ︙ | |||
755 756 757 758 759 760 761 | return TK_SCROLL_ERROR; } *intPtr = (d >= 0) ? ceil(d) : floor(d); if (dblPtr) { *dblPtr = d; } | | | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | return TK_SCROLL_ERROR; } *intPtr = (d >= 0) ? ceil(d) : floor(d); if (dblPtr) { *dblPtr = d; } arg = Tcl_GetStringFromObj(objv[4], &length); if (ArgPfxEq("pages")) { return TK_SCROLL_PAGES; } else if (ArgPfxEq("units")) { return TK_SCROLL_UNITS; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
816 817 818 819 820 821 822 | switch (anchor) { case TK_ANCHOR_NW: case TK_ANCHOR_W: case TK_ANCHOR_SW: *xPtr = Tk_InternalBorderLeft(tkwin) + padX; break; | | | | < | | > | | | | | < | | > | | | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | switch (anchor) { case TK_ANCHOR_NW: case TK_ANCHOR_W: case TK_ANCHOR_SW: *xPtr = Tk_InternalBorderLeft(tkwin) + padX; break; case TK_ANCHOR_NE: case TK_ANCHOR_E: case TK_ANCHOR_SE: *xPtr = Tk_Width(tkwin) - Tk_InternalBorderRight(tkwin) - padX - innerWidth; break; default: *xPtr = (Tk_Width(tkwin) - innerWidth - Tk_InternalBorderLeft(tkwin) - Tk_InternalBorderRight(tkwin)) / 2 + Tk_InternalBorderLeft(tkwin); break; } /* * Handle the vertical parts. */ switch (anchor) { case TK_ANCHOR_NW: case TK_ANCHOR_N: case TK_ANCHOR_NE: *yPtr = Tk_InternalBorderTop(tkwin) + padY; break; case TK_ANCHOR_SW: case TK_ANCHOR_S: case TK_ANCHOR_SE: *yPtr = Tk_Height(tkwin) - Tk_InternalBorderBottom(tkwin) - padY - innerHeight; break; default: *yPtr = (Tk_Height(tkwin) - innerHeight- Tk_InternalBorderTop(tkwin) - Tk_InternalBorderBottom(tkwin)) / 2 + Tk_InternalBorderTop(tkwin); break; } } /* *--------------------------------------------------------------------------- * |
︙ | ︙ | |||
1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 | event.general.xany.type = VirtualEvent; event.general.xany.serial = NextRequest(Tk_Display(target)); event.general.xany.send_event = False; event.general.xany.window = Tk_WindowId(target); event.general.xany.display = Tk_Display(target); event.virt.name = Tk_GetUid(eventName); event.virt.user_data = detail; Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } | > > | | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 | event.general.xany.type = VirtualEvent; event.general.xany.serial = NextRequest(Tk_Display(target)); event.general.xany.send_event = False; event.general.xany.window = Tk_WindowId(target); event.general.xany.display = Tk_Display(target); event.virt.name = Tk_GetUid(eventName); event.virt.user_data = detail; if (detail) Tcl_IncrRefCount(detail); // Event code will DecrRefCount Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } /* Tcl 8.6 has a different definition of Tcl_UniChar than other Tcl versions for TCL_UTF_MAX > 3 */ #if TCL_UTF_MAX <= (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6)) /* *--------------------------------------------------------------------------- * * TkUtfToUniChar -- * * Almost the same as Tcl_UtfToUniChar but using int instead of Tcl_UniChar. * This function is capable of collapsing a upper/lower surrogate pair to a |
︙ | ︙ | |||
1221 1222 1223 1224 1225 1226 1227 | const char *src, /* The UTF-8 string. */ int *chPtr) /* Filled with the Unicode value represented by * the UTF-8 string. */ { Tcl_UniChar uniChar = 0; size_t len = Tcl_UtfToUniChar(src, &uniChar); | < | < < < < | | | 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 | const char *src, /* The UTF-8 string. */ int *chPtr) /* Filled with the Unicode value represented by * the UTF-8 string. */ { Tcl_UniChar uniChar = 0; size_t len = Tcl_UtfToUniChar(src, &uniChar); if ((uniChar & 0xFC00) == 0xD800) { Tcl_UniChar low = uniChar; /* This can only happen if sizeof(Tcl_UniChar)== 2 and src points * to a character > U+FFFF */ size_t len2 = Tcl_UtfToUniChar(src+len, &low); if ((low & 0xFC00) == 0xDC00) { *chPtr = (((uniChar & 0x3FF) << 10) | (low & 0x3FF)) + 0x10000; return len + len2; } } *chPtr = uniChar; |
︙ | ︙ | |||
1261 1262 1263 1264 1265 1266 1267 | * None. * *--------------------------------------------------------------------------- */ size_t TkUniCharToUtf(int ch, char *buf) { | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | * None. * *--------------------------------------------------------------------------- */ size_t TkUniCharToUtf(int ch, char *buf) { if ((unsigned)(ch - 0x10000) <= 0xFFFFF) { /* Spit out a 4-byte UTF-8 character or 2 x 3-byte UTF-8 characters, depending on Tcl * version and/or TCL_UTF_MAX build value */ int len = Tcl_UniCharToUtf(0xD800 | ((ch - 0x10000) >> 10), buf); return len + Tcl_UniCharToUtf(0xDC00 | (ch & 0x7FF), buf + len); } return Tcl_UniCharToUtf(ch, buf); } #endif /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkVisual.c.
1 2 3 4 5 6 7 | /* * tkVisual.c -- * * This file contains library procedures for allocating and freeing * visuals and colormaps. This code is based on a prototype * implementation by Paul Mackerras. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkVisual.c -- * * This file contains library procedures for allocating and freeing * visuals and colormaps. This code is based on a prototype * implementation by Paul Mackerras. * * Copyright © 1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to generic/tkWindow.c.
1 2 3 4 5 6 7 | /* * tkWindow.c -- * * This file provides basic window-manipulation functions, which are * equivalent to functions in Xlib (and even invoke them) but also * maintain the local Tk_Window structure. * | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * tkWindow.c -- * * This file provides basic window-manipulation functions, which are * equivalent to functions in Xlib (and even invoke them) but also * maintain the local Tk_Window structure. * * Copyright © 1989-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkPort.h" #ifdef _WIN32 #include "tkWinInt.h" #elif !defined(MAC_OSX_TK) #include "tkUnixInt.h" #endif #include "tkUuid.h" /* * Type used to keep track of Window objects that were only partially * deallocated by Tk_DestroyWindow. */ #define HD_CLEANUP 1 |
︙ | ︙ | |||
89 90 91 92 93 94 95 96 | * the C functions that execute them. */ #define ISSAFE 1 #define PASSMAINWINDOW 2 #define WINMACONLY 4 #define USEINITPROC 8 | > | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | * the C functions that execute them. */ #define ISSAFE 1 #define PASSMAINWINDOW 2 #define WINMACONLY 4 #define USEINITPROC 8 #define SAVEUPDATECMD 16 /* better only be one of these! */ typedef int (TkInitProc)(Tcl_Interp *interp, void *clientData); typedef struct { const char *name; /* Name of command. */ Tcl_ObjCmdProc *objProc; /* Command's object- (or string-) based * function, or initProc. */ int flags; } TkCmd; |
︙ | ︙ | |||
122 123 124 125 126 127 128 | {"option", Tk_OptionObjCmd, PASSMAINWINDOW|ISSAFE}, {"pack", Tk_PackObjCmd, PASSMAINWINDOW|ISSAFE}, {"place", Tk_PlaceObjCmd, PASSMAINWINDOW|ISSAFE}, {"raise", Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE}, {"selection", Tk_SelectionObjCmd, PASSMAINWINDOW}, {"tk", (Tcl_ObjCmdProc *)(void *)TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE}, {"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE}, | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | {"option", Tk_OptionObjCmd, PASSMAINWINDOW|ISSAFE}, {"pack", Tk_PackObjCmd, PASSMAINWINDOW|ISSAFE}, {"place", Tk_PlaceObjCmd, PASSMAINWINDOW|ISSAFE}, {"raise", Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE}, {"selection", Tk_SelectionObjCmd, PASSMAINWINDOW}, {"tk", (Tcl_ObjCmdProc *)(void *)TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE}, {"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE}, {"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE|SAVEUPDATECMD}, {"winfo", Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE}, {"wm", Tk_WmObjCmd, PASSMAINWINDOW}, /* * Default widget class commands. */ |
︙ | ︙ | |||
202 203 204 205 206 207 208 | /* * Forward declarations to functions defined later in this file: */ static Tk_Window CreateTopLevelWindow(Tcl_Interp *interp, Tk_Window parent, const char *name, const char *screenName, unsigned int flags); | | | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | /* * Forward declarations to functions defined later in this file: */ static Tk_Window CreateTopLevelWindow(Tcl_Interp *interp, Tk_Window parent, const char *name, const char *screenName, unsigned int flags); static void DeleteWindowsExitProc(void *clientData); static TkDisplay * GetScreen(Tcl_Interp *interp, const char *screenName, int *screenPtr); static int Initialize(Tcl_Interp *interp); static int NameWindow(Tcl_Interp *interp, TkWindow *winPtr, TkWindow *parentPtr, const char *name); static void UnlinkWindow(TkWindow *winPtr); |
︙ | ︙ | |||
330 331 332 333 334 335 336 | Tk_CreateImageType(&tkBitmapImageType); Tk_CreateImageType(&tkPhotoImageType); /* * Create built-in photo image formats. */ | | | | | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | Tk_CreateImageType(&tkBitmapImageType); Tk_CreateImageType(&tkPhotoImageType); /* * Create built-in photo image formats. */ Tk_CreatePhotoImageFormat(&tkImgFmtDefault); Tk_CreatePhotoImageFormatVersion3(&tkImgFmtGIF); Tk_CreatePhotoImageFormatVersion3(&tkImgFmtPNG); Tk_CreatePhotoImageFormat(&tkImgFmtPPM); Tk_CreatePhotoImageFormat(&tkImgFmtSVGnano); } if ((parent != NULL) && (screenName != NULL) && (screenName[0] == '\0')) { dispPtr = ((TkWindow *) parent)->dispPtr; screenId = Tk_ScreenNumber(parent); |
︙ | ︙ | |||
652 653 654 655 656 657 658 | winPtr->dirtyAtts = CWEventMask|CWColormap|CWBitGravity; winPtr->flags = 0; winPtr->handlerList = NULL; winPtr->ximGeneration = 0; winPtr->inputContext = NULL; winPtr->tagPtr = NULL; winPtr->numTags = 0; | | | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | winPtr->dirtyAtts = CWEventMask|CWColormap|CWBitGravity; winPtr->flags = 0; winPtr->handlerList = NULL; winPtr->ximGeneration = 0; winPtr->inputContext = NULL; winPtr->tagPtr = NULL; winPtr->numTags = 0; winPtr->optionLevel = TCL_INDEX_NONE; winPtr->selHandlerList = NULL; winPtr->geomMgrPtr = NULL; winPtr->geomData = NULL; winPtr->geomMgrName = NULL; winPtr->maintainerPtr = NULL; winPtr->reqWidth = winPtr->reqHeight = 1; winPtr->internalBorderLeft = 0; |
︙ | ︙ | |||
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | * with the window and registered for "send" commands under "baseName". * BaseName may be extended with an instance number in the form "#2" if * necessary to make it globally unique. Tk-related commands are bound * into interp. * *---------------------------------------------------------------------- */ Tk_Window TkCreateMainWindow( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ const char *screenName, /* Name of screen on which to create window. * Empty or NULL string means use DISPLAY * environment variable. */ const char *baseName) /* Base name for application; usually of the * form "prog instance". */ { Tk_Window tkwin; int dummy, isSafe; Tcl_HashEntry *hPtr; TkMainInfo *mainPtr; TkWindow *winPtr; const TkCmd *cmdPtr; | > > > > > | > | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | * with the window and registered for "send" commands under "baseName". * BaseName may be extended with an instance number in the form "#2" if * necessary to make it globally unique. Tk-related commands are bound * into interp. * *---------------------------------------------------------------------- */ #ifndef STRINGIFY # define STRINGIFY(x) STRINGIFY1(x) # define STRINGIFY1(x) #x #endif Tk_Window TkCreateMainWindow( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ const char *screenName, /* Name of screen on which to create window. * Empty or NULL string means use DISPLAY * environment variable. */ const char *baseName) /* Base name for application; usually of the * form "prog instance". */ { Tk_Window tkwin; int dummy, isSafe; Tcl_HashEntry *hPtr; TkMainInfo *mainPtr; TkWindow *winPtr; const TkCmd *cmdPtr; void *clientData; Tcl_CmdInfo info; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * Panic if someone updated the TkWindow structure without also updating * the Tk_FakeWin structure (or vice versa). */ |
︙ | ︙ | |||
872 873 874 875 876 877 878 879 880 881 882 883 884 885 | TkStylePkgInit(mainPtr); mainPtr->tlFocusPtr = NULL; mainPtr->displayFocusPtr = NULL; mainPtr->optionRootPtr = NULL; Tcl_InitHashTable(&mainPtr->imageTable, TCL_STRING_KEYS); mainPtr->strictMotif = 0; mainPtr->alwaysShowSelection = 0; if (Tcl_LinkVar(interp, "tk_strictMotif", (char *) &mainPtr->strictMotif, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } if (Tcl_CreateNamespace(interp, "::tk", NULL, NULL) == NULL) { Tcl_ResetResult(interp); } | > > > > | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | TkStylePkgInit(mainPtr); mainPtr->tlFocusPtr = NULL; mainPtr->displayFocusPtr = NULL; mainPtr->optionRootPtr = NULL; Tcl_InitHashTable(&mainPtr->imageTable, TCL_STRING_KEYS); mainPtr->strictMotif = 0; mainPtr->alwaysShowSelection = 0; mainPtr->tclUpdateObjProc = NULL; #if TCL_MAJOR_VERSION > 8 mainPtr->tclUpdateObjProc2 = NULL; #endif if (Tcl_LinkVar(interp, "tk_strictMotif", (char *) &mainPtr->strictMotif, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } if (Tcl_CreateNamespace(interp, "::tk", NULL, NULL) == NULL) { Tcl_ResetResult(interp); } |
︙ | ︙ | |||
911 912 913 914 915 916 917 918 919 920 921 922 | /* * Bind in Tk's commands. */ isSafe = Tcl_IsSafe(interp); for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { if (cmdPtr->objProc == NULL) { Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } #if defined(_WIN32) && !defined(STATIC_BUILD) | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 | /* * Bind in Tk's commands. */ isSafe = Tcl_IsSafe(interp); for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { Tcl_CmdInfo cmdInfo; if (cmdPtr->objProc == NULL) { Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } #if defined(_WIN32) && !defined(STATIC_BUILD) if ((cmdPtr->flags & WINMACONLY) && tclStubsPtr->tcl_CreateFileHandler) { /* * We are running on Cygwin, so don't use the win32 dialogs. */ continue; } #endif /* _WIN32 && !STATIC_BUILD */ if (cmdPtr->flags & PASSMAINWINDOW) { clientData = tkwin; } else { clientData = NULL; } if ((cmdPtr->flags & SAVEUPDATECMD) && Tcl_GetCommandInfo(interp, cmdPtr->name, &cmdInfo) && cmdInfo.isNativeObjectProc && !cmdInfo.deleteProc) { #if TCL_MAJOR_VERSION > 8 if ((cmdInfo.isNativeObjectProc == 2) && !cmdInfo.objClientData2) { mainPtr->tclUpdateObjProc2 = cmdInfo.objProc2; } else #endif if (!cmdInfo.objClientData ) { mainPtr->tclUpdateObjProc = cmdInfo.objProc; } } if (cmdPtr->flags & USEINITPROC) { ((TkInitProc *)(void *)cmdPtr->objProc)(interp, clientData); } else { Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc, clientData, NULL); } if (isSafe && !(cmdPtr->flags & ISSAFE)) { Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name); } } if (Tcl_GetCommandInfo(interp, "::tcl::build-info", &info)) { static const char version[] = TK_PATCH_LEVEL "+" STRINGIFY(TK_VERSION_UUID) #if defined(MAC_OSX_TK) ".aqua" #endif #if defined(__clang__) && defined(__clang_major__) ".clang-" STRINGIFY(__clang_major__) #if __clang_minor__ < 10 "0" #endif STRINGIFY(__clang_minor__) #endif #if defined(__cplusplus) && !defined(__OBJC__) ".cplusplus" #endif #ifndef NDEBUG ".debug" #endif #if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) ".gcc-" STRINGIFY(__GNUC__) #if __GNUC_MINOR__ < 10 "0" #endif STRINGIFY(__GNUC_MINOR__) #endif #ifdef __INTEL_COMPILER ".icc-" STRINGIFY(__INTEL_COMPILER) #endif #ifdef TCL_MEM_DEBUG ".memdebug" #endif #if defined(_MSC_VER) ".msvc-" STRINGIFY(_MSC_VER) #endif #ifdef USE_NMAKE ".nmake" #endif #ifdef TK_NO_DEPRECATED ".no-deprecate" #endif #ifndef TCL_CFG_OPTIMIZED ".no-optimize" #endif #ifdef __OBJC__ ".objective-c" #if defined(__cplusplus) "plusplus" #endif #endif #ifdef TCL_CFG_PROFILED ".profile" #endif #ifdef PURIFY ".purify" #endif #ifdef STATIC_BUILD ".static" #endif #if TCL_UTF_MAX <= (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6)) ".utf-16" #endif #if defined(_WIN32) ".win32" #endif #if !defined(_WIN32) && !defined(MAC_OSX_TK) ".x11" #if !defined(HAVE_XFT) ".no-xft" #endif #endif ; #if TCL_MAJOR_VERSION > 8 if (info.isNativeObjectProc == 2) { Tcl_CreateObjCommand2(interp, "::tk::build-info", info.objProc2, (void *) version, NULL); } else #endif Tcl_CreateObjCommand(interp, "::tk::build-info", info.objProc, (void *) version, NULL); } /* * Set variables for the interpreter. */ Tcl_SetVar2(interp, "tk_patchLevel", NULL, TK_PATCH_LEVEL, TCL_GLOBAL_ONLY); |
︙ | ︙ | |||
1228 1229 1230 1231 1232 1233 1234 | *-------------------------------------------------------------- */ void Tk_DestroyWindow( Tk_Window tkwin) /* Window to destroy. */ { | | | 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 | *-------------------------------------------------------------- */ void Tk_DestroyWindow( Tk_Window tkwin) /* Window to destroy. */ { TkWindow *winPtr = (TkWindow *)tkwin; TkDisplay *dispPtr = winPtr->dispPtr; XEvent event; TkHalfdeadWindow *halfdeadPtr, *prev_halfdeadPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->flags & TK_ALREADY_DEAD) { |
︙ | ︙ | |||
1264 1265 1266 1267 1268 1269 1270 | halfdeadPtr->winPtr = winPtr; halfdeadPtr->nextPtr = tsdPtr->halfdeadWindowList; tsdPtr->halfdeadWindowList = halfdeadPtr; } /* * Some cleanup needs to be done immediately, rather than later, because | | | 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | halfdeadPtr->winPtr = winPtr; halfdeadPtr->nextPtr = tsdPtr->halfdeadWindowList; tsdPtr->halfdeadWindowList = halfdeadPtr; } /* * Some cleanup needs to be done immediately, rather than later, because * it needs information that will be destroyed before we get to the main * cleanup point. For example, TkFocusDeadWindow needs to access the * parentPtr field from a window, but if a Destroy event handler deletes * the window's parent this field will be NULL before the main cleanup * point is reached. */ if (!(halfdeadPtr->flags & HD_FOCUS)) { |
︙ | ︙ | |||
1345 1346 1347 1348 1349 1350 1351 | /* * This is the container for an embedded application, and the embedded * application is also in this process. Delete the embedded window * in-line here, for the same reasons we delete children in-line * (otherwise, for example, the Tk window may appear to exist even * though its X window is gone; this could cause errors). Special * note: it's possible that the embedded window has already been | | | | 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 | /* * This is the container for an embedded application, and the embedded * application is also in this process. Delete the embedded window * in-line here, for the same reasons we delete children in-line * (otherwise, for example, the Tk window may appear to exist even * though its X window is gone; this could cause errors). Special * note: it's possible that the embedded window has already been * deleted, in which case Tk_GetOtherWindow will return NULL. */ TkWindow *childPtr = (TkWindow *)Tk_GetOtherWindow(tkwin); if (childPtr != NULL) { childPtr->flags |= TK_DONT_DESTROY_WINDOW; Tk_DestroyWindow((Tk_Window) childPtr); } } |
︙ | ︙ | |||
1492 1493 1494 1495 1496 1497 1498 | * * NOTE: Only replace the commands it if the interpreter is not * being deleted. If it *is*, the interpreter cleanup will do all * the needed work. */ if ((winPtr->mainPtr->interp != NULL) && | | > > > > > > > > > > > | > > | > > > > > > | 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 | * * NOTE: Only replace the commands it if the interpreter is not * being deleted. If it *is*, the interpreter cleanup will do all * the needed work. */ if ((winPtr->mainPtr->interp != NULL) && !Tcl_InterpDeleted(winPtr->mainPtr->interp)) { for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { if (cmdPtr->flags & SAVEUPDATECMD) { /* Restore Tcl's version of [update] */ #if TCL_MAJOR_VERSION > 8 if (winPtr->mainPtr->tclUpdateObjProc2 != NULL) { Tcl_CreateObjCommand2(winPtr->mainPtr->interp, cmdPtr->name, winPtr->mainPtr->tclUpdateObjProc2, NULL, NULL); } else #endif if (winPtr->mainPtr->tclUpdateObjProc != NULL) { Tcl_CreateObjCommand(winPtr->mainPtr->interp, cmdPtr->name, winPtr->mainPtr->tclUpdateObjProc, NULL, NULL); } } else { Tcl_CreateObjCommand(winPtr->mainPtr->interp, cmdPtr->name, TkDeadAppObjCmd, NULL, NULL); } } Tcl_CreateObjCommand(winPtr->mainPtr->interp, "send", TkDeadAppObjCmd, NULL, NULL); Tcl_UnlinkVar(winPtr->mainPtr->interp, "tk_strictMotif"); Tcl_UnlinkVar(winPtr->mainPtr->interp, "::tk::AlwaysShowSelection"); } |
︙ | ︙ | |||
1638 1639 1640 1641 1642 1643 1644 | event.type = MapNotify; event.xmap.serial = LastKnownRequestProcessed(winPtr->display); event.xmap.send_event = False; event.xmap.display = winPtr->display; event.xmap.event = winPtr->window; event.xmap.window = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; | | | 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 | event.type = MapNotify; event.xmap.serial = LastKnownRequestProcessed(winPtr->display); event.xmap.send_event = False; event.xmap.display = winPtr->display; event.xmap.event = winPtr->window; event.xmap.window = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; Tk_HandleEvent(&event); } /* *-------------------------------------------------------------- * * Tk_MakeWindowExist -- * |
︙ | ︙ | |||
1689 1690 1691 1692 1693 1694 1695 | parent = winPtr->parentPtr->window; } createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc); if (createProc != NULL && parent != None) { winPtr->window = createProc(tkwin, parent, winPtr->instanceData); } else { | | | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | parent = winPtr->parentPtr->window; } createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc); if (createProc != NULL && parent != None) { winPtr->window = createProc(tkwin, parent, winPtr->instanceData); } else { winPtr->window = Tk_MakeWindow(tkwin, parent); } hPtr = Tcl_CreateHashEntry(&winPtr->dispPtr->winTable, (char *) winPtr->window, &isNew); Tcl_SetHashValue(hPtr, winPtr); winPtr->dirtyAtts = 0; winPtr->dirtyChanges = 0; |
︙ | ︙ | |||
1800 1801 1802 1803 1804 1805 1806 | event.type = UnmapNotify; event.xunmap.serial = LastKnownRequestProcessed(winPtr->display); event.xunmap.send_event = False; event.xunmap.display = winPtr->display; event.xunmap.event = winPtr->window; event.xunmap.window = winPtr->window; event.xunmap.from_configure = False; | | | 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 | event.type = UnmapNotify; event.xunmap.serial = LastKnownRequestProcessed(winPtr->display); event.xunmap.send_event = False; event.xunmap.display = winPtr->display; event.xunmap.event = winPtr->window; event.xunmap.window = winPtr->window; event.xunmap.from_configure = False; Tk_HandleEvent(&event); } } void Tk_ConfigureWindow( Tk_Window tkwin, /* Window to re-configure. */ unsigned int valueMask, /* Mask indicating which parts of *valuePtr |
︙ | ︙ | |||
2245 2246 2247 2248 2249 2250 2251 | *---------------------------------------------------------------------- */ void Tk_SetClassProcs( Tk_Window tkwin, /* Token for window to modify. */ const Tk_ClassProcs *procs, /* Class procs structure. */ | | | 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 | *---------------------------------------------------------------------- */ void Tk_SetClassProcs( Tk_Window tkwin, /* Token for window to modify. */ const Tk_ClassProcs *procs, /* Class procs structure. */ void *instanceData) /* Data to be passed to class functions. */ { TkWindow *winPtr = (TkWindow *) tkwin; winPtr->classProcsPtr = procs; winPtr->instanceData = instanceData; } |
︙ | ︙ | |||
2734 2735 2736 2737 2738 2739 2740 | * None. * *---------------------------------------------------------------------- */ static void DeleteWindowsExitProc( | | | 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 | * None. * *---------------------------------------------------------------------- */ static void DeleteWindowsExitProc( void *clientData) /* tsdPtr when handler was created. */ { TkDisplay *dispPtr, *nextPtr; Tcl_Interp *interp; ThreadSpecificData *tsdPtr = (ThreadSpecificData *)clientData; if (tsdPtr == NULL) { return; |
︙ | ︙ | |||
2840 2841 2842 2843 2844 2845 2846 | Tcl_Interp *interp) { WCHAR name[MAX_PATH]; size_t len; void (*tkmainex)(int, char **, Tcl_AppInitProc *, Tcl_Interp *); /* construct "<path>/libtk8.?.dll", from "<path>/tk8?.dll" */ | | | 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 | Tcl_Interp *interp) { WCHAR name[MAX_PATH]; size_t len; void (*tkmainex)(int, char **, Tcl_AppInitProc *, Tcl_Interp *); /* construct "<path>/libtk8.?.dll", from "<path>/tk8?.dll" */ len = GetModuleFileNameW((HINSTANCE)Tk_GetHINSTANCE(), name, MAX_PATH); name[len-2] = '.'; name[len-1] = name[len-5]; wcscpy(name+len, L".dll"); memcpy(name+len-8, L"libtk8", 6 * sizeof(WCHAR)); tkcygwindll = LoadLibraryW(name); if (!tkcygwindll) { |
︙ | ︙ | |||
2997 2998 2999 3000 3001 3002 3003 | * Depends on the initialization scripts that are invoked. * *---------------------------------------------------------------------- */ static int CopyValue( | | < < | 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 | * Depends on the initialization scripts that are invoked. * *---------------------------------------------------------------------- */ static int CopyValue( TCL_UNUSED(void *), Tcl_Obj *objPtr, void *dstPtr) { *(Tcl_Obj **)dstPtr = objPtr; return 1; } static int Initialize( Tcl_Interp *interp) /* Interpreter to initialize. */ |
︙ | ︙ | |||
3146 3147 3148 3149 3150 3151 3152 | * that we used. */ value = Tcl_GetVar2Ex(interp, "argv", NULL, TCL_GLOBAL_ONLY); } if (value) { | | | 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 | * that we used. */ value = Tcl_GetVar2Ex(interp, "argv", NULL, TCL_GLOBAL_ONLY); } if (value) { TkSizeT objc; Tcl_Obj **objv, **rest; Tcl_Obj *parseList = Tcl_NewListObj(1, NULL); Tcl_ListObjAppendElement(NULL, parseList, Tcl_NewObj()); Tcl_IncrRefCount(value); if (TCL_OK != Tcl_ListObjAppendList(interp, parseList, value) || |
︙ | ︙ | |||
3197 3198 3199 3200 3201 3202 3203 | /* * The -class argument is always the ToTitle of the -name */ { TkSizeT numBytes; | | | 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 | /* * The -class argument is always the ToTitle of the -name */ { TkSizeT numBytes; const char *bytes = Tcl_GetStringFromObj(nameObj, &numBytes); classObj = Tcl_NewStringObj(bytes, numBytes); numBytes = Tcl_UtfToTitle(Tcl_GetString(classObj)); Tcl_SetObjLength(classObj, numBytes); } |
︙ | ︙ | |||
3279 3280 3281 3282 3283 3284 3285 | geometryObj = NULL; if (code != TCL_OK) { goto done; } } /* | | > | | > > > | 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 | geometryObj = NULL; if (code != TCL_OK) { goto done; } } /* * Provide "tk" and its stub table. */ #ifndef TK_NO_DEPRECATED Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL, (void *)&tkStubs); #endif code = Tcl_PkgProvideEx(interp, "tk", TK_PATCH_LEVEL, (void *)&tkStubs); if (code != TCL_OK) { goto done; } /* * If we were able to provide ourselves as a package, then set the main * loop function in Tcl to our main loop proc. This will cause tclsh to be |
︙ | ︙ | |||
3377 3378 3379 3380 3381 3382 3383 | const char * Tk_PkgInitStubsCheck( Tcl_Interp *interp, const char * version, int exact) { | | | | | 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 | const char * Tk_PkgInitStubsCheck( Tcl_Interp *interp, const char * version, int exact) { const char *actualVersion = Tcl_PkgRequireEx(interp, "tk", version, 0, NULL); if (exact && actualVersion) { const char *p = version; int count = 0; while (*p) { count += !isdigit(UCHAR(*p++)); } if (count == 1) { if (0 != strncmp(version, actualVersion, strlen(version))) { /* Construct error message */ Tcl_PkgPresentEx(interp, "tk", version, 1, NULL); return NULL; } } else { return Tcl_PkgPresentEx(interp, "tk", version, 1, NULL); } } return actualVersion; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/ttk/ttkButton.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2003, Joe English * * label, button, checkbutton, radiobutton, and menubutton widgets. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" |
︙ | ︙ | |||
20 21 22 23 24 25 26 | { /* * Text element resources: */ Tcl_Obj *textObj; Tcl_Obj *justifyObj; Tcl_Obj *textVariableObj; | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | { /* * Text element resources: */ Tcl_Obj *textObj; Tcl_Obj *justifyObj; Tcl_Obj *textVariableObj; int underline; Tcl_Obj *widthObj; Ttk_TraceHandle *textVariableTrace; Ttk_ImageSpec *imageSpec; /* * Image element resources: |
︙ | ︙ | |||
53 54 55 56 57 58 59 | WidgetCore core; BasePart base; } Base; static const Tk_OptionSpec BaseOptionSpecs[] = { {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", | | | | | < | | | | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | WidgetCore core; BasePart base; } Base; static const Tk_OptionSpec BaseOptionSpecs[] = { {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", offsetof(Base,base.justifyObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Base,base.textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", "", offsetof(Base,base.textVariableObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(Base, base.underline), 0}, /* SB: OPTION_INT, see <<NOTE-NULLOPTIONS>> */ {TK_OPTION_STRING, "-width", "width", "Width", NULL, offsetof(Base,base.widthObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, /* * Image options */ {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, offsetof(Base,base.imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, /* * Compound base/image options */ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", NULL, offsetof(Base,base.compoundObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, ttkCompoundStrings, GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, offsetof(Base,base.paddingObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, /* * Compatibility/legacy options */ {TK_OPTION_STRING, "-state", "state", "State", "normal", offsetof(Base,base.stateObj), TCL_INDEX_NONE, 0,0,STATE_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * Variable trace procedure for -textvariable option: */ |
︙ | ︙ | |||
255 256 257 258 259 260 261 | {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, offsetof(Label,label.borderWidthObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, offsetof(Label,label.reliefObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", | | | | | > | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, offsetof(Label,label.borderWidthObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, offsetof(Label,label.reliefObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "w", offsetof(Label,label.anchorObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", offsetof(Label, label.justifyObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", NULL, offsetof(Label, label.wrapLengthObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED /*SB: SIZE_CHANGED*/ }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static const Ttk_Ensemble LabelCommands[] = { { "cget", TtkWidgetCgetCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; static const WidgetSpec LabelWidgetSpec = { "TLabel", /* className */ sizeof(Label), /* recordSize */ |
︙ | ︙ | |||
326 327 328 329 330 331 332 | */ static const Tk_OptionSpec ButtonOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Button, button.commandObj), TCL_INDEX_NONE, 0,0,0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", "normal", offsetof(Button, button.defaultStateObj), TCL_INDEX_NONE, | | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | */ static const Tk_OptionSpec ButtonOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Button, button.commandObj), TCL_INDEX_NONE, 0,0,0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", "normal", offsetof(Button, button.defaultStateObj), TCL_INDEX_NONE, 0, ttkDefaultStrings, DEFAULTSTATE_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { |
︙ | ︙ | |||
374 375 376 377 378 379 380 381 | if (buttonPtr->core.state & TTK_STATE_DISABLED) { return TCL_OK; } return Tcl_EvalObjEx(interp, buttonPtr->button.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble ButtonCommands[] = { { "configure", TtkWidgetConfigureCommand,0 }, | > | < > | | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | if (buttonPtr->core.state & TTK_STATE_DISABLED) { return TCL_OK; } return Tcl_EvalObjEx(interp, buttonPtr->button.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble ButtonCommands[] = { { "cget", TtkWidgetCgetCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "invoke", ButtonInvokeCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; static const WidgetSpec ButtonWidgetSpec = { "TButton", /* className */ sizeof(Button), /* recordSize */ |
︙ | ︙ | |||
581 582 583 584 585 586 587 588 | return TCL_ERROR; return Tcl_EvalObjEx(interp, checkPtr->checkbutton.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble CheckbuttonCommands[] = { { "configure", TtkWidgetConfigureCommand,0 }, | > | < > | | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | return TCL_ERROR; return Tcl_EvalObjEx(interp, checkPtr->checkbutton.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble CheckbuttonCommands[] = { { "cget", TtkWidgetCgetCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "invoke", CheckbuttonInvokeCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, /* MISSING: select, deselect, toggle */ { 0,0,0 } }; static const WidgetSpec CheckbuttonWidgetSpec = { "TCheckbutton", /* className */ |
︙ | ︙ | |||
757 758 759 760 761 762 763 764 | return TCL_ERROR; return Tcl_EvalObjEx(interp, radioPtr->radiobutton.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble RadiobuttonCommands[] = { { "configure", TtkWidgetConfigureCommand,0 }, | > | < > | | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 | return TCL_ERROR; return Tcl_EvalObjEx(interp, radioPtr->radiobutton.commandObj, TCL_EVAL_GLOBAL); } static const Ttk_Ensemble RadiobuttonCommands[] = { { "cget", TtkWidgetCgetCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "invoke", RadiobuttonInvokeCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, /* MISSING: select, deselect */ { 0,0,0 } }; static const WidgetSpec RadiobuttonWidgetSpec = { "TRadiobutton", /* className */ |
︙ | ︙ | |||
819 820 821 822 823 824 825 | }; static const Tk_OptionSpec MenubuttonOptionSpecs[] = { {TK_OPTION_STRING, "-menu", "menu", "Menu", "", offsetof(Menubutton, menubutton.menuObj), TCL_INDEX_NONE, 0,0,0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", "below", offsetof(Menubutton, menubutton.directionObj), TCL_INDEX_NONE, | | > | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 | }; static const Tk_OptionSpec MenubuttonOptionSpecs[] = { {TK_OPTION_STRING, "-menu", "menu", "Menu", "", offsetof(Menubutton, menubutton.menuObj), TCL_INDEX_NONE, 0,0,0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", "below", offsetof(Menubutton, menubutton.directionObj), TCL_INDEX_NONE, 0, directionStrings, GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static const Ttk_Ensemble MenubuttonCommands[] = { { "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 = { "TMenubutton", /* className */ sizeof(Menubutton), /* recordSize */ |
︙ | ︙ |
Changes to generic/ttk/ttkCache.c.
1 2 3 | /* * Theme engine resource cache. * | | | 1 2 3 4 5 6 7 8 9 10 11 | /* * Theme engine resource cache. * * Copyright © 2004, Joe English * * The problem: * * Tk maintains reference counts for fonts, colors, and images, * and deallocates them when the reference count goes to zero. * With the theme engine, resources are allocated right before * drawing an element and released immediately after. |
︙ | ︙ |
Changes to generic/ttk/ttkClamTheme.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2004 Joe English * * "clam" theme; inspired by the XFCE family of Gnome themes. */ #include "tkInt.h" #include "ttkTheme.h" |
︙ | ︙ |
Changes to generic/ttk/ttkClassicTheme.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2004, Joe English * * "classic" theme; implements the classic Motif-like Tk look. * */ #include "tkInt.h" #include "ttkTheme.h" |
︙ | ︙ |
Changes to generic/ttk/ttkDecls.h.
︙ | ︙ | |||
9 10 11 12 13 14 15 | extern const char *TtkInitializeStubs( Tcl_Interp *, const char *version, int epoch, int revision); #define Ttk_InitStubs(interp) TtkInitializeStubs( \ interp, TTK_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION) #else | > | > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | extern const char *TtkInitializeStubs( Tcl_Interp *, const char *version, int epoch, int revision); #define Ttk_InitStubs(interp) TtkInitializeStubs( \ interp, TTK_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION) #else #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 # define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL) #else # define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL) #endif #endif #if !defined(BUILD_tk) # define TTK_DEPRECATED(msg) TTKAPI TCL_DEPRECATED_API(msg) #elif defined(TK_NO_DEPRECATED) # define TTK_DEPRECATED(msg) MODULE_SCOPE |
︙ | ︙ |
Changes to generic/ttk/ttkDefaultTheme.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2003 Joe English * * Tk alternate theme, intended to match the MSUE and Gtk's (old) default theme */ #include "tkInt.h" #include "ttkTheme.h" |
︙ | ︙ |
Changes to generic/ttk/ttkElements.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2003 Joe English * * Default implementation for themed elements. * */ #include "tkInt.h" #include "ttkTheme.h" |
︙ | ︙ |
Changes to generic/ttk/ttkEntry.c.
1 2 3 | /* * DERIVED FROM: tk/generic/tkEntry.c r1.35. * | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * DERIVED FROM: tk/generic/tkEntry.c r1.35. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2000 Ajuba Solutions. * Copyright © 2002 ActiveState Corporation. * Copyright © 2004 Joe English */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /* |
︙ | ︙ | |||
177 178 179 180 181 182 183 | "normal", offsetof(Entry, entry.stateObj), TCL_INDEX_NONE, 0,0,STATE_CHANGED}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", NULL, offsetof(Entry, entry.textVariableObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", "none", TCL_INDEX_NONE, offsetof(Entry, entry.validate), | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | "normal", offsetof(Entry, entry.stateObj), TCL_INDEX_NONE, 0,0,STATE_CHANGED}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", NULL, offsetof(Entry, entry.textVariableObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", "none", TCL_INDEX_NONE, offsetof(Entry, entry.validate), TK_OPTION_ENUM_VAR, validateStrings, 0}, {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand", NULL, TCL_INDEX_NONE, offsetof(Entry, entry.validateCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_ENTRY_WIDTH, offsetof(Entry, entry.widthObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", |
︙ | ︙ | |||
321 322 323 324 325 326 327 | if ((entryPtr->entry.numChars != 0) || (entryPtr->entry.placeholderObj == NULL)) { entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), entryPtr->entry.displayString, entryPtr->entry.numChars, 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES, &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight); } else { | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | if ((entryPtr->entry.numChars != 0) || (entryPtr->entry.placeholderObj == NULL)) { entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), entryPtr->entry.displayString, entryPtr->entry.numChars, 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES, &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight); } else { text = Tcl_GetStringFromObj(entryPtr->entry.placeholderObj, &length); entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), text, length, 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES, &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight); } } |
︙ | ︙ | |||
1304 1305 1306 1307 1308 1309 1310 | */ if ((*(entryPtr->entry.displayString) == '\0') && (entryPtr->entry.placeholderObj != NULL)) { /* No text displayed, but -placeholder is given */ if (Tcl_GetCharLength(es.placeholderForegroundObj) > 0) { foregroundObj = es.placeholderForegroundObj; } else { | | | | 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 | */ if ((*(entryPtr->entry.displayString) == '\0') && (entryPtr->entry.placeholderObj != NULL)) { /* No text displayed, but -placeholder is given */ if (Tcl_GetCharLength(es.placeholderForegroundObj) > 0) { foregroundObj = es.placeholderForegroundObj; } else { foregroundObj = es.foregroundObj; } /* Use placeholder text width */ leftIndex = 0; (void)Tcl_GetStringFromObj(entryPtr->entry.placeholderObj, &rightIndex); } else { foregroundObj = es.foregroundObj; } gc = EntryGetGC(entryPtr, foregroundObj, clipRegion); if (showSelection) { /* Draw the selected and unselected portions separately. |
︙ | ︙ | |||
1389 1390 1391 1392 1393 1394 1395 | TkSizeT *indexPtr) /* Return value */ { # define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */ TkSizeT length, idx; const char *string; if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->entry.numChars - 1, 1, &idx)) { | > > | | | | | | | 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 | TkSizeT *indexPtr) /* Return value */ { # define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */ TkSizeT length, idx; const char *string; if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->entry.numChars - 1, 1, &idx)) { if (idx == TCL_INDEX_NONE) { idx = 0; } else if (idx > entryPtr->entry.numChars) { idx = entryPtr->entry.numChars; } *indexPtr = idx; return TCL_OK; } string = Tcl_GetStringFromObj(indexObj, &length); if (strncmp(string, "insert", length) == 0) { *indexPtr = entryPtr->entry.insertPos; } else if (strncmp(string, "left", length) == 0) { /* for debugging */ *indexPtr = entryPtr->entry.xscroll.first; } else if (strncmp(string, "right", length) == 0) { /* for debugging */ *indexPtr = entryPtr->entry.xscroll.last; |
︙ | ︙ | |||
1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 | { "icursor", EntryICursorCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "index", EntryIndexCommand,0 }, { "insert", EntryInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "selection", 0,EntrySelectionCommands }, { "state", TtkWidgetStateCommand,0 }, { "validate", EntryValidateCommand,0 }, { "xview", EntryXViewCommand,0 }, { 0,0,0 } }; /*------------------------------------------------------------------------ * +++ Entry widget definition. | > | 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 | { "icursor", EntryICursorCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "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 } }; /*------------------------------------------------------------------------ * +++ Entry widget definition. |
︙ | ︙ | |||
1869 1870 1871 1872 1873 1874 1875 | cbPtr->combobox.currentIndex = currentIndex; Tcl_SetObjResult(interp, TkNewIndexObj(currentIndex)); return TCL_OK; } else if (objc == 3) { TkSizeT idx; if (TCL_OK == TkGetIntForIndex(objv[2], nValues - 1, 0, &idx)) { | | | | 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 | cbPtr->combobox.currentIndex = currentIndex; Tcl_SetObjResult(interp, TkNewIndexObj(currentIndex)); return TCL_OK; } else if (objc == 3) { TkSizeT idx; if (TCL_OK == TkGetIntForIndex(objv[2], nValues - 1, 0, &idx)) { if (idx == TCL_INDEX_NONE || idx >= (TkSizeT)nValues) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "index \"%s\" out of range", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_RANGE", NULL); return TCL_ERROR; } currentIndex = idx; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad index \"%s\"", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_VALUE", NULL); return TCL_ERROR; } cbPtr->combobox.currentIndex = currentIndex; return EntrySetValue((Entry *)recordPtr, Tcl_GetString(values[currentIndex])); |
︙ | ︙ | |||
1909 1910 1911 1912 1913 1914 1915 1916 | { "get", EntryGetCommand,0 }, { "icursor", EntryICursorCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "index", EntryIndexCommand,0 }, { "insert", EntryInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "selection", 0,EntrySelectionCommands }, { "state", TtkWidgetStateCommand,0 }, | > | | 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 | { "get", EntryGetCommand,0 }, { "icursor", EntryICursorCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "index", EntryIndexCommand,0 }, { "insert", EntryInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "selection", 0,EntrySelectionCommands }, { "set", EntrySetCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, { "validate", EntryValidateCommand,0 }, { "xview", EntryXViewCommand,0 }, { 0,0,0 } }; static const WidgetSpec ComboboxWidgetSpec = { "TCombobox", /* className */ |
︙ | ︙ | |||
2021 2022 2023 2024 2025 2026 2027 2028 | { "get", EntryGetCommand,0 }, { "icursor", EntryICursorCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "index", EntryIndexCommand,0 }, { "insert", EntryInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "selection", 0,EntrySelectionCommands }, { "state", TtkWidgetStateCommand,0 }, | > | | 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 | { "get", EntryGetCommand,0 }, { "icursor", EntryICursorCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "index", EntryIndexCommand,0 }, { "insert", EntryInsertCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "selection", 0,EntrySelectionCommands }, { "set", EntrySetCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, { "validate", EntryValidateCommand,0 }, { "xview", EntryXViewCommand,0 }, { 0,0,0 } }; static const WidgetSpec SpinboxWidgetSpec = { "TSpinbox", /* className */ |
︙ | ︙ |
Changes to generic/ttk/ttkFrame.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2004 Joe English * * ttk::frame and ttk::labelframe widgets. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" |
︙ | ︙ | |||
44 45 46 47 48 49 50 51 | 0,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static const Ttk_Ensemble FrameCommands[] = { { "configure", TtkWidgetConfigureCommand,0 }, | > | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 0,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static const Ttk_Ensemble FrameCommands[] = { { "cget", TtkWidgetCgetCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; /* * FrameMargins -- * Compute internal margins for a frame widget. * This includes the -borderWidth, plus any additional -padding. |
︙ | ︙ | |||
230 231 232 233 234 235 236 | /* * Labelframe widget record: */ typedef struct { Tcl_Obj *labelAnchorObj; Tcl_Obj *textObj; | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | /* * Labelframe widget record: */ typedef struct { Tcl_Obj *labelAnchorObj; Tcl_Obj *textObj; int underline; Tk_Window labelWidget; Ttk_Manager *mgr; Ttk_Layout labelLayout; /* Sublayout for label */ Ttk_Box labelParcel; /* Set in layoutProc */ } LabelframePart; |
︙ | ︙ | |||
253 254 255 256 257 258 259 | static const Tk_OptionSpec LabelframeOptionSpecs[] = { {TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor", "nw", offsetof(Labelframe, label.labelAnchorObj),TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Labelframe,label.textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, | | | < | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | static const Tk_OptionSpec LabelframeOptionSpecs[] = { {TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor", "nw", offsetof(Labelframe, label.labelAnchorObj),TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Labelframe,label.textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(Labelframe, label.underline), 0}, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL, TCL_INDEX_NONE, offsetof(Labelframe,label.labelWidget), TK_OPTION_NULL_OK,0,LABELWIDGET_CHANGED|GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(FrameOptionSpecs) }; |
︙ | ︙ |
Changes to generic/ttk/ttkImage.c.
1 2 3 | /* * Image specifications and image element factory. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | /* * Image specifications and image element factory. * * Copyright © 2004 Pat Thoyts <[email protected]> * Copyright © 2004 Joe English * * An imageSpec is a multi-element list; the first element * is the name of the default image to use, the remainder of the * list is a sequence of statespec/imagename options as per * [style map]. */ |
︙ | ︙ | |||
254 255 256 257 258 259 260 | /*------------------------------------------------------------------------ * +++ Image element definition. */ typedef struct { /* ClientData for image elements */ Ttk_ImageSpec *imageSpec; /* Image(s) to use */ int minWidth; /* Minimum width; overrides image width */ | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | /*------------------------------------------------------------------------ * +++ Image element definition. */ typedef struct { /* ClientData for image elements */ Ttk_ImageSpec *imageSpec; /* Image(s) to use */ int minWidth; /* Minimum width; overrides image width */ int minHeight; /* Minimum height; overrides image height */ Ttk_Sticky sticky; /* -stickiness specification */ Ttk_Padding border; /* Fixed border region */ Ttk_Padding padding; /* Internal padding */ #ifdef TILE_07_COMPAT Ttk_ResourceCache cache; /* Resource cache for images */ Ttk_StateMap imageMap; /* State-based lookup table for images */ |
︙ | ︙ |
Changes to generic/ttk/ttkInit.c.
1 | /* | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | /* * Copyright © 2003 Joe English * * Ttk package: initialization routine and miscellaneous utilities. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /* * Legal values for the button -default option. * See also: enum Ttk_ButtonDefaultState. */ const char *const ttkDefaultStrings[] = { "active", "disabled", "normal", NULL }; int Ttk_GetButtonDefaultStateFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_ButtonDefaultState *statePtr) { int state = (int)TTK_BUTTON_DEFAULT_DISABLED; int result = Tcl_GetIndexFromObj(interp, objPtr, ttkDefaultStrings, "default state", 0, &state); *statePtr = (Ttk_ButtonDefaultState)state; return result; } /* * Legal values for the -compound option. * See also: enum Ttk_Compound. */ const char *const ttkCompoundStrings[] = { "none", "text", "image", "center", "top", "bottom", "left", "right", NULL }; int Ttk_GetCompoundFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Compound *compoundPtr) { int compound = (int)TTK_COMPOUND_NONE; int result = Tcl_GetIndexFromObj(interp, objPtr, ttkCompoundStrings, "compound layout", 0, &compound); *compoundPtr = (Ttk_Compound)compound; return result; } /* * Legal values for the -orient option. * See also: enum Ttk_Orient. */ const char *const ttkOrientStrings[] = { "horizontal", "vertical", NULL }; #if !defined(TK_NO_DEPRECATED) && TK_MAJOR_VERSION < 9 int Ttk_GetOrientFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) { *resultPtr = TTK_ORIENT_HORIZONTAL; return Tcl_GetIndexFromObj(interp, objPtr, ttkOrientStrings, "orientation", 0, resultPtr); } #endif int TtkGetOrientFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *resultPtr) { int orient = (int)TTK_ORIENT_HORIZONTAL; int result = Tcl_GetIndexFromObj(interp, objPtr, ttkOrientStrings, "orientation", 0, &orient); *resultPtr = (Ttk_Orient)orient; return result; } /* * Recognized values for the -state compatibility option. * Other options are accepted and interpreted as synonyms for "normal". */ static const char *const ttkStateStrings[] = { "active", "disabled", "normal", "readonly", NULL }; enum { TTK_COMPAT_STATE_ACTIVE, TTK_COMPAT_STATE_DISABLED, TTK_COMPAT_STATE_NORMAL, TTK_COMPAT_STATE_READONLY }; /* TtkCheckStateOption -- * Handle -state compatibility option. * * NOTE: setting -state disabled / -state enabled affects the * widget state, but the internal widget state does *not* affect * the value of the -state option. * This option is present for compatibility only. */ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr) { int stateOption = TTK_COMPAT_STATE_NORMAL; unsigned all = TTK_STATE_DISABLED|TTK_STATE_READONLY|TTK_STATE_ACTIVE; # define SETFLAGS(f) TtkWidgetChangeState(corePtr, f, all^f) Tcl_GetIndexFromObj(NULL, objPtr, ttkStateStrings, "", 0, &stateOption); switch (stateOption) { case TTK_COMPAT_STATE_NORMAL: default: SETFLAGS(0); break; case TTK_COMPAT_STATE_READONLY: SETFLAGS(TTK_STATE_READONLY); |
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 | RegisterElements(interp); RegisterWidgets(interp); RegisterThemes(interp); Ttk_PlatformInit(interp); Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs); return TCL_OK; } /*EOF*/ | > > > | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | RegisterElements(interp); RegisterWidgets(interp); RegisterThemes(interp); Ttk_PlatformInit(interp); #ifndef TK_NO_DEPRECATED Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs); #endif Tcl_PkgProvideEx(interp, "ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs); return TCL_OK; } /*EOF*/ |
Changes to generic/ttk/ttkLabel.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 | Tcl_Obj *fontObj; Tcl_Obj *foregroundObj; Tcl_Obj *underlineObj; Tcl_Obj *widthObj; Tcl_Obj *anchorObj; Tcl_Obj *justifyObj; Tcl_Obj *wrapLengthObj; | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | Tcl_Obj *fontObj; Tcl_Obj *foregroundObj; Tcl_Obj *underlineObj; Tcl_Obj *widthObj; Tcl_Obj *anchorObj; Tcl_Obj *justifyObj; Tcl_Obj *wrapLengthObj; Tcl_Obj *embossedObj; /* * Computed resources: */ Tk_Font tkfont; Tk_TextLayout textLayout; int width; |
︙ | ︙ | |||
49 50 51 52 53 54 55 | static const Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, offsetof(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, offsetof(TextElement,fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, offsetof(TextElement,foregroundObj), "black" }, | | > > > > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | static const Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, offsetof(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, offsetof(TextElement,fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, offsetof(TextElement,foregroundObj), "black" }, { "-underline", TK_OPTION_INDEX, #if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) offsetof(TextElement,underlineObj), "-1"}, #else offsetof(TextElement,underlineObj), NULL}, #endif { "-width", TK_OPTION_INT, offsetof(TextElement,widthObj), "-1"}, { "-anchor", TK_OPTION_ANCHOR, offsetof(TextElement,anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, offsetof(TextElement,justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, |
︙ | ︙ | |||
122 123 124 125 126 127 128 | * TextDraw -- * Draw a text element. * Called by TextElementDraw() and LabelElementDraw(). */ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) { XColor *color = Tk_GetColorFromObj(tkwin, text->foregroundObj); | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | * TextDraw -- * Draw a text element. * Called by TextElementDraw() and LabelElementDraw(). */ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) { XColor *color = Tk_GetColorFromObj(tkwin, text->foregroundObj); TkSizeT underline = TCL_INDEX_NONE; XGCValues gcValues; GC gc1, gc2; Tk_Anchor anchor = TK_ANCHOR_CENTER; TkRegion clipRegion = NULL; gcValues.font = Tk_FontId(text->tkfont); gcValues.foreground = color->pixel; |
︙ | ︙ | |||
166 167 168 169 170 171 172 | if (text->embossed) { Tk_DrawTextLayout(Tk_Display(tkwin), d, gc2, text->textLayout, b.x+1, b.y+1, 0/*firstChar*/, -1/*lastChar*/); } Tk_DrawTextLayout(Tk_Display(tkwin), d, gc1, text->textLayout, b.x, b.y, 0/*firstChar*/, -1/*lastChar*/); | | > | > > > | | | | | | > | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | if (text->embossed) { Tk_DrawTextLayout(Tk_Display(tkwin), d, gc2, text->textLayout, b.x+1, b.y+1, 0/*firstChar*/, -1/*lastChar*/); } Tk_DrawTextLayout(Tk_Display(tkwin), d, gc1, text->textLayout, b.x, b.y, 0/*firstChar*/, -1/*lastChar*/); if (text->underlineObj != NULL) { TkGetIntForIndex(text->underlineObj, TCL_INDEX_END, 0, &underline); if (underline != TCL_INDEX_NONE) { if ((size_t)underline > (size_t)TCL_INDEX_END>>1) { underline++; } if (text->embossed) { Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc2, text->textLayout, b.x+1, b.y+1, underline); } Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc1, text->textLayout, b.x, b.y, underline); } } if (clipRegion != NULL) { #ifdef HAVE_XFT TkUnixSetXftClipRegion(NULL); #endif XSetClipMask(Tk_Display(tkwin), gc1, None); |
︙ | ︙ | |||
459 460 461 462 463 464 465 | */ { "-text", TK_OPTION_STRING, offsetof(LabelElement,text.textObj), "" }, { "-font", TK_OPTION_FONT, offsetof(LabelElement,text.fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, offsetof(LabelElement,text.foregroundObj), "black" }, | | > > > > | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | */ { "-text", TK_OPTION_STRING, offsetof(LabelElement,text.textObj), "" }, { "-font", TK_OPTION_FONT, offsetof(LabelElement,text.fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, offsetof(LabelElement,text.foregroundObj), "black" }, { "-underline", TK_OPTION_INDEX, #if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) offsetof(LabelElement,text.underlineObj), "-1"}, #else offsetof(LabelElement,text.underlineObj), NULL}, #endif { "-width", TK_OPTION_INT, offsetof(LabelElement,text.widthObj), ""}, { "-anchor", TK_OPTION_ANCHOR, offsetof(LabelElement,text.anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, offsetof(LabelElement,text.justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, |
︙ | ︙ |
Changes to generic/ttk/ttkLayout.c.
1 2 3 4 5 | /* * ttkLayout.c -- * * Generic layout processing. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * ttkLayout.c -- * * Generic layout processing. * * Copyright © 2003 Joe English. Freely redistributable. */ #include "tkInt.h" #include "ttkThemeInt.h" #define MAX(a,b) (a > b ? a : b) #define MIN(a,b) (a < b ? a : b) |
︙ | ︙ | |||
216 217 218 219 220 221 222 | case TK_ANCHOR_NE: return TTK_STICK_N | TTK_STICK_E; case TK_ANCHOR_E: return TTK_STICK_E; case TK_ANCHOR_SE: return TTK_STICK_S | TTK_STICK_E; case TK_ANCHOR_S: return TTK_STICK_S; case TK_ANCHOR_SW: return TTK_STICK_S | TTK_STICK_W; case TK_ANCHOR_W: return TTK_STICK_W; case TK_ANCHOR_NW: return TTK_STICK_N | TTK_STICK_W; | | < | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | case TK_ANCHOR_NE: return TTK_STICK_N | TTK_STICK_E; case TK_ANCHOR_E: return TTK_STICK_E; case TK_ANCHOR_SE: return TTK_STICK_S | TTK_STICK_E; case TK_ANCHOR_S: return TTK_STICK_S; case TK_ANCHOR_SW: return TTK_STICK_S | TTK_STICK_W; case TK_ANCHOR_W: return TTK_STICK_W; case TK_ANCHOR_NW: return TTK_STICK_N | TTK_STICK_W; default: return 0; } } /* * Ttk_AnchorBox -- * Place a box of size w * h in the specified parcel, * according to the specified anchor. |
︙ | ︙ | |||
1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | { node->parcel = b; if (node->child) { Ttk_PlaceNodeList(layout, node->child, 0, Ttk_PadBox(b, Ttk_LayoutNodeInternalPadding(layout, node))); } } /* * Ttk_ChangeElementState -- */ void Ttk_ChangeElementState(Ttk_LayoutNode *node,unsigned set,unsigned clr) { node->state = (node->state | set) & ~clr; } /*EOF*/ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 | { node->parcel = b; if (node->child) { Ttk_PlaceNodeList(layout, node->child, 0, Ttk_PadBox(b, Ttk_LayoutNodeInternalPadding(layout, node))); } } /* * AnchorToPosition -- * Convert a Tk_Anchor enum to a position bitmask. */ static Ttk_PositionSpec AnchorToPosition(Tk_Anchor anchor) { switch (anchor) { case TK_ANCHOR_N: return TTK_PACK_TOP; case TK_ANCHOR_S: return TTK_PACK_BOTTOM; case TK_ANCHOR_NE: return TTK_PACK_RIGHT|TTK_STICK_N; case TK_ANCHOR_SE: return TTK_PACK_RIGHT|TTK_STICK_S; case TK_ANCHOR_E: return TTK_PACK_RIGHT; case TK_ANCHOR_NW: return TTK_PACK_LEFT|TTK_STICK_N; case TK_ANCHOR_SW: return TTK_PACK_LEFT|TTK_STICK_S; case TK_ANCHOR_W: return TTK_PACK_LEFT; case TK_ANCHOR_CENTER: return 0; default:; } return TTK_PACK_LEFT; } /* * Ttk_AnchorElement -- * Explicitly specify an element's anchoring. */ void Ttk_AnchorElement(Ttk_Element node, Tk_Anchor anchor) { node->flags = AnchorToPosition(anchor); } /* * Ttk_ChangeElementState -- */ void Ttk_ChangeElementState(Ttk_LayoutNode *node,unsigned set,unsigned clr) { node->state = (node->state | set) & ~clr; } /*EOF*/ |
Changes to generic/ttk/ttkManager.c.
︙ | ︙ | |||
310 311 312 313 314 315 316 | * +++ Tk_GeomMgr hooks. */ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; TkSizeT index = Ttk_ContentIndex(mgr, window); | > > | | < | | < | > | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | * +++ Tk_GeomMgr hooks. */ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; TkSizeT index = Ttk_ContentIndex(mgr, window); if (index != TCL_INDEX_NONE) { int reqWidth = Tk_ReqWidth(window); int reqHeight= Tk_ReqHeight(window); if (mgr->managerSpec->ContentRequest( mgr->managerData, index, reqWidth, reqHeight)) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } } } void Ttk_LostContentProc(ClientData clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; TkSizeT index = Ttk_ContentIndex(mgr, window); /* ASSERT: index != TCL_INDEX_NONE */ RemoveContent(mgr, index); } /*------------------------------------------------------------------------ * +++ Public API. */ |
︙ | ︙ | |||
418 419 420 421 422 423 424 | } /*------------------------------------------------------------------------ * +++ Utility routines. */ /* ++ Ttk_ContentIndex -- | | | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | } /*------------------------------------------------------------------------ * +++ Utility routines. */ /* ++ Ttk_ContentIndex -- * Returns the index of specified content window, TCL_INDEX_NONE if not found. */ TkSizeT Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window) { TkSizeT index; for (index = 0; index < mgr->nContent; ++index) if (mgr->content[index]->window == window) return index; |
︙ | ︙ | |||
448 449 450 451 452 453 454 | const char *string = Tcl_GetString(objPtr); TkSizeT index = 0; Tk_Window tkwin; /* Try interpreting as an integer first: */ if (TkGetIntForIndex(objPtr, mgr->nContent - 1, 1, &index) == TCL_OK) { | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | const char *string = Tcl_GetString(objPtr); TkSizeT index = 0; Tk_Window tkwin; /* Try interpreting as an integer first: */ if (TkGetIntForIndex(objPtr, mgr->nContent - 1, 1, &index) == TCL_OK) { if (index == TCL_INDEX_NONE || index > mgr->nContent) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Managed window index %d out of bounds", (int)index)); Tcl_SetErrorCode(interp, "TTK", "MANAGED", "INDEX", NULL); return TCL_ERROR; } *indexPtr = index; return TCL_OK; |
︙ | ︙ |
Changes to generic/ttk/ttkManager.h.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2005 Joe English. Freely redistributable. * * Geometry manager utilities. */ #ifndef _TTKMANAGER #define _TTKMANAGER |
︙ | ︙ |
Changes to generic/ttk/ttkNotebook.c.
1 | /* | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* * Copyright © 2004 Joe English */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #include "ttkManager.h" #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) /*------------------------------------------------------------------------ * +++ Tab resources. */ #define DEFAULT_MIN_TAB_WIDTH 24 static const char *const TabStateStrings[] = { "disabled", "hidden", "normal", 0 }; typedef enum { TAB_STATE_DISABLED, TAB_STATE_HIDDEN, TAB_STATE_NORMAL } TAB_STATE; typedef struct { /* Internal data: */ int width, height; /* Requested size of tab */ |
︙ | ︙ | |||
40 41 42 43 44 45 46 | Ttk_Sticky sticky; /* Label options: */ Tcl_Obj *textObj; Tcl_Obj *imageObj; Tcl_Obj *compoundObj; | | | | | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | Ttk_Sticky sticky; /* Label options: */ Tcl_Obj *textObj; Tcl_Obj *imageObj; Tcl_Obj *compoundObj; int underline; } Tab; /* Two different option tables are used for tabs: * TabOptionSpecs is used to draw the tab, and only includes resources * relevant to the tab. * * PaneOptionSpecs includes additional options for child window placement * and is used to configure the pane. */ static const Tk_OptionSpec TabOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-state", "", "", "normal", TCL_INDEX_NONE, offsetof(Tab,state), TK_OPTION_ENUM_VAR, TabStateStrings, 0 }, {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Tab,textObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, offsetof(Tab,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", NULL, offsetof(Tab,compoundObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(Tab, underline), GEOMETRY_CHANGED}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 } }; static const Tk_OptionSpec PaneOptionSpecs[] = { {TK_OPTION_STRING, "-padding", "padding", "Padding", "0", offsetof(Tab,paddingObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED }, |
︙ | ︙ | |||
895 896 897 898 899 900 901 | /* $nb add window ?options ... ? */ static int NotebookAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Tk_Window window; | | | | 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | /* $nb add window ?options ... ? */ static int NotebookAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Tk_Window window; TkSizeT index; Tab *tab; if (objc <= 2 || objc % 2 != 1) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?"); return TCL_ERROR; } window = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin); if (!window) { return TCL_ERROR; } index = Ttk_ContentIndex(nb->notebook.mgr, window); if (index == TCL_INDEX_NONE) { /* New tab */ return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), window, objc-3,objv+3); } tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } |
︙ | ︙ | |||
1047 1048 1049 1050 1051 1052 1053 | return TCL_ERROR; } tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); | < | | | > | 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | return TCL_ERROR; } tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); } else { TtkRedisplayWidget(&nb->core); } return TCL_OK; } /* $nb identify $x $y -- * Returns name of tab element at $x,$y; empty string if none. */ static int NotebookIdentifyCommand( |
︙ | ︙ | |||
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | if (element) { const char *elementName = Ttk_ElementName(element); Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1)); } break; case IDENTIFY_TAB: if (tabIndex != TCL_INDEX_NONE) Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex)); break; } return TCL_OK; } /* $nb index $item -- | > > | 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 | if (element) { const char *elementName = Ttk_ElementName(element); Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1)); } break; case IDENTIFY_TAB: #if !defined TK_NO_DEPRECATED && (TCL_MAJOR_VERSION < 9) if (tabIndex != TCL_INDEX_NONE) #endif Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex)); break; } return TCL_OK; } /* $nb index $item -- |
︙ | ︙ | |||
1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 | if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); return TCL_ERROR; } status = FindTabIndex(interp, nb, objv[2], &index); if (status == TCL_OK) { if (index != TCL_INDEX_NONE) Tcl_SetObjResult(interp, TkNewIndexObj(index)); } return status; } /* $nb select ?$item? -- | > > | 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 | if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); return TCL_ERROR; } status = FindTabIndex(interp, nb, objv[2], &index); if (status == TCL_OK) { #if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) if (index != TCL_INDEX_NONE) #endif Tcl_SetObjResult(interp, TkNewIndexObj(index)); } return status; } /* $nb select ?$item? -- |
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | return TCL_OK; } /* Subcommand table: */ static const Ttk_Ensemble NotebookCommands[] = { { "add", NotebookAddCommand,0 }, | < > > | 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | return TCL_OK; } /* Subcommand table: */ static const Ttk_Ensemble NotebookCommands[] = { { "add", NotebookAddCommand,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 } }; /*------------------------------------------------------------------------ * +++ Widget class hooks. |
︙ | ︙ |
Changes to generic/ttk/ttkPanedwindow.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2005 Joe English. Freely redistributable. * * ttk::panedwindow widget implementation. * * TODO: track active/pressed sash. */ #include "tkInt.h" |
︙ | ︙ | |||
73 74 75 76 77 78 79 | } Paned; /* @@@ NOTE: -orient is readonly 'cause dynamic oriention changes NYI */ static const Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", offsetof(Paned,paned.orientObj), offsetof(Paned,paned.orient), | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | } Paned; /* @@@ NOTE: -orient is readonly 'cause dynamic oriention changes NYI */ static const Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", offsetof(Paned,paned.orientObj), offsetof(Paned,paned.orient), 0, ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED }, {TK_OPTION_INT, "-width", "width", "Width", "0", TCL_INDEX_NONE, offsetof(Paned, paned.width), 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", TCL_INDEX_NONE, offsetof(Paned, paned.height), 0, 0, GEOMETRY_CHANGED }, |
︙ | ︙ | |||
878 879 880 881 882 883 884 | Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos)); return TCL_OK; } static const Ttk_Ensemble PanedCommands[] = { { "add", PanedAddCommand,0 }, | < > > | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos)); return TCL_OK; } static const Ttk_Ensemble PanedCommands[] = { { "add", PanedAddCommand,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. */ |
︙ | ︙ |
Changes to generic/ttk/ttkProgress.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © Joe English, Pat Thoyts, Michael Kirkham * * ttk::progressbar widget. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" |
︙ | ︙ | |||
59 60 61 62 63 64 65 | {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", "black", offsetof(Progressbar,progress.foregroundObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", offsetof(Progressbar,progress.justifyObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-length", "length", "Length", | | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", "black", offsetof(Progressbar,progress.foregroundObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", offsetof(Progressbar,progress.justifyObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_PROGRESSBAR_LENGTH, offsetof(Progressbar,progress.lengthObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum", "100", offsetof(Progressbar,progress.maximumObj), TCL_INDEX_NONE, 0, 0, 0 }, {TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate", offsetof(Progressbar,progress.modeObj), offsetof(Progressbar,progress.mode), 0, ProgressbarModeStrings, 0 }, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Progressbar,progress.orientObj), TCL_INDEX_NONE, 0, (void *)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_INT, "-phase", "phase", "Phase", "0", offsetof(Progressbar,progress.phaseObj), TCL_INDEX_NONE, 0, 0, 0 }, {TK_OPTION_STRING, "-text", "text", "Text", "", |
︙ | ︙ | |||
121 122 123 124 125 126 127 | * and reschedules itself if animation still enabled. */ static void AnimateProgressProc(ClientData clientData) { Progressbar *pb = (Progressbar *)clientData; pb->progress.timer = 0; | < > | | > > < | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | * and reschedules itself if animation still enabled. */ static void AnimateProgressProc(ClientData clientData) { Progressbar *pb = (Progressbar *)clientData; pb->progress.timer = 0; if (AnimationEnabled(pb)) { int phase = 0; Tcl_GetIntFromObj(NULL, pb->progress.phaseObj, &phase); /* * Update -phase: */ ++phase; if (phase > pb->progress.maxPhase) { phase = 0; } Tcl_DecrRefCount(pb->progress.phaseObj); pb->progress.phaseObj = Tcl_NewWideIntObj(phase); Tcl_IncrRefCount(pb->progress.phaseObj); /* * Reschedule: */ pb->progress.timer = Tcl_CreateTimerHandler( pb->progress.period, AnimateProgressProc, clientData); TtkRedisplayWidget(&pb->core); } } /* CheckAnimation -- * If animation is enabled and not scheduled, schedule it. * If animation is disabled but scheduled, cancel it. |
︙ | ︙ | |||
514 515 516 517 518 519 520 | Tcl_Obj *const objv[]) { return ProgressbarStartStopCommand( interp, "::ttk::progressbar::stop", objc, objv); } static const Ttk_Ensemble ProgressbarCommands[] = { | < > > | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | Tcl_Obj *const objv[]) { return ProgressbarStartStopCommand( interp, "::ttk::progressbar::stop", objc, objv); } static const Ttk_Ensemble ProgressbarCommands[] = { { "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: */ static const WidgetSpec ProgressbarWidgetSpec = |
︙ | ︙ |
Changes to generic/ttk/ttkScale.c.
1 | /* | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * Copyright © 2004 Pat Thoyts <[email protected]> * * ttk::scale widget. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #define DEF_SCALE_LENGTH "100" #define MAX(a,b) ((a) > (b) ? (a) : (b)) |
︙ | ︙ | |||
57 58 59 60 61 62 63 | offsetof(Scale,scale.commandObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", "", offsetof(Scale,scale.variableObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Scale,scale.orientObj), | | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | offsetof(Scale,scale.commandObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", "", offsetof(Scale,scale.variableObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Scale,scale.orientObj), offsetof(Scale,scale.orient), 0, ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", offsetof(Scale,scale.fromObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", "1.0", offsetof(Scale,scale.toObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0", offsetof(Scale,scale.valueObj), TCL_INDEX_NONE, 0, 0, 0}, |
︙ | ︙ | |||
479 480 481 482 483 484 485 486 | pt.x = troughBox.x + troughBox.width / 2; pt.y = troughBox.y + (int)(fraction * troughBox.height); } return pt; } static const Ttk_Ensemble ScaleCommands[] = { { "configure", TtkWidgetConfigureCommand,0 }, | > > | | < | | | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | pt.x = troughBox.x + troughBox.width / 2; pt.y = troughBox.y + (int)(fraction * troughBox.height); } return pt; } static const Ttk_Ensemble ScaleCommands[] = { { "cget", TtkWidgetCgetCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "coords", ScaleCoordsCommand,0 }, { "get", ScaleGetCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "set", ScaleSetCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; static const WidgetSpec ScaleWidgetSpec = { "TScale", /* Class name */ sizeof(Scale), /* record size */ |
︙ | ︙ |
Changes to generic/ttk/ttkScrollbar.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2003 Joe English * * ttk::scrollbar widget. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" |
︙ | ︙ | |||
35 36 37 38 39 40 41 | { {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Scrollbar, scrollbar.commandObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", offsetof(Scrollbar, scrollbar.orientObj), offsetof(Scrollbar, scrollbar.orient), | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | { {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Scrollbar, scrollbar.commandObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", offsetof(Scrollbar, scrollbar.orientObj), offsetof(Scrollbar, scrollbar.orient), 0, ttkOrientStrings, STYLE_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Widget hooks. |
︙ | ︙ | |||
278 279 280 281 282 283 284 | } Tcl_SetObjResult(interp, Tcl_NewDoubleObj(fraction)); return TCL_OK; } static const Ttk_Ensemble ScrollbarCommands[] = { | < > > | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | } Tcl_SetObjResult(interp, Tcl_NewDoubleObj(fraction)); return TCL_OK; } static const Ttk_Ensemble ScrollbarCommands[] = { { "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. */ static const WidgetSpec ScrollbarWidgetSpec = |
︙ | ︙ |
Changes to generic/ttk/ttkSeparator.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2004 Joe English * * ttk::separator and ttk::sizegrip widgets. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" |
︙ | ︙ | |||
22 23 24 25 26 27 28 | SeparatorPart separator; } Separator; static const Tk_OptionSpec SeparatorOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Separator,separator.orientObj), offsetof(Separator,separator.orient), | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | SeparatorPart separator; } Separator; static const Tk_OptionSpec SeparatorOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Separator,separator.orientObj), offsetof(Separator,separator.orient), 0, ttkOrientStrings, STYLE_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * GetLayout hook -- |
︙ | ︙ | |||
44 45 46 47 48 49 50 | interp, theme, recordPtr, sep->separator.orientObj); } /* * Widget commands: */ static const Ttk_Ensemble SeparatorCommands[] = { | < > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | interp, theme, recordPtr, sep->separator.orientObj); } /* * Widget commands: */ static const Ttk_Ensemble SeparatorCommands[] = { { "cget", TtkWidgetCgetCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { "style", TtkWidgetStyleCommand,0 }, { 0,0,0 } }; /* * Widget specification: */ static const WidgetSpec SeparatorWidgetSpec = |
︙ | ︙ | |||
85 86 87 88 89 90 91 | static const Tk_OptionSpec SizegripOptionSpecs[] = { WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static const Ttk_Ensemble SizegripCommands[] = { | < > > | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | static const Tk_OptionSpec SizegripOptionSpecs[] = { WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static const Ttk_Ensemble SizegripCommands[] = { { "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 = { "TSizegrip", /* className */ sizeof(WidgetCore), /* recordSize */ |
︙ | ︙ |
Changes to generic/ttk/ttkSquare.c.
|
| | | 1 2 3 4 5 6 7 8 | /* square.c - Copyright © 2004 Pat Thoyts <[email protected]> * * Minimal sample ttk widget. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" |
︙ | ︙ | |||
68 69 70 71 72 73 74 | offsetof(Square,square.paddingObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, offsetof(Square,square.reliefObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | offsetof(Square,square.paddingObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, offsetof(Square,square.reliefObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", offsetof(Square,square.anchorObj), TCL_INDEX_NONE, 0, 0, 0}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * Almost all of the widget functionality is handled by the default Ttk |
︙ | ︙ | |||
125 126 127 128 129 130 131 | /* * Widget commands. A widget is impelemented as an ensemble and the * subcommands are listed here. Ttk provides default implementations * that are sufficient for our needs. */ static const Ttk_Ensemble SquareCommands[] = { | < > > | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | /* * Widget commands. A widget is impelemented as an ensemble and the * subcommands are listed here. Ttk provides default implementations * that are sufficient for our needs. */ static const Ttk_Ensemble SquareCommands[] = { { "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 * information about this widget and this is what must be registered * with Tk in the package initialization code (see bottom). |
︙ | ︙ |
Changes to generic/ttk/ttkState.c.
1 2 3 | /* * Tk widget state utilities. * | | | 1 2 3 4 5 6 7 8 9 10 11 | /* * Tk widget state utilities. * * Copyright © 2003 Joe English. Freely redistributable. * */ #include "tkInt.h" #include "ttkTheme.h" /* |
︙ | ︙ |
Changes to generic/ttk/ttkStubLib.c.
︙ | ︙ | |||
30 31 32 33 34 35 36 | * */ MODULE_SCOPE const char * TtkInitializeStubs( Tcl_Interp *interp, const char *version, int epoch, int revision) { int exact = 0; | | | > > > > | | | > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | * */ MODULE_SCOPE const char * TtkInitializeStubs( Tcl_Interp *interp, const char *version, int epoch, int revision) { int exact = 0; const char *packageName = "ttk"; const char *errMsg = NULL; void *pkgClientData = NULL; const char *actualVersion = Tcl_PkgRequireEx( interp, packageName, version, exact, &pkgClientData); const TtkStubs *stubsPtr; if (!actualVersion) { packageName = "Ttk"; actualVersion = Tcl_PkgRequireEx( interp, packageName, version, exact, &pkgClientData); if (!actualVersion) { return NULL; } } stubsPtr = (const TtkStubs *)pkgClientData; if (!stubsPtr) { errMsg = "missing stub table pointer"; goto error; } if (stubsPtr->epoch != epoch) { errMsg = "epoch number mismatch"; goto error; |
︙ | ︙ |
Changes to generic/ttk/ttkTagSet.c.
1 2 3 | /* * Tag tables. 3/4-baked, work in progress. * | | | 1 2 3 4 5 6 7 8 9 10 11 | /* * Tag tables. 3/4-baked, work in progress. * * Copyright © 2005, Joe English. Freely redistributable. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /*------------------------------------------------------------------------ |
︙ | ︙ | |||
136 137 138 139 140 141 142 | if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) { ckfree(tagset); return NULL; } tagset->tags = (Ttk_Tag *)ckalloc((objc+1) * sizeof(Ttk_Tag)); | | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) { ckfree(tagset); return NULL; } tagset->tags = (Ttk_Tag *)ckalloc((objc+1) * sizeof(Ttk_Tag)); for (i = 0; i < objc; ++i) { tagset->tags[i] = Ttk_GetTagFromObj(tagTable, objv[i]); } tagset->tags[i] = NULL; tagset->nTags = objc; return tagset; } |
︙ | ︙ | |||
197 198 199 200 201 202 203 204 205 206 207 208 209 210 | } } tagset->tags = (Ttk_Tag *)ckrealloc(tagset->tags, (tagset->nTags+1)*sizeof(tagset->tags[0])); tagset->tags[tagset->nTags++] = tag; return 1; } /* Ttk_TagSetRemove -- remove a tag from a tag set. * * Returns: 0 if tagset did not contain tag, * 1 if tagset was modified. */ int Ttk_TagSetRemove(Ttk_TagSet tagset, Ttk_Tag tag) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | } } tagset->tags = (Ttk_Tag *)ckrealloc(tagset->tags, (tagset->nTags+1)*sizeof(tagset->tags[0])); tagset->tags[tagset->nTags++] = tag; return 1; } /* Ttk_TagSetAddSet -- add a tag set to a tag set. * * Returns: 0 if tagset already contained tags, * 1 if tagset was modified. */ int Ttk_TagSetAddSet(Ttk_TagSet tagset, Ttk_TagSet tagsetFrom) { int i, j, result = 0, found, total, nTags = tagset->nTags; Ttk_Tag tag; total = tagsetFrom->nTags + tagset->nTags; tagset->tags = (Ttk_Tag *)ckrealloc(tagset->tags, (total)*sizeof(tagset->tags[0])); for (j = 0; j < tagsetFrom->nTags; ++j) { tag = tagsetFrom->tags[j]; found = 0; for (i = 0; i < nTags; ++i) { if (tagset->tags[i] == tag) { found = 1; break; } } if (found) continue; tagset->tags[tagset->nTags++] = tag; result = 1; } return result; } /* Ttk_TagSetRemove -- remove a tag from a tag set. * * Returns: 0 if tagset did not contain tag, * 1 if tagset was modified. */ int Ttk_TagSetRemove(Ttk_TagSet tagset, Ttk_Tag tag) |
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 | } /*------------------------------------------------------------------------ * +++ Tag values. */ #define OBJ_AT(record, offset) (*(Tcl_Obj**)(((char*)record)+offset)) void Ttk_TagSetValues(Ttk_TagTable tagTable, Ttk_TagSet tagSet, void *record) { const int LOWEST_PRIORITY = 0x7FFFFFFF; int i, j; | > > > > > > > > > > > > > < < | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | } /*------------------------------------------------------------------------ * +++ Tag values. */ #define OBJ_AT(record, offset) (*(Tcl_Obj**)(((char*)record)+offset)) void Ttk_TagSetDefaults(Ttk_TagTable tagTable, Ttk_Style style, void *record) { const Tk_OptionSpec *optionSpec = tagTable->optionSpecs; memset(record, 0, tagTable->recordSize); while (optionSpec->type != TK_OPTION_END) { int offset = optionSpec->objOffset; const char *optionName = optionSpec->optionName; OBJ_AT(record, offset) = Ttk_StyleDefault(style, optionName); ++optionSpec; } } void Ttk_TagSetValues(Ttk_TagTable tagTable, Ttk_TagSet tagSet, void *record) { const int LOWEST_PRIORITY = 0x7FFFFFFF; int i, j; for (i = 0; tagTable->optionSpecs[i].type != TK_OPTION_END; ++i) { const Tk_OptionSpec *optionSpec = tagTable->optionSpecs + i; TkSizeT offset = optionSpec->objOffset; int prio = LOWEST_PRIORITY; for (j = 0; j < tagSet->nTags; ++j) { Ttk_Tag tag = tagSet->tags[j]; |
︙ | ︙ | |||
301 302 303 304 305 306 307 | while (optionSpec->type != TK_OPTION_END) { TkSizeT offset = optionSpec->objOffset; const char *optionName = optionSpec->optionName; Tcl_Obj *val = Ttk_StyleMap(style, optionName, state); if (val) { OBJ_AT(record, offset) = val; | < < | 341 342 343 344 345 346 347 348 349 350 351 352 | while (optionSpec->type != TK_OPTION_END) { TkSizeT offset = optionSpec->objOffset; const char *optionName = optionSpec->optionName; Tcl_Obj *val = Ttk_StyleMap(style, optionName, state); if (val) { OBJ_AT(record, offset) = val; } ++optionSpec; } } |
Changes to generic/ttk/ttkTheme.c.
1 2 3 4 5 | /* * ttkTheme.c -- * * This file implements the widget styles and themes support. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * ttkTheme.c -- * * This file implements the widget styles and themes support. * * Copyright © 2002 Frederic Bonnet * Copyright © 2003 Joe English * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "ttkThemeInt.h" |
︙ | ︙ | |||
91 92 93 94 95 96 97 | style = style->parentStyle; } return 0; } /* * Ttk_StyleDefault -- | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | style = style->parentStyle; } return 0; } /* * Ttk_StyleDefault -- * Look up default resource setting in the specified style. */ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName) { while (style) { Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->defaultsTable, optionName); if (entryPtr) |
︙ | ︙ | |||
1258 1259 1260 1261 1262 1263 1264 | Tcl_WrongNumArgs(interp,2,objv,"style ?-option ?value...??"); return TCL_ERROR; } styleName = Tcl_GetString(objv[2]); stylePtr = Ttk_GetStyle(theme, styleName); | | | | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | Tcl_WrongNumArgs(interp,2,objv,"style ?-option ?value...??"); return TCL_ERROR; } styleName = Tcl_GetString(objv[2]); stylePtr = Ttk_GetStyle(theme, styleName); if (objc == 3) { /* style configure $styleName */ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable)); return TCL_OK; } 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)); } return TCL_OK; |
︙ | ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | if (objc < 4 || objc > 6) { Tcl_WrongNumArgs(interp, 2, objv, "style -option ?state? ?default?"); return TCL_ERROR; } style = Ttk_GetStyle(theme, Tcl_GetString(objv[2])); | < < | | 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | if (objc < 4 || objc > 6) { Tcl_WrongNumArgs(interp, 2, objv, "style -option ?state? ?default?"); return TCL_ERROR; } style = Ttk_GetStyle(theme, Tcl_GetString(objv[2])); optionName = Tcl_GetString(objv[3]); if (objc >= 5) { Ttk_StateSpec stateSpec; /* @@@ SB: Ttk_GetStateFromObj(); 'offbits' spec is ignored */ if (Ttk_GetStateSpecFromObj(interp, objv[4], &stateSpec) != TCL_OK) { return TCL_ERROR; |
︙ | ︙ | |||
1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 | return TCL_ERROR; } Ttk_RegisterLayoutTemplate(theme, layoutName, layoutTemplate); ThemeChanged(pkgPtr); } return TCL_OK; } /* + style theme use $theme -- * Sets the current theme to $theme */ static int StyleThemeUseCmd( ClientData clientData, /* StylePackageData pointer */ | > > > > > > > > > > > > > > > > > > > > > > > > > | 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 | return TCL_ERROR; } 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(void *), 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 StyleThemeUseCmd( ClientData clientData, /* StylePackageData pointer */ |
︙ | ︙ | |||
1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 | * Implementation of the [style] command. */ static const Ttk_Ensemble StyleThemeEnsemble[] = { { "create", StyleThemeCreateCmd, 0 }, { "names", StyleThemeNamesCmd, 0 }, { "settings", StyleThemeSettingsCmd, 0 }, { "use", StyleThemeUseCmd, 0 }, { NULL, 0, 0 } }; static const Ttk_Ensemble StyleElementEnsemble[] = { { "create", StyleElementCreateCmd, 0 }, { "names", StyleElementNamesCmd, 0 }, | > | 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 | * Implementation of the [style] command. */ 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[] = { { "create", StyleElementCreateCmd, 0 }, { "names", StyleElementNamesCmd, 0 }, |
︙ | ︙ |
Changes to generic/ttk/ttkTheme.h.
︙ | ︙ | |||
304 305 306 307 308 309 310 311 312 313 314 315 316 317 | MODULE_SCOPE Ttk_Box Ttk_ClientRegion(Ttk_Layout, const char *elementName); MODULE_SCOPE Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout,Ttk_Element); MODULE_SCOPE Ttk_Padding Ttk_LayoutNodeInternalPadding(Ttk_Layout,Ttk_Element); MODULE_SCOPE void Ttk_LayoutNodeReqSize(Ttk_Layout, Ttk_Element, int *w, int *h); MODULE_SCOPE void Ttk_PlaceElement(Ttk_Layout, Ttk_Element, Ttk_Box); MODULE_SCOPE void Ttk_ChangeElementState(Ttk_Element,unsigned set,unsigned clr); MODULE_SCOPE Tcl_Obj *Ttk_QueryOption(Ttk_Layout, const char *, Ttk_State); TTKAPI Ttk_Style Ttk_LayoutStyle(Ttk_Layout); TTKAPI Tcl_Obj *Ttk_StyleDefault(Ttk_Style, const char *optionName); TTKAPI Tcl_Obj *Ttk_StyleMap(Ttk_Style, const char *optionName, Ttk_State); | > | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | MODULE_SCOPE Ttk_Box Ttk_ClientRegion(Ttk_Layout, const char *elementName); MODULE_SCOPE Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout,Ttk_Element); MODULE_SCOPE Ttk_Padding Ttk_LayoutNodeInternalPadding(Ttk_Layout,Ttk_Element); MODULE_SCOPE void Ttk_LayoutNodeReqSize(Ttk_Layout, Ttk_Element, int *w, int *h); MODULE_SCOPE void Ttk_PlaceElement(Ttk_Layout, Ttk_Element, Ttk_Box); MODULE_SCOPE void Ttk_AnchorElement(Ttk_Element node, Tk_Anchor anchor); MODULE_SCOPE void Ttk_ChangeElementState(Ttk_Element,unsigned set,unsigned clr); MODULE_SCOPE Tcl_Obj *Ttk_QueryOption(Ttk_Layout, const char *, Ttk_State); TTKAPI Ttk_Style Ttk_LayoutStyle(Ttk_Layout); TTKAPI Tcl_Obj *Ttk_StyleDefault(Ttk_Style, const char *optionName); TTKAPI Tcl_Obj *Ttk_StyleMap(Ttk_Style, const char *optionName, Ttk_State); |
︙ | ︙ | |||
346 347 348 349 350 351 352 | /*------------------------------------------------------------------------ * +++ Miscellaneous enumerations. * Other stuff that element implementations need to know about. */ typedef enum /* -default option values */ { | < | > | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | /*------------------------------------------------------------------------ * +++ Miscellaneous enumerations. * Other stuff that element implementations need to know about. */ typedef enum /* -default option values */ { TTK_BUTTON_DEFAULT_ACTIVE, /* currently the default widget */ TTK_BUTTON_DEFAULT_DISABLED, /* not defaultable */ TTK_BUTTON_DEFAULT_NORMAL /* widget defaultable */ } Ttk_ButtonDefaultState; TTKAPI int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_ButtonDefaultState *); typedef enum /* -compound option values */ { TTK_COMPOUND_NONE, /* image if specified, otherwise text */ |
︙ | ︙ |
Changes to generic/ttk/ttkTrack.c.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2004, Joe English * * TtkTrackElementState() -- helper routine for widgets * like scrollbars in which individual elements may * be active or pressed instead of the widget as a whole. * * Usage: * TtkTrackElementState(&recordPtr->core); |
︙ | ︙ |
Changes to generic/ttk/ttkTreeview.c.
1 | /* | | | > > > | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* * Copyright © 2004, Joe English * * ttk::treeview widget implementation. */ #include "tkInt.h" #include "ttkThemeInt.h" #include "ttkWidget.h" #define DEF_TREE_ROWS "10" #define DEF_TITLECOLUMNS "0" #define DEF_TITLEITEMS "0" #define DEF_STRIPED "0" #define DEF_COLWIDTH "200" #define DEF_MINWIDTH "20" static const Tk_Anchor DEFAULT_IMAGEANCHOR = TK_ANCHOR_W; static const int DEFAULT_INDENT = 20; static const int HALO = 4; /* heading separator */ #define TTK_STATE_OPEN TTK_STATE_USER1 #define TTK_STATE_LEAF TTK_STATE_USER2 #define STATE_CHANGED (0x100) /* item state option changed */ #define MAX(a,b) (((a) > (b)) ? (a) : (b)) /*------------------------------------------------------------------------ * +++ Tree items. * * INVARIANTS: * item->children ==> item->children->parent == item * item->next ==> item->next->parent == item->parent |
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | */ Ttk_State state; Tcl_Obj *textObj; Tcl_Obj *imageObj; Tcl_Obj *valuesObj; Tcl_Obj *openObj; Tcl_Obj *tagsObj; /* * Derived resources: */ Ttk_TagSet tagset; Ttk_ImageSpec *imagespec; }; #define ITEM_OPTION_TAGS_CHANGED 0x100 #define ITEM_OPTION_IMAGE_CHANGED 0x200 static const Tk_OptionSpec ItemOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(TreeItem,textObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", NULL, offsetof(TreeItem,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,ITEM_OPTION_IMAGE_CHANGED }, {TK_OPTION_STRING, "-values", "values", "Values", NULL, offsetof(TreeItem,valuesObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_BOOLEAN, "-open", "open", "Open", "0", offsetof(TreeItem,openObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_STRING, "-tags", "tags", "Tags", NULL, offsetof(TreeItem,tagsObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,ITEM_OPTION_TAGS_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0,0,0} }; | > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | */ Ttk_State state; Tcl_Obj *textObj; Tcl_Obj *imageObj; Tcl_Obj *valuesObj; Tcl_Obj *openObj; Tcl_Obj *tagsObj; Tcl_Obj *selObj; Tcl_Obj *imageAnchorObj; int hidden; int height; /* Height is in number of row heights */ Ttk_TagSet *cellTagSets; TkSizeT nTagSets; /* * Derived resources: */ Ttk_TagSet tagset; Ttk_ImageSpec *imagespec; int itemPos; /* Counting items */ int visiblePos; /* Counting visible items */ int rowPos; /* Counting rows (visible physical space) */ }; #define ITEM_OPTION_TAGS_CHANGED 0x100 #define ITEM_OPTION_IMAGE_CHANGED 0x200 static const Tk_OptionSpec ItemOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(TreeItem,textObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_INT, "-height", "height", "Height", "1", TCL_INDEX_NONE, offsetof(TreeItem,height), 0,0,0 }, {TK_OPTION_BOOLEAN, "-hidden", "hidden", "Hidden", "0", TCL_INDEX_NONE, offsetof(TreeItem,hidden), 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", NULL, offsetof(TreeItem,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,ITEM_OPTION_IMAGE_CHANGED }, {TK_OPTION_ANCHOR, "-imageanchor", "imageAnchor", "ImageAnchor", NULL, offsetof(TreeItem,imageAnchorObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-values", "values", "Values", NULL, offsetof(TreeItem,valuesObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_BOOLEAN, "-open", "open", "Open", "0", offsetof(TreeItem,openObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_STRING, "-tags", "tags", "Tags", NULL, offsetof(TreeItem,tagsObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,ITEM_OPTION_TAGS_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0,0,0} }; /* Forward declarations */ static void RemoveTag(TreeItem *, Ttk_Tag); static void RemoveTagFromCellsAtItem(TreeItem *, Ttk_Tag); /* + NewItem -- * Allocate a new, uninitialized, unlinked item */ static TreeItem *NewItem(void) { TreeItem *item = (TreeItem *)ckalloc(sizeof(*item)); item->entryPtr = 0; item->parent = item->children = item->next = item->prev = NULL; item->state = 0ul; item->textObj = NULL; item->imageObj = NULL; item->valuesObj = NULL; item->openObj = NULL; item->tagsObj = NULL; item->selObj = NULL; item->imageAnchorObj = NULL; item->hidden = 0; item->height = 1; item->cellTagSets = NULL; item->nTagSets = 0; item->tagset = NULL; item->imagespec = NULL; return item; } /* + FreeItem -- * Destroy an item */ static void FreeItem(TreeItem *item) { TkSizeT i; if (item->textObj) { Tcl_DecrRefCount(item->textObj); } if (item->imageObj) { Tcl_DecrRefCount(item->imageObj); } if (item->valuesObj) { Tcl_DecrRefCount(item->valuesObj); } if (item->openObj) { Tcl_DecrRefCount(item->openObj); } if (item->tagsObj) { Tcl_DecrRefCount(item->tagsObj); } if (item->selObj) { Tcl_DecrRefCount(item->selObj); } if (item->imageAnchorObj) { Tcl_DecrRefCount(item->imageAnchorObj); } if (item->tagset) { Ttk_FreeTagSet(item->tagset); } if (item->imagespec) { TtkFreeImageSpec(item->imagespec); } if (item->cellTagSets) { for (i = 0; i < item->nTagSets; ++i) { if (item->cellTagSets[i] != NULL) { Ttk_FreeTagSet(item->cellTagSets[i]); } } ckfree(item->cellTagSets); } ckfree(item); } static void FreeItemCB(void *clientData) { FreeItem((TreeItem *)clientData); } /* + DetachItem -- |
︙ | ︙ | |||
179 180 181 182 183 184 185 | /*------------------------------------------------------------------------ * +++ Display items and tag options. */ typedef struct { Tcl_Obj *textObj; /* taken from item / data cell */ | | > > > | > > > > > > | | | > > > > > > > > > > > | | > > | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | /*------------------------------------------------------------------------ * +++ Display items and tag options. */ typedef struct { Tcl_Obj *textObj; /* taken from item / data cell */ Tcl_Obj *imageObj; /* taken from item or tag*/ Tcl_Obj *imageAnchorObj; /* taken from item or tag */ Tcl_Obj *anchorObj; /* from column <<NOTE-ANCHOR>> */ Tcl_Obj *backgroundObj; /* remainder from tag */ Tcl_Obj *stripedBgObj; Tcl_Obj *foregroundObj; Tcl_Obj *fontObj; Tcl_Obj *paddingObj; } DisplayItem; static const Tk_OptionSpec DisplayOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", NULL, offsetof(DisplayItem,textObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", offsetof(DisplayItem,anchorObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED}, /* <<NOTE-ANCHOR>> */ /* From here down are the tags options. The index in TagOptionSpecs * below should be kept in synch with this position. */ {TK_OPTION_STRING, "-image", "image", "Image", NULL, offsetof(DisplayItem,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_ANCHOR, "-imageanchor", "imageAnchor", "ImageAnchor", NULL, offsetof(DisplayItem,imageAnchorObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor", NULL, offsetof(DisplayItem,backgroundObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_COLOR, "-stripedbackground", "windowColor", "WindowColor", NULL, offsetof(DisplayItem,stripedBgObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", NULL, offsetof(DisplayItem,foregroundObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", NULL, offsetof(DisplayItem,fontObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, offsetof(DisplayItem,paddingObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, TCL_INDEX_NONE,TCL_INDEX_NONE, 0,0,0} }; static const Tk_OptionSpec *TagOptionSpecs = &DisplayOptionSpecs[2]; /*------------------------------------------------------------------------ * +++ Columns. * * There are separate option tables associated with the column record: * ColumnOptionSpecs is for configuring the column, * and HeadingOptionSpecs is for drawing headings. */ typedef struct { int width; /* Column width, in pixels */ int minWidth; /* Minimum column width, in pixels */ int stretch; /* Should column stretch while resizing? */ int separator; /* Should this column have a separator? */ Tcl_Obj *idObj; /* Column identifier, from -columns option */ Tcl_Obj *anchorObj; /* -anchor for cell data <<NOTE-ANCHOR>> */ /* Column heading data: */ Tcl_Obj *headingObj; /* Heading label */ Tcl_Obj *headingImageObj; /* Heading image */ Tcl_Obj *headingAnchorObj; /* -anchor for heading label */ Tcl_Obj *headingCommandObj; /* Command to execute */ Tcl_Obj *headingStateObj; /* @@@ testing ... */ Ttk_State headingState; /* ... */ /* Temporary storage for cell data */ Tcl_Obj *data; int selected; Ttk_TagSet tagset; } TreeColumn; static void InitColumn(TreeColumn *column) { column->width = atoi(DEF_COLWIDTH); column->minWidth = atoi(DEF_MINWIDTH); column->stretch = 1; column->separator = 0; column->idObj = 0; column->anchorObj = 0; column->headingState = 0; column->headingObj = 0; column->headingImageObj = 0; column->headingAnchorObj = 0; column->headingStateObj = 0; column->headingCommandObj = 0; column->data = 0; column->tagset = NULL; } static void FreeColumn(TreeColumn *column) { if (column->idObj) { Tcl_DecrRefCount(column->idObj); } if (column->anchorObj) { Tcl_DecrRefCount(column->anchorObj); } |
︙ | ︙ | |||
276 277 278 279 280 281 282 283 284 285 286 287 288 289 | static const Tk_OptionSpec ColumnOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", DEF_COLWIDTH, TCL_INDEX_NONE, offsetof(TreeColumn,width), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-minwidth", "minWidth", "MinWidth", DEF_MINWIDTH, TCL_INDEX_NONE, offsetof(TreeColumn,minWidth), 0,0,0 }, {TK_OPTION_BOOLEAN, "-stretch", "stretch", "Stretch", "1", TCL_INDEX_NONE, offsetof(TreeColumn,stretch), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "w", offsetof(TreeColumn,anchorObj), TCL_INDEX_NONE, /* <<NOTE-ANCHOR>> */ 0,0,0 }, | > > > | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | static const Tk_OptionSpec ColumnOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", DEF_COLWIDTH, TCL_INDEX_NONE, offsetof(TreeColumn,width), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-minwidth", "minWidth", "MinWidth", DEF_MINWIDTH, TCL_INDEX_NONE, offsetof(TreeColumn,minWidth), 0,0,0 }, {TK_OPTION_BOOLEAN, "-separator", "separator", "Separator", "0", TCL_INDEX_NONE, offsetof(TreeColumn,separator), 0,0,0 }, {TK_OPTION_BOOLEAN, "-stretch", "stretch", "Stretch", "1", TCL_INDEX_NONE, offsetof(TreeColumn,stretch), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "w", offsetof(TreeColumn,anchorObj), TCL_INDEX_NONE, /* <<NOTE-ANCHOR>> */ 0,0,0 }, |
︙ | ︙ | |||
364 365 366 367 368 369 370 | */ typedef struct { /* Resources acquired at initialization-time: */ Tk_OptionTable itemOptionTable; Tk_OptionTable columnOptionTable; Tk_OptionTable headingOptionTable; | | > > | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | */ typedef struct { /* Resources acquired at initialization-time: */ Tk_OptionTable itemOptionTable; Tk_OptionTable columnOptionTable; Tk_OptionTable headingOptionTable; Tk_OptionTable displayOptionTable; Tk_BindingTable bindingTable; Ttk_TagTable tagTable; /* Acquired in GetLayout hook: */ Ttk_Layout itemLayout; Ttk_Layout cellLayout; Ttk_Layout headingLayout; Ttk_Layout rowLayout; Ttk_Layout separatorLayout; int headingHeight; /* Space for headings */ int rowHeight; /* Height of each item */ int colSeparatorWidth; /* Width of column separator, if used */ int indent; /* #pixels horizontal offset for child items */ /* Tree data: */ Tcl_HashTable items; /* Map: item name -> item */ int serial; /* Next item # for autogenerated names */ TreeItem *root; /* Root item */ |
︙ | ︙ | |||
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | /* Widget options: */ Tcl_Obj *columnsObj; /* List of symbolic column names */ Tcl_Obj *displayColumnsObj; /* List of columns to display */ Tcl_Obj *heightObj; /* height (rows) */ Tcl_Obj *paddingObj; /* internal padding */ Tcl_Obj *showObj; /* -show list */ Tcl_Obj *selectModeObj; /* -selectmode option */ Scrollable xscroll; ScrollHandle xscrollHandle; Scrollable yscroll; ScrollHandle yscrollHandle; /* Derived resources: */ Tcl_HashTable columnNames; /* Map: column name -> column table entry */ | > > > > | < | | > > > | > | > > > > > > > > > > > > | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | /* Widget options: */ Tcl_Obj *columnsObj; /* List of symbolic column names */ Tcl_Obj *displayColumnsObj; /* List of columns to display */ Tcl_Obj *heightObj; /* height (rows) */ Tcl_Obj *paddingObj; /* internal padding */ int nTitleColumns; /* -titlecolumns */ int nTitleItems; /* -titleitems */ int striped; /* -striped option */ Tcl_Obj *showObj; /* -show list */ Tcl_Obj *selectModeObj; /* -selectmode option */ Tcl_Obj *selectTypeObj; /* -selecttype option */ Scrollable xscroll; ScrollHandle xscrollHandle; Scrollable yscroll; ScrollHandle yscrollHandle; /* Derived resources: */ Tcl_HashTable columnNames; /* Map: column name -> column table entry */ TkSizeT nColumns; /* #columns */ TkSizeT nDisplayColumns; /* #display columns */ TreeColumn **displayColumns; /* List of columns for display (incl tree) */ int titleWidth; /* Width of non-scrolled columns */ int titleRows; /* Height of non-scrolled items, in rows */ int totalRows; /* Height of non-hidden items, in rows */ int rowPosNeedsUpdate; /* Internal rowPos data needs update */ Ttk_Box headingArea; /* Display area for column headings */ Ttk_Box treeArea; /* Display area for tree */ int slack; /* Slack space (see Resizing section) */ unsigned showFlags; /* bitmask of subparts to display */ } TreePart; typedef struct { WidgetCore core; TreePart tree; } Treeview; #define USER_MASK 0x0100 #define COLUMNS_CHANGED (USER_MASK) #define DCOLUMNS_CHANGED (USER_MASK<<1) #define SCROLLCMD_CHANGED (USER_MASK<<2) #define SHOW_CHANGED (USER_MASK<<3) static const char *const SelectModeStrings[] = { "none", "browse", "extended", NULL }; static const char *const SelectTypeStrings[] = { "item", "cell", NULL }; static const Tk_OptionSpec TreeviewOptionSpecs[] = { {TK_OPTION_STRING, "-columns", "columns", "Columns", "", offsetof(Treeview,tree.columnsObj), TCL_INDEX_NONE, 0, 0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ }, {TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns", "#all", offsetof(Treeview,tree.displayColumnsObj), TCL_INDEX_NONE, 0, 0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-show", "show", "Show", DEFAULT_SHOW, offsetof(Treeview,tree.showObj), TCL_INDEX_NONE, 0, 0,SHOW_CHANGED | GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode", "extended", offsetof(Treeview,tree.selectModeObj), TCL_INDEX_NONE, 0, SelectModeStrings, 0 }, {TK_OPTION_STRING_TABLE, "-selecttype", "selectType", "SelectType", "item", offsetof(Treeview,tree.selectTypeObj), TCL_INDEX_NONE, 0, SelectTypeStrings, 0 }, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_TREE_ROWS, offsetof(Treeview,tree.heightObj), TCL_INDEX_NONE, 0, 0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, offsetof(Treeview,tree.paddingObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-titlecolumns", "titlecolumns", "Titlecolumns", DEF_TITLECOLUMNS, TCL_INDEX_NONE, offsetof(Treeview,tree.nTitleColumns), 0,0,GEOMETRY_CHANGED}, {TK_OPTION_INT, "-titleitems", "titleitems", "Titleitems", DEF_TITLEITEMS, TCL_INDEX_NONE, offsetof(Treeview,tree.nTitleItems), 0,0,GEOMETRY_CHANGED}, {TK_OPTION_BOOLEAN, "-striped", "striped", "Striped", DEF_STRIPED, TCL_INDEX_NONE, offsetof(Treeview,tree.striped), 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", NULL, TCL_INDEX_NONE, offsetof(Treeview, tree.xscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", NULL, TCL_INDEX_NONE, offsetof(Treeview, tree.yscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, |
︙ | ︙ | |||
481 482 483 484 485 486 487 488 489 490 491 492 493 494 | Tcl_HashSearch search; Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { func(Tcl_GetHashValue(entryPtr)); entryPtr = Tcl_NextHashEntry(&search); } } /* + unshareObj(objPtr) -- * Ensure that a Tcl_Obj * has refcount 1 -- either return objPtr * itself, or a duplicated copy. */ static Tcl_Obj *unshareObj(Tcl_Obj *objPtr) { | > > > > > > > > > > > > > > | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | Tcl_HashSearch search; Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { func(Tcl_GetHashValue(entryPtr)); entryPtr = Tcl_NextHashEntry(&search); } } static int CellSelectionClear(Treeview *tv) { TreeItem *item; int anyChange = 0; for (item=tv->tree.root; item; item = NextPreorder(item)) { if (item->selObj != NULL) { Tcl_DecrRefCount(item->selObj); item->selObj = NULL; anyChange = 1; } } return anyChange; } /* + unshareObj(objPtr) -- * Ensure that a Tcl_Obj * has refcount 1 -- either return objPtr * itself, or a duplicated copy. */ static Tcl_Obj *unshareObj(Tcl_Obj *objPtr) { |
︙ | ︙ | |||
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | static void DisplayLayout( Ttk_Layout layout, void *recordPtr, Ttk_State state, Ttk_Box b, Drawable d) { Ttk_RebindSublayout(layout, recordPtr); Ttk_PlaceLayout(layout, state, b); Ttk_DrawLayout(layout, state, d); } /* + GetColumn -- * Look up column by name or number. * Returns: pointer to column table entry, NULL if not found. * Leaves an error message in interp->result on error. */ static TreeColumn *GetColumn( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj) { Tcl_HashEntry *entryPtr; | > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | static void DisplayLayout( Ttk_Layout layout, void *recordPtr, Ttk_State state, Ttk_Box b, Drawable d) { Ttk_RebindSublayout(layout, recordPtr); Ttk_PlaceLayout(layout, state, b); Ttk_DrawLayout(layout, state, d); } /* DisplayLayoutTree -- * Like DisplayLayout, but for the tree column. */ static void DisplayLayoutTree( Tk_Anchor imageAnchor, Tk_Anchor textAnchor, Ttk_Layout layout, void *recordPtr, Ttk_State state, Ttk_Box b, Drawable d) { Ttk_Element elem; Ttk_RebindSublayout(layout, recordPtr); elem = Ttk_FindElement(layout, "image"); if (elem != NULL) { Ttk_AnchorElement(elem, imageAnchor); } elem = Ttk_FindElement(layout, "text"); if (elem != NULL) { Ttk_AnchorElement(elem, textAnchor); } elem = Ttk_FindElement(layout, "focus"); if (elem != NULL) { Ttk_AnchorElement(elem, textAnchor); } Ttk_PlaceLayout(layout, state, b); Ttk_DrawLayout(layout, state, d); } /* + GetColumn -- * Look up column by name or number. * Returns: pointer to column table entry, NULL if not found. * Leaves an error message in interp->result on error. */ static TreeColumn *GetColumn( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj) { Tcl_HashEntry *entryPtr; TkSizeT columnIndex; /* Check for named column: */ entryPtr = Tcl_FindHashEntry( &tv->tree.columnNames, Tcl_GetString(columnIDObj)); if (entryPtr) { return (TreeColumn *)Tcl_GetHashValue(entryPtr); } /* Check for index: */ if (TkGetIntForIndex(columnIDObj, tv->tree.nColumns - 1, 1, &columnIndex) == TCL_OK) { if (columnIndex == TCL_INDEX_NONE || columnIndex >= tv->tree.nColumns) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Column index \"%s\" out of bounds", Tcl_GetString(columnIDObj))); Tcl_SetErrorCode(interp, "TTK", "TREE", "COLBOUND", NULL); return NULL; } return tv->tree.columns + columnIndex; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Invalid column index %s", Tcl_GetString(columnIDObj))); Tcl_SetErrorCode(interp, "TTK", "TREE", "COLUMN", NULL); return NULL; } /* + FindColumn -- * Look up column by name, number, or display index. */ static TreeColumn *FindColumn( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj) { TkSizeT colno; if (sscanf(Tcl_GetString(columnIDObj), "#%" TKSIZET_MODIFIER "d", &colno) == 1) { /* Display column specification, #n */ if (colno != TCL_INDEX_NONE && (TkSizeT)colno < tv->tree.nDisplayColumns) { return tv->tree.displayColumns[colno]; } /* else */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Column %s out of range", Tcl_GetString(columnIDObj))); Tcl_SetErrorCode(interp, "TTK", "TREE", "COLUMN", NULL); return NULL; |
︙ | ︙ | |||
600 601 602 603 604 605 606 | */ static TreeItem **GetItemListFromObj( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *objPtr) { TreeItem **items; Tcl_Obj **elements; | | | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | */ static TreeItem **GetItemListFromObj( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *objPtr) { TreeItem **items; Tcl_Obj **elements; TkSizeT i, nElements; if (Tcl_ListObjGetElements(interp,objPtr,&nElements,&elements) != TCL_OK) { return NULL; } items = (TreeItem **)ckalloc((nElements + 1)*sizeof(TreeItem*)); for (i = 0; i < nElements; ++i) { |
︙ | ︙ | |||
644 645 646 647 648 649 650 | */ /* + TreeviewFreeColumns -- * Free column data. */ static void TreeviewFreeColumns(Treeview *tv) { | | | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | */ /* + TreeviewFreeColumns -- * Free column data. */ static void TreeviewFreeColumns(Treeview *tv) { TkSizeT i; Tcl_DeleteHashTable(&tv->tree.columnNames); Tcl_InitHashTable(&tv->tree.columnNames, TCL_STRING_KEYS); if (tv->tree.columns) { for (i = 0; i < tv->tree.nColumns; ++i) FreeColumn(tv->tree.columns + i); |
︙ | ︙ | |||
693 694 695 696 697 698 699 | Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry( &tv->tree.columnNames, Tcl_GetString(columnName), &isNew); Tcl_SetHashValue(entryPtr, tv->tree.columns + i); InitColumn(tv->tree.columns + i); Tk_InitOptions( | | | | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry( &tv->tree.columnNames, Tcl_GetString(columnName), &isNew); Tcl_SetHashValue(entryPtr, tv->tree.columns + i); InitColumn(tv->tree.columns + i); Tk_InitOptions( interp, tv->tree.columns + i, tv->tree.columnOptionTable, tv->core.tkwin); Tk_InitOptions( interp, tv->tree.columns + i, tv->tree.headingOptionTable, tv->core.tkwin); Tcl_IncrRefCount(columnName); tv->tree.columns[i].idObj = columnName; } return TCL_OK; } |
︙ | ︙ | |||
762 763 764 765 766 767 768 | #define FirstColumn(tv) ((tv->tree.showFlags&SHOW_TREE) ? 0 : 1) /* + TreeWidth -- * Compute the requested tree width from the sum of visible column widths. */ static int TreeWidth(Treeview *tv) { | | > > > > > > > | 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | #define FirstColumn(tv) ((tv->tree.showFlags&SHOW_TREE) ? 0 : 1) /* + TreeWidth -- * Compute the requested tree width from the sum of visible column widths. */ static int TreeWidth(Treeview *tv) { TkSizeT i = FirstColumn(tv); int width = 0; tv->tree.titleWidth = 0; while (i < tv->tree.nDisplayColumns) { if (i == (TkSizeT)tv->tree.nTitleColumns) { tv->tree.titleWidth = width; } width += tv->tree.displayColumns[i++]->width; } if ((TkSizeT)tv->tree.nTitleColumns >= tv->tree.nDisplayColumns) { tv->tree.titleWidth = width; } return width; } /* + RecomputeSlack -- */ static void RecomputeSlack(Treeview *tv) |
︙ | ︙ | |||
842 843 844 845 846 847 848 | /* + ShoveRight -- * Adjust width of (stretchable) columns to the right by N pixels. * Returns: leftover slack. */ static int ShoveRight(Treeview *tv, int i, int n) { | | > | | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 | /* + ShoveRight -- * Adjust width of (stretchable) columns to the right by N pixels. * Returns: leftover slack. */ static int ShoveRight(Treeview *tv, int i, int n) { while (n != 0 && (TkSizeT)i < tv->tree.nDisplayColumns) { TreeColumn *c = tv->tree.displayColumns[i]; if (c->stretch) { n -= Stretch(c, n); } ++i; } return n; } /* + DistributeWidth -- * Distribute n pixels evenly across all stretchable display columns. * Returns: leftover slack. * Notes: * The "((++w % m) < r)" term is there so that the remainder r = n % m * is distributed round-robin. */ static int DistributeWidth(Treeview *tv, int n) { int w = TreeWidth(tv); int m = 0; TkSizeT i; int d, r; for (i = FirstColumn(tv); i < tv->tree.nDisplayColumns; ++i) { if (tv->tree.displayColumns[i]->stretch) { ++m; } } if (m == 0) { |
︙ | ︙ | |||
912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | static void DragColumn(Treeview *tv, int i, int delta) { TreeColumn *c = tv->tree.displayColumns[i]; int dl = delta - ShoveLeft(tv, i-1, delta - Stretch(c, delta)); int dr = ShoveRight(tv, i+1, PickupSlack(tv, -dl)); DepositSlack(tv, dr); } /*------------------------------------------------------------------------ * +++ Event handlers. */ static TreeItem *IdentifyItem(Treeview *tv, int y); /*forward*/ static const unsigned long TreeviewBindEventMask = KeyPressMask|KeyReleaseMask | ButtonPressMask|ButtonReleaseMask | PointerMotionMask|ButtonMotionMask | VirtualEventMask ; static void TreeviewBindEventProc(void *clientData, XEvent *event) { Treeview *tv = (Treeview *)clientData; TreeItem *item = NULL; Ttk_TagSet tagset; /* * Figure out where to deliver the event. */ switch (event->type) { case KeyPress: case KeyRelease: case VirtualEvent: item = tv->tree.focus; break; case ButtonPress: case ButtonRelease: item = IdentifyItem(tv, event->xbutton.y); break; case MotionNotify: item = IdentifyItem(tv, event->xmotion.y); break; default: break; } if (!item) { return; } /* ASSERT: Ttk_GetTagSetFromObj succeeds. * NB: must use a local copy of the tagset, * in case a binding script stomps on -tags. */ tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, item->tagsObj); /* * Fire binding: */ Tcl_Preserve(clientData); Tk_BindEvent(tv->tree.bindingTable, event, tv->core.tkwin, tagset->nTags, (void **)tagset->tags); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | static void DragColumn(Treeview *tv, int i, int delta) { TreeColumn *c = tv->tree.displayColumns[i]; int dl = delta - ShoveLeft(tv, i-1, delta - Stretch(c, delta)); int dr = ShoveRight(tv, i+1, PickupSlack(tv, -dl)); DepositSlack(tv, dr); } /*------------------------------------------------------------------------ * +++ Cells. */ typedef struct { TreeItem *item; TreeColumn *column; Tcl_Obj *colObj; } TreeCell; /* + GetCellFromObj * Get Row and Column from a cell ID. */ static int GetCellFromObj( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *obj, int displayColumnOnly, int *displayColumn, TreeCell *cell) { int nElements; Tcl_Obj **elements; if (Tcl_ListObjGetElements(interp, obj, &nElements, &elements) != TCL_OK) { return TCL_ERROR; } if (nElements != 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Cell id must be a list of two elements", -1)); Tcl_SetErrorCode(interp, "TTK", "TREE", "CELL", NULL); return TCL_ERROR; } /* Valid item/column in each pair? */ cell->item = FindItem(interp, tv, elements[0]); if (!cell->item) { return TCL_ERROR; } cell->column = FindColumn(interp, tv, elements[1]); if (!cell->column) { return TCL_ERROR; } /* colObj is short lived and do not keep a reference counted */ cell->colObj = elements[1]; if (displayColumnOnly) { TkSizeT i = FirstColumn(tv); while (i < tv->tree.nDisplayColumns) { if (tv->tree.displayColumns[i] == cell->column) { break; } ++i; } if (i == tv->tree.nDisplayColumns) { /* specified column unviewable */ Tcl_SetObjResult(interp, Tcl_NewStringObj( "Cell id must be in a visible column", -1)); Tcl_SetErrorCode(interp, "TTK", "TREE", "CELL", NULL); return TCL_ERROR; } if (displayColumn != NULL) { *displayColumn = i; } } return TCL_OK; } /* + GetCellListFromObj -- * Parse a Tcl_Obj * as a list of cells. * Returns an array of cells; result must be ckfree()d. * On error, returns NULL and leaves an error * message in interp. */ static TreeCell *GetCellListFromObj( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *objPtr, TkSizeT *nCells) { TreeCell *cells; TreeCell cell; Tcl_Obj **elements; Tcl_Obj *oneCell; TkSizeT i; int n; if (Tcl_ListObjGetElements(interp, objPtr, &n, &elements) != TCL_OK) { return NULL; } /* A two element list might be a single cell */ if (n == 2) { if (GetCellFromObj(interp, tv, objPtr, 0, NULL, &cell) == TCL_OK) { n = 1; oneCell = objPtr; elements = &oneCell; } else { Tcl_ResetResult(interp); } } cells = (TreeCell *) ckalloc(n * sizeof(TreeCell)); for (i = 0; i < (TkSizeT)n; ++i) { if (GetCellFromObj(interp, tv, elements[i], 0, NULL, &cells[i]) != TCL_OK) { ckfree(cells); return NULL; } } if (nCells) { *nCells = n; } return cells; } /*------------------------------------------------------------------------ * +++ Event handlers. */ static TreeItem *IdentifyItem(Treeview *tv, int y); /*forward*/ static TkSizeT IdentifyDisplayColumn(Treeview *tv, int x, int *x1); /*forward*/ static const unsigned long TreeviewBindEventMask = KeyPressMask|KeyReleaseMask | ButtonPressMask|ButtonReleaseMask | PointerMotionMask|ButtonMotionMask | VirtualEventMask ; static void TreeviewBindEventProc(void *clientData, XEvent *event) { Treeview *tv = (Treeview *)clientData; TreeItem *item = NULL; Ttk_TagSet tagset; int unused; TkSizeT colno = TCL_INDEX_NONE; TreeColumn *column = NULL; /* * Figure out where to deliver the event. */ switch (event->type) { case KeyPress: case KeyRelease: case VirtualEvent: item = tv->tree.focus; break; case ButtonPress: case ButtonRelease: item = IdentifyItem(tv, event->xbutton.y); colno = IdentifyDisplayColumn(tv, event->xbutton.x, &unused); break; case MotionNotify: item = IdentifyItem(tv, event->xmotion.y); colno = IdentifyDisplayColumn(tv, event->xmotion.x, &unused); break; default: break; } if (!item) { return; } /* ASSERT: Ttk_GetTagSetFromObj succeeds. * NB: must use a local copy of the tagset, * in case a binding script stomps on -tags. */ tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, item->tagsObj); /* * Pick up any cell tags. */ if (colno != TCL_INDEX_NONE) { column = tv->tree.displayColumns[colno]; if (column == &tv->tree.column0) { colno = 0; } else { colno = column - tv->tree.columns + 1; } if (colno < item->nTagSets) { if (item->cellTagSets[colno] != NULL) { Ttk_TagSetAddSet(tagset, item->cellTagSets[colno]); } } } /* * Fire binding: */ Tcl_Preserve(clientData); Tk_BindEvent(tv->tree.bindingTable, event, tv->core.tkwin, tagset->nTags, (void **)tagset->tags); |
︙ | ︙ | |||
989 990 991 992 993 994 995 | tv->tree.itemOptionTable = Tk_CreateOptionTable(interp, ItemOptionSpecs); tv->tree.columnOptionTable = Tk_CreateOptionTable(interp, ColumnOptionSpecs); tv->tree.headingOptionTable = Tk_CreateOptionTable(interp, HeadingOptionSpecs); | | | > | > > > > > > > > > > | | | | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 | tv->tree.itemOptionTable = Tk_CreateOptionTable(interp, ItemOptionSpecs); tv->tree.columnOptionTable = Tk_CreateOptionTable(interp, ColumnOptionSpecs); tv->tree.headingOptionTable = Tk_CreateOptionTable(interp, HeadingOptionSpecs); tv->tree.displayOptionTable = Tk_CreateOptionTable(interp, DisplayOptionSpecs); tv->tree.tagTable = Ttk_CreateTagTable( interp, tv->core.tkwin, TagOptionSpecs, sizeof(DisplayItem)); tv->tree.bindingTable = Tk_CreateBindingTable(interp); Tk_CreateEventHandler(tv->core.tkwin, TreeviewBindEventMask, TreeviewBindEventProc, tv); tv->tree.itemLayout = tv->tree.cellLayout = tv->tree.headingLayout = tv->tree.rowLayout = tv->tree.separatorLayout = 0; tv->tree.headingHeight = tv->tree.rowHeight = 0; tv->tree.colSeparatorWidth = 1; tv->tree.indent = DEFAULT_INDENT; Tcl_InitHashTable(&tv->tree.columnNames, TCL_STRING_KEYS); tv->tree.nColumns = tv->tree.nDisplayColumns = 0; tv->tree.nTitleColumns = 0; tv->tree.nTitleItems = 0; tv->tree.titleWidth = 0; tv->tree.titleRows = 0; tv->tree.totalRows = 0; tv->tree.rowPosNeedsUpdate = 1; tv->tree.striped = 0; tv->tree.columns = NULL; tv->tree.displayColumns = NULL; tv->tree.showFlags = ~0; InitColumn(&tv->tree.column0); tv->tree.column0.idObj = Tcl_NewStringObj("#0", 2); Tcl_IncrRefCount(tv->tree.column0.idObj); Tk_InitOptions( interp, &tv->tree.column0, tv->tree.columnOptionTable, tv->core.tkwin); Tk_InitOptions( interp, &tv->tree.column0, tv->tree.headingOptionTable, tv->core.tkwin); Tcl_InitHashTable(&tv->tree.items, TCL_STRING_KEYS); tv->tree.serial = 0; tv->tree.focus = tv->tree.endPtr = 0; /* Create root item "": */ tv->tree.root = NewItem(); Tk_InitOptions(interp, tv->tree.root, tv->tree.itemOptionTable, tv->core.tkwin); tv->tree.root->tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, NULL); tv->tree.root->entryPtr = Tcl_CreateHashEntry(&tv->tree.items, "", &unused); Tcl_SetHashValue(tv->tree.root->entryPtr, tv->tree.root); /* Scroll handles: */ |
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 | Tk_DeleteBindingTable(tv->tree.bindingTable); Ttk_DeleteTagTable(tv->tree.tagTable); if (tv->tree.itemLayout) Ttk_FreeLayout(tv->tree.itemLayout); if (tv->tree.cellLayout) Ttk_FreeLayout(tv->tree.cellLayout); if (tv->tree.headingLayout) Ttk_FreeLayout(tv->tree.headingLayout); if (tv->tree.rowLayout) Ttk_FreeLayout(tv->tree.rowLayout); TreeviewFreeColumns(tv); if (tv->tree.displayColumns) | > > | | 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | Tk_DeleteBindingTable(tv->tree.bindingTable); Ttk_DeleteTagTable(tv->tree.tagTable); if (tv->tree.itemLayout) Ttk_FreeLayout(tv->tree.itemLayout); if (tv->tree.cellLayout) Ttk_FreeLayout(tv->tree.cellLayout); if (tv->tree.headingLayout) Ttk_FreeLayout(tv->tree.headingLayout); if (tv->tree.rowLayout) Ttk_FreeLayout(tv->tree.rowLayout); if (tv->tree.separatorLayout) Ttk_FreeLayout(tv->tree.separatorLayout); FreeColumn(&tv->tree.column0); TreeviewFreeColumns(tv); if (tv->tree.displayColumns) ckfree(tv->tree.displayColumns); foreachHashEntry(&tv->tree.items, FreeItemCB); Tcl_DeleteHashTable(&tv->tree.items); TtkFreeScrollHandle(tv->tree.xscrollHandle); TtkFreeScrollHandle(tv->tree.yscrollHandle); } |
︙ | ︙ | |||
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | if (TreeviewInitColumns(interp, tv) != TCL_OK) return TCL_ERROR; mask |= DCOLUMNS_CHANGED; } if (mask & DCOLUMNS_CHANGED) { if (TreeviewInitDisplayColumns(interp, tv) != TCL_OK) return TCL_ERROR; } if (mask & SCROLLCMD_CHANGED) { TtkScrollbarUpdateRequired(tv->tree.xscrollHandle); TtkScrollbarUpdateRequired(tv->tree.yscrollHandle); } if ((mask & SHOW_CHANGED) && GetEnumSetFromObj( interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) { return TCL_ERROR; } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { return TCL_ERROR; } tv->tree.showFlags = showFlags; if (mask & (SHOW_CHANGED | DCOLUMNS_CHANGED)) { RecomputeSlack(tv); } return TCL_OK; } | > > > > > > > > > > > > > > > > > > | 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | if (TreeviewInitColumns(interp, tv) != TCL_OK) return TCL_ERROR; mask |= DCOLUMNS_CHANGED; } if (mask & DCOLUMNS_CHANGED) { if (TreeviewInitDisplayColumns(interp, tv) != TCL_OK) return TCL_ERROR; } if (mask & COLUMNS_CHANGED) { CellSelectionClear(tv); } if (tv->tree.nTitleColumns < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "\"#%d\" is out of range", tv->tree.nTitleColumns)); Tcl_SetErrorCode(interp, "TTK", "TREE", "TITLECOLUMNS", NULL); return TCL_ERROR; } if (tv->tree.nTitleItems < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "\"%d\" is out of range", tv->tree.nTitleItems)); Tcl_SetErrorCode(interp, "TTK", "TREE", "TITLEITEMS", NULL); return TCL_ERROR; } if (mask & SCROLLCMD_CHANGED) { TtkScrollbarUpdateRequired(tv->tree.xscrollHandle); TtkScrollbarUpdateRequired(tv->tree.yscrollHandle); } if ((mask & SHOW_CHANGED) && GetEnumSetFromObj( interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) { return TCL_ERROR; } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { return TCL_ERROR; } tv->tree.rowPosNeedsUpdate = 1; tv->tree.showFlags = showFlags; if (mask & (SHOW_CHANGED | DCOLUMNS_CHANGED)) { RecomputeSlack(tv); } return TCL_OK; } |
︙ | ︙ | |||
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | /* Make sure that -values is a valid list: */ if (item->valuesObj) { int unused; if (Tcl_ListObjLength(interp, item->valuesObj, &unused) != TCL_OK) goto error; } /* Check -image. */ if ((mask & ITEM_OPTION_IMAGE_CHANGED) && item->imageObj) { newImageSpec = TtkGetImageSpec(interp, tv->core.tkwin, item->imageObj); if (!newImageSpec) { goto error; | > > > > > > > > > | 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 | /* Make sure that -values is a valid list: */ if (item->valuesObj) { int unused; if (Tcl_ListObjLength(interp, item->valuesObj, &unused) != TCL_OK) goto error; } /* Check -height */ if (item->height < 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Invalid item height %d", item->height)); Tcl_SetErrorCode(interp, "TTK", "TREE", "HEIGHT", NULL); goto error; } /* Check -image. */ if ((mask & ITEM_OPTION_IMAGE_CHANGED) && item->imageObj) { newImageSpec = TtkGetImageSpec(interp, tv->core.tkwin, item->imageObj); if (!newImageSpec) { goto error; |
︙ | ︙ | |||
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | if (item->tagset) { Ttk_FreeTagSet(item->tagset); } item->tagset = newTagSet; } if (mask & ITEM_OPTION_IMAGE_CHANGED) { if (item->imagespec) { TtkFreeImageSpec(item->imagespec); } item->imagespec = newImageSpec; } TtkRedisplayWidget(&tv->core); return TCL_OK; error: Tk_RestoreSavedOptions(&savedOptions); if (newTagSet) { Ttk_FreeTagSet(newTagSet); } if (newImageSpec) { TtkFreeImageSpec(newImageSpec); } | > | 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | if (item->tagset) { Ttk_FreeTagSet(item->tagset); } item->tagset = newTagSet; } if (mask & ITEM_OPTION_IMAGE_CHANGED) { if (item->imagespec) { TtkFreeImageSpec(item->imagespec); } item->imagespec = newImageSpec; } tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); return TCL_OK; error: Tk_RestoreSavedOptions(&savedOptions); if (newTagSet) { Ttk_FreeTagSet(newTagSet); } if (newImageSpec) { TtkFreeImageSpec(newImageSpec); } |
︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 | return TCL_ERROR; } /*------------------------------------------------------------------------ * +++ Geometry routines. */ | | | > | > > > | | < < < | | | > | > > > > > > | < < < < < < < < < < | < < | | | | < < | | > > > | < | | > > > > > > > > > > > > | > > > > > > > > > > > | > > > > | | | > > > > < | < < | < < < < < < < < < | < < < | < < < < < < < < < < < < < | | | < | | < | < | < < < < < < | | > | > > | | < < < > | | > > > > | | | > > > > > > | 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 | return TCL_ERROR; } /*------------------------------------------------------------------------ * +++ Geometry routines. */ /* + UpdatePositionItem -- * Update position data for all visible items. */ static void UpdatePositionItem( Treeview *tv, TreeItem *item, int hidden, int *rowPos, int *itemPos, int *visiblePos) { TreeItem *child = item->children; item->itemPos = *itemPos; *itemPos += 1; if (item->hidden) { hidden = 1; } if (hidden) { item->rowPos = -1; item->visiblePos = -1; } else { item->rowPos = *rowPos; item->visiblePos = *visiblePos; if (*visiblePos == tv->tree.nTitleItems) { tv->tree.titleRows = *rowPos; } *visiblePos += 1; *rowPos += item->height; } if (!(item->state & TTK_STATE_OPEN)) { hidden = 1; } while (child) { UpdatePositionItem(tv, child, hidden, rowPos, itemPos, visiblePos); child = child->next; } } /* + UpdatePositionTree -- * Update position data for all visible items. */ static void UpdatePositionTree(Treeview *tv) { /* -1 for the invisible root */ int rowPos = -1, itemPos = -1, visiblePos = -1; tv->tree.titleRows = 0; UpdatePositionItem(tv, tv->tree.root, 0, &rowPos, &itemPos, &visiblePos); tv->tree.totalRows = rowPos; tv->tree.rowPosNeedsUpdate = 0; } /* + IdentifyItem -- * Locate the item at the specified y position, if any. */ static TreeItem *IdentifyItem(Treeview *tv, int y) { TreeItem *item; int rowHeight = tv->tree.rowHeight; int ypos = tv->tree.treeArea.y; int nextRow, row; if (y < ypos) { return NULL; } if (tv->tree.rowPosNeedsUpdate) { UpdatePositionTree(tv); } row = (y - ypos) / rowHeight; if (row >= tv->tree.titleRows) { row += tv->tree.yscroll.first; } for (item = tv->tree.root->children; item; item = NextPreorder(item)) { nextRow = item->rowPos + item->height; if (item->rowPos <= row && row < nextRow) break; } return item; } /* + IdentifyDisplayColumn -- * Returns the display column number at the specified x position, * or -1 if x is outside any columns. */ static TkSizeT IdentifyDisplayColumn(Treeview *tv, int x, int *x1) { TkSizeT colno = FirstColumn(tv); int xpos = tv->tree.treeArea.x; if ((TkSizeT)tv->tree.nTitleColumns <= colno) { xpos -= tv->tree.xscroll.first; } while (colno < tv->tree.nDisplayColumns) { TreeColumn *column = tv->tree.displayColumns[colno]; int next_xpos = xpos + column->width; if (xpos <= x && x <= next_xpos + HALO) { *x1 = next_xpos; return colno; } ++colno; xpos = next_xpos; if ((TkSizeT)tv->tree.nTitleColumns == colno) { xpos -= tv->tree.xscroll.first; } } return TCL_INDEX_NONE; } /* + ItemDepth -- return the depth of a tree item. * The depth of an item is equal to the number of proper ancestors, * not counting the root node. */ static int ItemDepth(TreeItem *item) { int depth = 0; while (item->parent) { ++depth; item = item->parent; } return depth-1; } /* + DisplayRow -- * Returns the position row has on screen, or -1 if off-screen. */ static int DisplayRow(int row, Treeview *tv) { int visibleRows = tv->tree.treeArea.height / tv->tree.rowHeight - tv->tree.titleRows; if (row < tv->tree.titleRows) { return row; } row -= tv->tree.titleRows; if (row < tv->tree.yscroll.first || row > tv->tree.yscroll.first + visibleRows) { /* not viewable, or off-screen */ return -1; } return row - tv->tree.yscroll.first + tv->tree.titleRows; } /* + BoundingBox -- * Compute the parcel of the specified column of the specified item, * (or the entire item if column is NULL) * Returns: 0 if item or column is not viewable, 1 otherwise. */ static int BoundingBox( Treeview *tv, /* treeview widget */ TreeItem *item, /* desired item */ TreeColumn *column, /* desired column */ Ttk_Box *bbox_rtn) /* bounding box of item */ { int dispRow; Ttk_Box bbox = tv->tree.treeArea; if (tv->tree.rowPosNeedsUpdate) { UpdatePositionTree(tv); } dispRow = DisplayRow(item->rowPos, tv); if (dispRow < 0) { /* not viewable, or off-screen */ return 0; } bbox.y += dispRow * tv->tree.rowHeight; bbox.height = tv->tree.rowHeight * item->height; bbox.x -= tv->tree.xscroll.first; bbox.width = TreeWidth(tv); if (column) { int xpos = 0; TkSizeT i = FirstColumn(tv); while (i < tv->tree.nDisplayColumns) { if (tv->tree.displayColumns[i] == column) { break; } xpos += tv->tree.displayColumns[i]->width; ++i; } if (i == tv->tree.nDisplayColumns) { /* specified column unviewable */ return 0; } bbox.x += xpos; bbox.width = column->width; if (i < (TkSizeT)tv->tree.nTitleColumns) { /* Unscrollable column, remove scroll shift */ bbox.x += tv->tree.xscroll.first; } /* Account for indentation in tree column: */ if (column == &tv->tree.column0) { int indent = tv->tree.indent * ItemDepth(item); bbox.x += indent; bbox.width -= indent; |
︙ | ︙ | |||
1504 1505 1506 1507 1508 1509 1510 | static const char *const regionStrings[] = { "nothing", "heading", "separator", "tree", "cell", 0 }; static TreeRegion IdentifyRegion(Treeview *tv, int x, int y) { | | > < | | 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | static const char *const regionStrings[] = { "nothing", "heading", "separator", "tree", "cell", 0 }; static TreeRegion IdentifyRegion(Treeview *tv, int x, int y) { int x1 = 0; TkSizeT colno = IdentifyDisplayColumn(tv, x, &x1); if (Ttk_BoxContains(tv->tree.headingArea, x, y)) { if (colno == TCL_INDEX_NONE) { return REGION_NOTHING; } else if (-HALO <= x1 - x && x1 - x <= HALO) { return REGION_SEPARATOR; } else { return REGION_HEADING; } } else if (Ttk_BoxContains(tv->tree.treeArea, x, y)) { |
︙ | ︙ | |||
1561 1562 1563 1564 1565 1566 1567 | */ static Ttk_Layout TreeviewGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { Treeview *tv = (Treeview *)recordPtr; Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); Tcl_Obj *objPtr; | | > > | | | > > | | > > > > > > > > > > | > | > > > > > > > > > < | | | > | | | > | | 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 | */ static Ttk_Layout TreeviewGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { Treeview *tv = (Treeview *)recordPtr; Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); Tcl_Obj *objPtr; int unused, cellHeight; DisplayItem displayItem; Ttk_Style style; if (!( treeLayout && GetSublayout(interp, themePtr, treeLayout, ".Item", tv->tree.displayOptionTable, &tv->tree.itemLayout) && GetSublayout(interp, themePtr, treeLayout, ".Cell", tv->tree.displayOptionTable, &tv->tree.cellLayout) && GetSublayout(interp, themePtr, treeLayout, ".Heading", tv->tree.headingOptionTable, &tv->tree.headingLayout) && GetSublayout(interp, themePtr, treeLayout, ".Row", tv->tree.displayOptionTable, &tv->tree.rowLayout) && GetSublayout(interp, themePtr, treeLayout, ".Separator", tv->tree.displayOptionTable, &tv->tree.separatorLayout) )) { return 0; } /* Compute heading height. */ Ttk_RebindSublayout(tv->tree.headingLayout, &tv->tree.column0); Ttk_LayoutSize(tv->tree.headingLayout, 0, &unused, &tv->tree.headingHeight); /* Get row height from style, or compute it to fit Item and Cell. * Pick up default font from the Treeview style. */ style = Ttk_LayoutStyle(treeLayout); Ttk_TagSetDefaults(tv->tree.tagTable, style, &displayItem); Ttk_RebindSublayout(tv->tree.itemLayout, &displayItem); Ttk_LayoutSize(tv->tree.itemLayout, 0, &unused, &tv->tree.rowHeight); Ttk_RebindSublayout(tv->tree.cellLayout, &displayItem); Ttk_LayoutSize(tv->tree.cellLayout, 0, &unused, &cellHeight); if (cellHeight > tv->tree.rowHeight) { tv->tree.rowHeight = cellHeight; } if ((objPtr = Ttk_QueryOption(treeLayout, "-rowheight", 0))) { (void)Tcl_GetIntFromObj(NULL, objPtr, &tv->tree.rowHeight); } if ((objPtr = Ttk_QueryOption(treeLayout, "-columnseparatorwidth", 0))) { (void)Tcl_GetIntFromObj(NULL, objPtr, &tv->tree.colSeparatorWidth); } /* Get item indent from style: * @@@ TODO: sanity-check. */ tv->tree.indent = DEFAULT_INDENT; if ((objPtr = Ttk_QueryOption(treeLayout, "-indent", 0))) { (void)Tcl_GetIntFromObj(NULL, objPtr, &tv->tree.indent); } return treeLayout; } /* + TreeviewDoLayout -- * DoLayout() widget hook. Computes widget layout. * * Side effects: * Computes headingArea and treeArea. * Computes subtree height. * Invokes scroll callbacks. */ static void TreeviewDoLayout(void *clientData) { Treeview *tv = (Treeview *)clientData; int visibleRows; int first, last, total; Ttk_PlaceLayout(tv->core.layout,tv->core.state,Ttk_WinBox(tv->core.tkwin)); tv->tree.treeArea = Ttk_ClientRegion(tv->core.layout, "treearea"); ResizeColumns(tv, tv->tree.treeArea.width); first = tv->tree.xscroll.first; last = first + tv->tree.treeArea.width - tv->tree.titleWidth; total = TreeWidth(tv) - tv->tree.titleWidth; TtkScrolled(tv->tree.xscrollHandle, first, last, total); if (tv->tree.showFlags & SHOW_HEADINGS) { tv->tree.headingArea = Ttk_PackBox( &tv->tree.treeArea, 1, tv->tree.headingHeight, TTK_SIDE_TOP); } else { tv->tree.headingArea = Ttk_MakeBox(0,0,0,0); } visibleRows = tv->tree.treeArea.height / tv->tree.rowHeight; tv->tree.root->state |= TTK_STATE_OPEN; UpdatePositionTree(tv); first = tv->tree.yscroll.first; last = tv->tree.yscroll.first + visibleRows - tv->tree.titleRows; total = tv->tree.totalRows - tv->tree.titleRows; TtkScrolled(tv->tree.yscrollHandle, first, last, total); } /* + TreeviewSize -- * SizeProc() widget hook. Size is determined by * -height option and column widths. */ static int TreeviewSize(void *clientData, int *widthPtr, int *heightPtr) |
︙ | ︙ | |||
1676 1677 1678 1679 1680 1681 1682 | } /* + DrawHeadings -- * Draw tree headings. */ static void DrawHeadings(Treeview *tv, Drawable d) { | | | > > > > > > | | > | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > | | < | | > | > > > > > > > > | > | | > > > > | > > > > > | > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > | > | > > > > > > > | > | | > > | < | | | < | < < < < < < < > | | > > > > > > | | > > > > > > > > > > > > > > | > > > > | > > > > > > > > > | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > | | | | > | | | < < < < < | | | | < | > | 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 | } /* + DrawHeadings -- * Draw tree headings. */ static void DrawHeadings(Treeview *tv, Drawable d) { int x0 = tv->tree.headingArea.x - tv->tree.xscroll.first; const int y0 = tv->tree.headingArea.y; const int h0 = tv->tree.headingArea.height; TkSizeT i = FirstColumn(tv); int x = 0; if ((TkSizeT)tv->tree.nTitleColumns > i) { x = tv->tree.titleWidth; i = tv->tree.nTitleColumns; } while (i < tv->tree.nDisplayColumns) { TreeColumn *column = tv->tree.displayColumns[i]; Ttk_Box parcel = Ttk_MakeBox(x0+x, y0, column->width, h0); if (x0+x+column->width > tv->tree.titleWidth) { DisplayLayout(tv->tree.headingLayout, column, column->headingState, parcel, d); } x += column->width; ++i; } x0 = tv->tree.headingArea.x; i = FirstColumn(tv); x = 0; while ((i < (TkSizeT)tv->tree.nTitleColumns) && (i < tv->tree.nDisplayColumns)) { TreeColumn *column = tv->tree.displayColumns[i]; Ttk_Box parcel = Ttk_MakeBox(x0+x, y0, column->width, h0); DisplayLayout(tv->tree.headingLayout, column, column->headingState, parcel, d); x += column->width; ++i; } } /* + DrawSeparators -- * Draw separators between columns */ static void DrawSeparators(Treeview *tv, Drawable d) { const int y0 = tv->tree.treeArea.y; const int h0 = tv->tree.treeArea.height; DisplayItem displayItem; Ttk_Style style = Ttk_LayoutStyle(tv->tree.separatorLayout); int x = tv->tree.treeArea.x; TkSizeT i; Ttk_TagSetDefaults(tv->tree.tagTable, style, &displayItem); for (i = FirstColumn(tv); i < tv->tree.nDisplayColumns; ++i) { TreeColumn *column = tv->tree.displayColumns[i]; Ttk_Box parcel; int xDraw = x + column->width; x += column->width; if (!column->separator) continue; if (i >= (TkSizeT)tv->tree.nTitleColumns) { xDraw -= tv->tree.xscroll.first; if (xDraw < tv->tree.titleWidth) continue; } parcel = Ttk_MakeBox(xDraw - (tv->tree.colSeparatorWidth+1)/2, y0, tv->tree.colSeparatorWidth, h0); DisplayLayout(tv->tree.separatorLayout, &displayItem, 0, parcel, d); } } /* + OverrideStriped -- * Each level of settings might add stripedbackground, and it should * override background if this is indeed on a striped item. * By copying it between each level, and NULL-ing stripedBgObj, * it can be detected if the next level overrides it. */ static void OverrideStriped( Treeview *tv, TreeItem *item, DisplayItem *displayItem) { int striped = item->visiblePos % 2 && tv->tree.striped; if (striped && displayItem->stripedBgObj) { displayItem->backgroundObj = displayItem->stripedBgObj; displayItem->stripedBgObj = NULL; } } /* + PrepareItem -- * Fill in a displayItem record. */ static void PrepareItem( Treeview *tv, TreeItem *item, DisplayItem *displayItem, Ttk_State state) { Ttk_Style style = Ttk_LayoutStyle(tv->core.layout); Ttk_TagSetDefaults(tv->tree.tagTable, style, displayItem); OverrideStriped(tv, item, displayItem); Ttk_TagSetValues(tv->tree.tagTable, item->tagset, displayItem); OverrideStriped(tv, item, displayItem); Ttk_TagSetApplyStyle(tv->tree.tagTable, style, state, displayItem); } /* Fill in data from item to temporary storage in columns. */ static void PrepareCells( Treeview *tv, TreeItem *item) { TkSizeT i; int nValues = 0; Tcl_Obj **values = NULL; TreeColumn *column; if (item->valuesObj) { Tcl_ListObjGetElements(NULL, item->valuesObj, &nValues, &values); } for (i = 0; i < tv->tree.nColumns; ++i) { tv->tree.columns[i].data = (i < (TkSizeT)nValues) ? values[i] : 0; tv->tree.columns[i].selected = 0; tv->tree.columns[i].tagset = NULL; } tv->tree.column0.data = NULL; tv->tree.column0.selected = 0; tv->tree.column0.tagset = NULL; if (item->selObj != NULL) { Tcl_ListObjGetElements(NULL, item->selObj, &nValues, &values); for (i = 0; i < (TkSizeT)nValues; ++i) { column = FindColumn(NULL, tv, values[i]); /* Just in case. It should not be possible for column to be NULL */ if (column != NULL) { column->selected = 1; } } } if (item->nTagSets > 0) { tv->tree.column0.tagset = item->cellTagSets[0]; } for (i = 1; i < item->nTagSets && i <= tv->tree.nColumns; ++i) { tv->tree.columns[i-1].tagset = item->cellTagSets[i]; } } /* + DrawCells -- * Draw data cells for specified item. */ static void DrawCells( Treeview *tv, TreeItem *item, DisplayItem *displayItem, DisplayItem *displayItemSel, Drawable d, int x, int y, int title) { Ttk_Layout layout = tv->tree.cellLayout; Ttk_Style style = Ttk_LayoutStyle(tv->core.layout); Ttk_State state = ItemState(tv, item); Ttk_Padding cellPadding = {4, 0, 4, 0}; DisplayItem displayItemLocal; DisplayItem displayItemCell, displayItemCellSel; int rowHeight = tv->tree.rowHeight * item->height; int xPad = 0, defaultPadding = 1; TkSizeT i; /* Adjust if the tree column has a separator */ if (tv->tree.showFlags & SHOW_TREE && tv->tree.column0.separator) { xPad = tv->tree.colSeparatorWidth/2; } /* An Item's image should not propagate to a Cell. A Cell's image can only be set by cell tags. */ displayItemCell = *displayItem; displayItemCellSel = *displayItemSel; displayItemCell.imageObj = NULL; displayItemCellSel.imageObj = NULL; displayItemCell.imageAnchorObj = NULL; displayItemCellSel.imageAnchorObj = NULL; /* If explicit padding was asked for, skip default. */ if (Ttk_QueryStyle(Ttk_LayoutStyle(tv->tree.cellLayout), &displayItemCell, tv->tree.displayOptionTable, "-padding", state) != NULL) { defaultPadding = 0; } for (i = 1; i < tv->tree.nDisplayColumns; ++i) { TreeColumn *column = tv->tree.displayColumns[i]; int parcelX = x + xPad; int parcelWidth = column->separator ? column->width - tv->tree.colSeparatorWidth : column->width; Ttk_Box parcel = Ttk_MakeBox(parcelX, y, parcelWidth, rowHeight); DisplayItem *displayItemUsed = &displayItemCell; Ttk_State stateCell = state; Tk_Anchor textAnchor, imageAnchor; xPad = column->separator ? tv->tree.colSeparatorWidth/2 : 0; x += column->width; if (title && i >= (TkSizeT)tv->tree.nTitleColumns) break; if (!title && i < (TkSizeT)tv->tree.nTitleColumns) continue; if (!title && x < tv->tree.titleWidth) continue; if (column->selected) { displayItemUsed = &displayItemCellSel; stateCell |= TTK_STATE_SELECTED; } if (column->tagset) { displayItemLocal = *displayItemUsed; displayItemUsed = &displayItemLocal; Ttk_TagSetValues(tv->tree.tagTable, column->tagset, displayItemUsed); OverrideStriped(tv, item, displayItemUsed); Ttk_TagSetApplyStyle(tv->tree.tagTable, style, stateCell, displayItemUsed); } displayItemUsed->textObj = column->data; displayItemUsed->anchorObj = column->anchorObj;/* <<NOTE-ANCHOR>> */ Tk_GetAnchorFromObj(NULL, column->anchorObj, &textAnchor); imageAnchor = DEFAULT_IMAGEANCHOR; if (displayItemUsed->imageAnchorObj) { Tk_GetAnchorFromObj(NULL, displayItemUsed->imageAnchorObj, &imageAnchor); } /* displayItem was used to draw the full item backgound. Redraw cell background if needed. */ if (displayItemUsed != &displayItemCell) { DisplayLayout(tv->tree.rowLayout, displayItemUsed, stateCell, parcel, d); } if (defaultPadding && displayItemUsed->paddingObj == NULL) { /* If no explicit padding was asked for, add some default. */ parcel = Ttk_PadBox(parcel, cellPadding); } DisplayLayoutTree(imageAnchor, textAnchor, layout, displayItemUsed, state, parcel, d); } } /* + DrawItem -- * Draw an item (row background, tree label, and cells). */ static void DrawItem( Treeview *tv, TreeItem *item, Drawable d, int depth) { Ttk_Style style = Ttk_LayoutStyle(tv->core.layout); Ttk_State state = ItemState(tv, item); DisplayItem displayItem, displayItemSel, displayItemLocal; int rowHeight = tv->tree.rowHeight * item->height; int x = tv->tree.treeArea.x - tv->tree.xscroll.first; int xTitle = tv->tree.treeArea.x; int dispRow = DisplayRow(item->rowPos, tv); int y = tv->tree.treeArea.y + tv->tree.rowHeight * dispRow; PrepareItem(tv, item, &displayItem, state); PrepareItem(tv, item, &displayItemSel, state | TTK_STATE_SELECTED); /* Draw row background: */ { Ttk_Box rowBox = Ttk_MakeBox(x, y, TreeWidth(tv), rowHeight); DisplayLayout(tv->tree.rowLayout, &displayItem, state, rowBox, d); } /* Make room for tree label: */ if (tv->tree.showFlags & SHOW_TREE) { x += tv->tree.column0.width; } /* Draw data cells: */ PrepareCells(tv, item); DrawCells(tv, item, &displayItem, &displayItemSel, d, x, y, 0); /* Draw row background for non-scrolled area: */ if ((TkSizeT)tv->tree.nTitleColumns >= 1) { Ttk_Box rowBox = Ttk_MakeBox(tv->tree.treeArea.x, y, tv->tree.titleWidth, rowHeight); DisplayLayout(tv->tree.rowLayout, &displayItem, state, rowBox, d); } /* Draw tree label: */ x = tv->tree.treeArea.x - tv->tree.xscroll.first; if (tv->tree.showFlags & SHOW_TREE) { TreeColumn *column = &tv->tree.column0; int indent = depth * tv->tree.indent; int colwidth = tv->tree.column0.width - (tv->tree.column0.separator ? tv->tree.colSeparatorWidth/2 : 0); int xTree = tv->tree.nTitleColumns >= 1 ? xTitle : x; Ttk_Box parcel = Ttk_MakeBox(xTree, y, colwidth, rowHeight); DisplayItem *displayItemUsed = &displayItem; Ttk_State stateCell = state; Tk_Anchor textAnchor, imageAnchor = DEFAULT_IMAGEANCHOR; Ttk_Padding cellPadding = {(short)indent, 0, 0, 0}; if (column->selected) { displayItemUsed = &displayItemSel; stateCell |= TTK_STATE_SELECTED; } if (column->tagset) { displayItemLocal = *displayItemUsed; displayItemUsed = &displayItemLocal; Ttk_TagSetValues(tv->tree.tagTable, column->tagset, displayItemUsed); OverrideStriped(tv, item, displayItemUsed); Ttk_TagSetApplyStyle(tv->tree.tagTable, style, stateCell, displayItemUsed); } displayItem.anchorObj = tv->tree.column0.anchorObj; Tk_GetAnchorFromObj(NULL, column->anchorObj, &textAnchor); displayItemUsed->textObj = item->textObj; /* Item's image can be null, and may come from the tag */ if (item->imageObj) { displayItemUsed->imageObj = item->imageObj; } if (item->imageAnchorObj) { displayItemUsed->imageAnchorObj = item->imageAnchorObj; } if (displayItemUsed->imageAnchorObj) { Tk_GetAnchorFromObj(NULL, displayItemUsed->imageAnchorObj, &imageAnchor); } if (displayItemUsed != &displayItem) { DisplayLayout(tv->tree.rowLayout, displayItemUsed, stateCell, parcel, d); } parcel = Ttk_PadBox(parcel, cellPadding); DisplayLayoutTree(imageAnchor, textAnchor, tv->tree.itemLayout, displayItemUsed, state, parcel, d); xTitle += colwidth; } /* Draw non-scrolled data cells: */ if ((TkSizeT)tv->tree.nTitleColumns > 1) { DrawCells(tv, item, &displayItem, &displayItemSel, d, xTitle, y, 1); } } /* + DrawSubtree -- * Draw an item and all of its (viewable) descendants. */ static void DrawForest( /* forward */ Treeview *tv, TreeItem *item, Drawable d, int depth); static void DrawSubtree( Treeview *tv, TreeItem *item, Drawable d, int depth) { int dispRow = DisplayRow(item->rowPos, tv); if (dispRow >= 0) { DrawItem(tv, item, d, depth); } if (item->state & TTK_STATE_OPEN) { DrawForest(tv, item->children, d, depth + 1); } } /* + DrawForest -- * Draw a sequence of items and their visible descendants. */ static void DrawForest( Treeview *tv, TreeItem *item, Drawable d, int depth) { while (item) { DrawSubtree(tv, item, d, depth); item = item->next; } } /* + TreeviewDisplay -- * Display() widget hook. Draw the widget contents. */ static void TreeviewDisplay(void *clientData, Drawable d) { Treeview *tv = (Treeview *)clientData; Ttk_DrawLayout(tv->core.layout, tv->core.state, d); if (tv->tree.showFlags & SHOW_HEADINGS) { DrawHeadings(tv, d); } DrawForest(tv, tv->tree.root->children, d, 0); DrawSeparators(tv, d); } /*------------------------------------------------------------------------ * +++ Utilities for widget commands */ /* + InsertPosition -- |
︙ | ︙ | |||
1972 1973 1974 1975 1976 1977 1978 | int i; if (!newChildren) return TCL_ERROR; /* Sanity-check: */ | | | | > | 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 | int i; if (!newChildren) return TCL_ERROR; /* Sanity-check: */ for (i = 0; newChildren[i]; ++i) { if (!AncestryCheck(interp, tv, newChildren[i], item)) { ckfree(newChildren); return TCL_ERROR; } } /* Detach old children: */ child = item->children; while (child) { TreeItem *next = child->next; DetachItem(child); child = next; } /* Detach new children from their current locations: */ for (i = 0; newChildren[i]; ++i) { DetachItem(newChildren[i]); } /* Reinsert new children: * Note: it is not an error for an item to be listed more than once, * though it probably should be... */ child = 0; for (i = 0; newChildren[i]; ++i) { if (newChildren[i]->parent) { /* This is a duplicate element which has already been * inserted. Ignore it. */ continue; } InsertItem(item, child, newChildren[i]); child = newChildren[i]; } ckfree(newChildren); tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); } return TCL_OK; } /* + $tv parent $item -- |
︙ | ︙ | |||
2162 2163 2164 2165 2166 2167 2168 | return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { return TCL_ERROR; } | | | 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 | return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { return TCL_ERROR; } if (objc >= 4 && (column = FindColumn(interp,tv,objv[3])) == NULL) { return TCL_ERROR; } if (BoundingBox(tv, item, column, &bbox)) { Tcl_SetObjResult(interp, Ttk_NewBoxObj(bbox)); } |
︙ | ︙ | |||
2188 2189 2190 2191 2192 2193 2194 | */ static int TreeviewHorribleIdentify( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Treeview *tv) { const char *what = "nothing", *detail = NULL; TreeItem *item = 0; Tcl_Obj *result; | | | | | > | | | 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 | */ static int TreeviewHorribleIdentify( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Treeview *tv) { const char *what = "nothing", *detail = NULL; TreeItem *item = 0; Tcl_Obj *result; TkSizeT dColumnNumber; char dcolbuf[32]; int x, y, x1; (void)objc; /* ASSERT: objc == 4 */ if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) { return TCL_ERROR; } dColumnNumber = IdentifyDisplayColumn(tv, x, &x1); if (dColumnNumber == TCL_INDEX_NONE) { goto done; } sprintf(dcolbuf, "#%" TKSIZET_MODIFIER "u", dColumnNumber); if (Ttk_BoxContains(tv->tree.headingArea,x,y)) { if (-HALO <= x1 - x && x1 - x <= HALO) { what = "separator"; } else { what = "heading"; } detail = dcolbuf; } else if (Ttk_BoxContains(tv->tree.treeArea,x,y)) { item = IdentifyItem(tv, y); if (item && dColumnNumber > 0) { what = "cell"; detail = dcolbuf; } else if (item) { Ttk_Layout layout = tv->tree.itemLayout; Ttk_Box itemBox; DisplayItem displayItem; Ttk_Element element; Ttk_State state = ItemState(tv, item); BoundingBox(tv, item, NULL, &itemBox); PrepareItem(tv, item, &displayItem, state); if (item->textObj) { displayItem.textObj = item->textObj; } if (item->imageObj) { displayItem.imageObj = item->imageObj; } Ttk_RebindSublayout(layout, &displayItem); Ttk_PlaceLayout(layout, state, itemBox); element = Ttk_IdentifyElement(layout, x, y); if (element) { what = "item"; detail = Ttk_ElementName(element); } else { what = "row"; |
︙ | ︙ | |||
2261 2262 2263 2264 2265 2266 2267 | * Identify the component at position x,y. */ static int TreeviewIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { static const char *const submethodStrings[] = | | | | > | | | > > > > > > > > > > > > > | | | | 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 | * Identify the component at position x,y. */ static int TreeviewIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { static const char *const submethodStrings[] = { "region", "item", "column", "row", "element", "cell", NULL }; enum { I_REGION, I_ITEM, I_COLUMN, I_ROW, I_ELEMENT, I_CELL }; Treeview *tv = (Treeview *)recordPtr; int submethod; int x, y; TreeRegion region; Ttk_Box bbox; TreeItem *item; TreeColumn *column = 0; TkSizeT colno; int x1; if (objc == 4) { /* Old form */ return TreeviewHorribleIdentify(interp, objc, objv, tv); } else if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "command x y"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[2], submethodStrings, sizeof(char *), "command", TCL_EXACT, &submethod) != TCL_OK || Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK ) { return TCL_ERROR; } region = IdentifyRegion(tv, x, y); item = IdentifyItem(tv, y); colno = IdentifyDisplayColumn(tv, x, &x1); column = (colno != TCL_INDEX_NONE) ? tv->tree.displayColumns[colno] : NULL; switch (submethod) { case I_REGION : Tcl_SetObjResult(interp,Tcl_NewStringObj(regionStrings[region],-1)); break; case I_ITEM : case I_ROW : if (item) { Tcl_SetObjResult(interp, ItemID(tv, item)); } break; case I_COLUMN : if (colno != TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("#%" TKSIZET_MODIFIER "u", colno)); } break; case I_CELL : if (item && colno != TCL_INDEX_NONE) { Tcl_Obj *elem[2]; elem[0] = ItemID(tv, item); elem[1] = Tcl_ObjPrintf("#%" TKSIZET_MODIFIER "u", colno); Tcl_SetObjResult(interp, Tcl_NewListObj(2, elem)); } break; case I_ELEMENT : { Ttk_Layout layout = 0; DisplayItem displayItem; Ttk_Element element; Ttk_State state; switch (region) { case REGION_NOTHING: layout = tv->core.layout; return TCL_OK; /* @@@ NYI */ case REGION_HEADING: case REGION_SEPARATOR: layout = tv->tree.headingLayout; return TCL_OK; /* @@@ NYI */ case REGION_TREE: layout = tv->tree.itemLayout; break; case REGION_CELL: layout = tv->tree.cellLayout; break; } if (item == NULL) { return TCL_OK; } if (!BoundingBox(tv, item, column, &bbox)) { return TCL_OK; } state = ItemState(tv, item); PrepareItem(tv, item, &displayItem, state); if (item->textObj) { displayItem.textObj = item->textObj; } if (item->imageObj) { displayItem.imageObj = item->imageObj; } Ttk_RebindSublayout(layout, &displayItem); Ttk_PlaceLayout(layout, state, bbox); element = Ttk_IdentifyElement(layout, x, y); if (element) { const char *elementName = Ttk_ElementName(element); Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1)); } break; |
︙ | ︙ | |||
2455 2456 2457 2458 2459 2460 2461 | */ static int TreeviewSetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; TreeColumn *column; | | | | 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 | */ static int TreeviewSetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; TreeColumn *column; TkSizeT columnNumber; if (objc < 3 || objc > 5) { Tcl_WrongNumArgs(interp, 2, objv, "item ?column ?value??"); return TCL_ERROR; } if (!(item = FindItem(interp, tv, objv[2]))) return TCL_ERROR; /* Make sure -values exists: */ if (!item->valuesObj) { item->valuesObj = Tcl_NewListObj(0,0); Tcl_IncrRefCount(item->valuesObj); } if (objc == 3) { /* Return dictionary: */ Tcl_Obj *result = Tcl_NewListObj(0,0); Tcl_Obj *value; for (columnNumber = 0; columnNumber < tv->tree.nColumns; ++columnNumber) { Tcl_ListObjIndex(interp, item->valuesObj, columnNumber, &value); if (value) { Tcl_ListObjAppendElement(NULL, result, tv->tree.columns[columnNumber].idObj); Tcl_ListObjAppendElement(NULL, result, value); } } |
︙ | ︙ | |||
2522 2523 2524 2525 2526 2527 2528 | int length; item->valuesObj = unshareObj(item->valuesObj); /* Make sure -values is fully populated: */ Tcl_ListObjLength(interp, item->valuesObj, &length); | | | 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 | int length; item->valuesObj = unshareObj(item->valuesObj); /* Make sure -values is fully populated: */ Tcl_ListObjLength(interp, item->valuesObj, &length); while ((TkSizeT)length < tv->tree.nColumns) { Tcl_Obj *empty = Tcl_NewStringObj("",0); Tcl_ListObjAppendElement(interp, item->valuesObj, empty); ++length; } /* Set value: */ |
︙ | ︙ | |||
2602 2603 2604 2605 2606 2607 2608 | } while (!isNew); } /* Create and configure new item: */ newItem = NewItem(); Tk_InitOptions( | | > | | | 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 | } while (!isNew); } /* Create and configure new item: */ newItem = NewItem(); Tk_InitOptions( interp, newItem, tv->tree.itemOptionTable, tv->core.tkwin); newItem->tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, NULL); if (ConfigureItem(interp, tv, newItem, objc, objv) != TCL_OK) { Tcl_DeleteHashEntry(entryPtr); FreeItem(newItem); return TCL_ERROR; } /* Store in hash table, link into tree: */ Tcl_SetHashValue(entryPtr, newItem); newItem->entryPtr = entryPtr; InsertItem(parent, sibling, newItem); tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); Tcl_SetObjResult(interp, ItemID(tv, newItem)); return TCL_OK; } /* + $tv detach $items -- * Unlink each item in $items from the tree. */ static int TreeviewDetachCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem **items; int i; |
︙ | ︙ | |||
2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 | } } for (i = 0; items[i]; ++i) { DetachItem(items[i]); } TtkRedisplayWidget(&tv->core); ckfree(items); return TCL_OK; } /* + $tv delete $items -- * Delete each item in $items. | > | 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 | } } for (i = 0; items[i]; ++i) { DetachItem(items[i]); } tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); ckfree(items); return TCL_OK; } /* + $tv delete $items -- * Delete each item in $items. |
︙ | ︙ | |||
2676 2677 2678 2679 2680 2681 2682 | */ static int TreeviewDeleteCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem **items, *delq; | | | | | > > > > > | > | > | 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 | */ static int TreeviewDeleteCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem **items, *delq; int i, selChange = 0; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "items"); return TCL_ERROR; } if (!(items = GetItemListFromObj(interp, tv, objv[2]))) { return TCL_ERROR; } /* Sanity-check: */ for (i = 0; items[i]; ++i) { if (items[i] == tv->tree.root) { ckfree(items); Tcl_SetObjResult(interp, Tcl_NewStringObj( "Cannot delete root item", -1)); Tcl_SetErrorCode(interp, "TTK", "TREE", "ROOT", NULL); return TCL_ERROR; } } /* Remove items from hash table. */ delq = 0; for (i = 0; items[i]; ++i) { if (items[i]->state & TTK_STATE_SELECTED) { selChange = 1; } else if (items[i]->selObj != NULL) { int length; Tcl_ListObjLength(interp, items[i]->selObj, &length); if (length > 0) { selChange = 1; } } delq = DeleteItems(items[i], delq); } /* Free items: */ while (delq) { TreeItem *next = delq->next; if (tv->tree.focus == delq) tv->tree.focus = 0; if (tv->tree.endPtr == delq) tv->tree.endPtr = 0; FreeItem(delq); delq = next; } ckfree(items); if (selChange) { Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL); } tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + $tv move $item $parent $index * Move $item to the specified $index in $parent's child list. */ |
︙ | ︙ | |||
2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 | } /* Move item: */ DetachItem(item); InsertItem(parent, sibling, item); TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- scrolling */ | > | 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 | } /* Move item: */ DetachItem(item); InsertItem(parent, sibling, item); tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- scrolling */ |
︙ | ︙ | |||
2816 2817 2818 2819 2820 2821 2822 | * Ensure that $item is visible. */ static int TreeviewSeeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item, *parent; | | > > > > > > > > | > > | | | > | < | > > > > | 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 | * Ensure that $item is visible. */ static int TreeviewSeeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item, *parent; int scrollRow1, scrollRow2, visibleRows; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } if (!(item = FindItem(interp, tv, objv[2]))) { return TCL_ERROR; } /* Make sure all ancestors are open: */ for (parent = item->parent; parent; parent = parent->parent) { if (!(parent->state & TTK_STATE_OPEN)) { parent->openObj = unshareObj(parent->openObj); Tcl_SetBooleanObj(parent->openObj, 1); parent->state |= TTK_STATE_OPEN; tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); } } if (tv->tree.rowPosNeedsUpdate) { UpdatePositionTree(tv); } /* Make sure item is visible: */ if (item->rowPos < tv->tree.titleRows) { return TCL_OK; } visibleRows = tv->tree.treeArea.height / tv->tree.rowHeight - tv->tree.titleRows; scrollRow1 = item->rowPos - tv->tree.titleRows; scrollRow2 = scrollRow1 + item->height - 1; if (scrollRow1 < tv->tree.yscroll.first || item->height > visibleRows) { TtkScrollTo(tv->tree.yscrollHandle, scrollRow1, 1); } else if (scrollRow2 >= tv->tree.yscroll.first + visibleRows) { scrollRow1 = 1 + scrollRow2 - visibleRows; TtkScrollTo(tv->tree.yscrollHandle, scrollRow1, 1); } return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- interactive column resize */ /* + $tree drag $column $newX -- * Set right edge of display column $column to x position $X */ static int TreeviewDragCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; int left = tv->tree.treeArea.x - tv->tree.xscroll.first; TkSizeT i = FirstColumn(tv); TreeColumn *column; int newx; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "column xposition"); return TCL_ERROR; } if ((column = FindColumn(interp, tv, objv[2])) == 0 || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) { return TCL_ERROR; } for (;i < tv->tree.nDisplayColumns; ++i) { TreeColumn *c = tv->tree.displayColumns[i]; int right = left + c->width; if (c == column) { if (i < (TkSizeT)tv->tree.nTitleColumns) { /* Unscrollable column, remove scroll shift */ right += tv->tree.xscroll.first; } DragColumn(tv, i, newx - right); TtkRedisplayWidget(&tv->core); return TCL_OK; } left = right; } |
︙ | ︙ | |||
2949 2950 2951 2952 2953 2954 2955 | SELECTION_SET, SELECTION_ADD, SELECTION_REMOVE, SELECTION_TOGGLE }; static const char *const selopStrings[] = { "set", "add", "remove", "toggle", NULL }; Treeview *tv = (Treeview *)recordPtr; | | | 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 | SELECTION_SET, SELECTION_ADD, SELECTION_REMOVE, SELECTION_TOGGLE }; static const char *const selopStrings[] = { "set", "add", "remove", "toggle", NULL }; Treeview *tv = (Treeview *)recordPtr; int selop, i, selChange = 0; TreeItem *item, **items; if (objc == 2) { Tcl_Obj *result = Tcl_NewListObj(0,0); for (item = tv->tree.root->children; item; item = NextPreorder(item)) { if (item->state & TTK_STATE_SELECTED) Tcl_ListObjAppendElement(NULL, result, ItemID(tv, item)); |
︙ | ︙ | |||
2980 2981 2982 2983 2984 2985 2986 2987 | if (!items) { return TCL_ERROR; } switch (selop) { case SELECTION_SET: for (item=tv->tree.root; item; item = NextPreorder(item)) { | > > | > | < > > > > > > > | > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 | if (!items) { return TCL_ERROR; } switch (selop) { case SELECTION_SET: /* Clear */ for (item=tv->tree.root; item; item = NextPreorder(item)) { if (item->state & TTK_STATE_SELECTED) { item->state &= ~TTK_STATE_SELECTED; selChange = 1; } } for (i=0; items[i]; ++i) { items[i]->state |= TTK_STATE_SELECTED; selChange = 1; } break; case SELECTION_ADD: for (i=0; items[i]; ++i) { if (!(items[i]->state & TTK_STATE_SELECTED)) { items[i]->state |= TTK_STATE_SELECTED; selChange = 1; } } break; case SELECTION_REMOVE: for (i=0; items[i]; ++i) { if (items[i]->state & TTK_STATE_SELECTED) { items[i]->state &= ~TTK_STATE_SELECTED; selChange = 1; } } break; case SELECTION_TOGGLE: for (i=0; items[i]; ++i) { items[i]->state ^= TTK_STATE_SELECTED; selChange = 1; } break; } ckfree(items); if (selChange) { Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL); } TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + SelObjChangeElement -- * Change an element in a cell selection list. */ static int SelObjChangeElement( Treeview *tv, Tcl_Obj *listPtr, Tcl_Obj *elemPtr, int add, TCL_UNUSED(int) /*remove*/, int toggle) { int i, nElements, anyChange = 0; TreeColumn *column, *elemColumn; Tcl_Obj **elements; elemColumn = FindColumn(NULL, tv, elemPtr); Tcl_ListObjGetElements(NULL, listPtr, &nElements, &elements); for (i = 0; i < nElements; i++) { column = FindColumn(NULL, tv, elements[i]); if (column == elemColumn) { if (add) { return anyChange; } Tcl_ListObjReplace(NULL, listPtr, i, 1, 0, NULL); anyChange = 1; return anyChange; } } if (add || toggle) { Tcl_ListObjAppendElement(NULL, listPtr, elemColumn->idObj); anyChange = 1; } return anyChange; } /* + $tree cellselection ?add|remove|set|toggle $items? */ static int CellSelectionRange( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *fromCell, Tcl_Obj *toCell, int add, int remove, int toggle) { TreeCell cellFrom, cellTo; TreeItem *item; Tcl_Obj *columns, **elements; int colno, nElements, i, fromNo, toNo, anyChange = 0; int set = !(add || remove || toggle); if (GetCellFromObj(interp, tv, fromCell, 1, &fromNo, &cellFrom) != TCL_OK) { return TCL_ERROR; } if (GetCellFromObj(interp, tv, toCell, 1, &toNo, &cellTo) != TCL_OK) { return TCL_ERROR; } /* Correct order. */ if (fromNo > toNo) { colno = fromNo; fromNo = toNo; toNo = colno; } /* Make a list of columns in this rectangle. */ columns = Tcl_NewListObj(0, 0); Tcl_IncrRefCount(columns); for (colno = fromNo; colno <= toNo; colno++) { Tcl_ListObjAppendElement(NULL, columns, tv->tree.displayColumns[colno]->idObj); } /* Set is the only operation that affects items outside its rectangle. * Start with clearing out. */ if (set) { anyChange = CellSelectionClear(tv); } /* Correct order. */ if (tv->tree.rowPosNeedsUpdate) { UpdatePositionTree(tv); } if (cellFrom.item->itemPos > cellTo.item->itemPos) { item = cellFrom.item; cellFrom.item = cellTo.item; cellTo.item = item; } /* Go through all items in this rectangle. */ for (item = cellFrom.item; item; item = NextPreorder(item)) { if (item->selObj != NULL) { item->selObj = unshareObj(item->selObj); Tcl_ListObjGetElements(NULL, columns, &nElements, &elements); for (i = 0; i < nElements; ++i) { anyChange |= SelObjChangeElement(tv, item->selObj, elements[i], add, remove, toggle); } } else { /* Set, add and toggle do the same thing when empty before. */ if (!remove) { item->selObj = columns; Tcl_IncrRefCount(item->selObj); anyChange = 1; } } if (item == cellTo.item) { break; } } Tcl_DecrRefCount(columns); if (anyChange) { Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL); } TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + $tree cellselection ?add|remove|set|toggle $items? */ static int TreeviewCellSelectionCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { enum { SELECTION_SET, SELECTION_ADD, SELECTION_REMOVE, SELECTION_TOGGLE }; static const char *const selopStrings[] = { "set", "add", "remove", "toggle", NULL }; Treeview *tv = (Treeview *)recordPtr; int selop, anyChange = 0; TkSizeT i, nCells; TreeCell *cells; TreeItem *item; if (objc == 2) { Tcl_Obj *result = Tcl_NewListObj(0,0); for (item = tv->tree.root->children; item; item = NextPreorder(item)) { if (item->selObj != NULL) { int n; TkSizeT elemc; Tcl_Obj **elemv; Tcl_ListObjGetElements(interp, item->selObj, &n, &elemv); elemc = n; for (i = 0; i < elemc; ++i) { Tcl_Obj *elem[2]; elem[0] = ItemID(tv, item); elem[1] = elemv[i]; Tcl_ListObjAppendElement(NULL, result, Tcl_NewListObj(2, elem)); } } } Tcl_SetObjResult(interp, result); return TCL_OK; } if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 2, objv, "?add|remove|set|toggle arg...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[2], selopStrings, sizeof(char *), "cellselection operation", 0, &selop) != TCL_OK) { return TCL_ERROR; } if (objc == 5) { switch (selop) { case SELECTION_SET: return CellSelectionRange(interp, tv, objv[3], objv[4], 0, 0, 0); case SELECTION_ADD: return CellSelectionRange(interp, tv, objv[3], objv[4], 1, 0, 0); case SELECTION_REMOVE: return CellSelectionRange(interp, tv, objv[3], objv[4], 0, 1, 0); case SELECTION_TOGGLE: return CellSelectionRange(interp, tv, objv[3], objv[4], 0, 0, 1); } } cells = GetCellListFromObj(interp, tv, objv[3], &nCells); if (cells == NULL) { return TCL_ERROR; } switch (selop) { case SELECTION_SET: anyChange = CellSelectionClear(tv); /*FALLTHRU*/ case SELECTION_ADD: for (i = 0; i < nCells; i++) { item = cells[i].item; if (item->selObj == NULL) { item->selObj = Tcl_NewListObj(0, 0); Tcl_IncrRefCount(item->selObj); } item->selObj = unshareObj(item->selObj); anyChange |= SelObjChangeElement(tv, item->selObj, cells[i].colObj, 1, 0, 0); } break; case SELECTION_REMOVE: for (i = 0; i < nCells; i++) { item = cells[i].item; if (item->selObj == NULL) { continue; } item->selObj = unshareObj(item->selObj); anyChange |= SelObjChangeElement(tv, item->selObj, cells[i].colObj, 0, 1, 0); } break; case SELECTION_TOGGLE: for (i = 0; i < nCells; i++) { item = cells[i].item; if (item->selObj == NULL) { item->selObj = Tcl_NewListObj(0, 0); Tcl_IncrRefCount(item->selObj); } item->selObj = unshareObj(item->selObj); anyChange = SelObjChangeElement(tv, item->selObj, cells[i].colObj, 0, 0, 1); } break; } ckfree(cells); if (anyChange) { Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL); } TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- tags and bindings. |
︙ | ︙ | |||
3112 3113 3114 3115 3116 3117 3118 | if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "tagName"); return TCL_ERROR; } tag = Ttk_GetTagFromObj(tagTable, objv[3]); | | > > | 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 | if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "tagName"); return TCL_ERROR; } tag = Ttk_GetTagFromObj(tagTable, objv[3]); /* remove the tag from all cells and items */ while (item) { RemoveTagFromCellsAtItem(item, tag); RemoveTag(item, tag); item = NextPreorder(item); } /* then remove the tag from the tag table */ Tk_DeleteAllBindings(tv->tree.bindingTable, tag); Ttk_DeleteTagFromTable(tagTable, tag); TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + $tv tag has $tag ?$item? |
︙ | ︙ | |||
3160 3161 3162 3163 3164 3165 3166 | return TCL_OK; } else { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?item?"); return TCL_ERROR; } } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 | return TCL_OK; } else { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?item?"); return TCL_ERROR; } } /* + $tv tag cell has $tag ?$cell? */ static int TreeviewCtagHasCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeCell cell; TkSizeT i, columnNumber; if (objc == 5) { /* Return list of all cells with tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[4]); TreeItem *item = tv->tree.root; Tcl_Obj *result = Tcl_NewListObj(0,0); while (item) { for (i = 0; i < item->nTagSets && i <= tv->tree.nColumns; ++i) { if (item->cellTagSets[i] != NULL) { if (Ttk_TagSetContains(item->cellTagSets[i], tag)) { Tcl_Obj *elem[2]; elem[0] = ItemID(tv, item); if (i == 0) { elem[1] = tv->tree.column0.idObj; } else { elem[1] = tv->tree.columns[i-1].idObj; } Tcl_ListObjAppendElement(NULL, result, Tcl_NewListObj(2, elem)); } } } item = NextPreorder(item); } Tcl_SetObjResult(interp, result); return TCL_OK; } else if (objc == 6) { /* Test if cell has specified tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[4]); int result = 0; if (GetCellFromObj(interp, tv, objv[5], 0, NULL, &cell) != TCL_OK) { return TCL_ERROR; } if (cell.column == &tv->tree.column0) { columnNumber = 0; } else { columnNumber = cell.column - tv->tree.columns + 1; } if (columnNumber < cell.item->nTagSets) { if (cell.item->cellTagSets[columnNumber] != NULL) { result = Ttk_TagSetContains( cell.item->cellTagSets[columnNumber], tag); } } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result)); return TCL_OK; } else { Tcl_WrongNumArgs(interp, 4, objv, "tagName ?cell?"); return TCL_ERROR; } } /* + $tv tag names */ static int TreeviewTagNamesCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; if (objc != 3) { |
︙ | ︙ | |||
3206 3207 3208 3209 3210 3211 3212 | tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); items = GetItemListFromObj(interp, tv, objv[4]); if (!items) { return TCL_ERROR; } | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > | 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 | tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); items = GetItemListFromObj(interp, tv, objv[4]); if (!items) { return TCL_ERROR; } for (i = 0; items[i]; ++i) { AddTag(items[i], tag); } ckfree(items); TtkRedisplayWidget(&tv->core); return TCL_OK; } /* Make sure tagset at column is allocated and initialised */ static void AllocCellTagSets(Treeview *tv, TreeItem *item, TkSizeT columnNumber) { TkSizeT i, newSize = MAX(columnNumber + 1, tv->tree.nColumns + 1); if (item->nTagSets < newSize) { if (item->cellTagSets == NULL) { item->cellTagSets = (Ttk_TagSet *) ckalloc(sizeof(Ttk_TagSet)*newSize); } else { item->cellTagSets = (Ttk_TagSet *) ckrealloc(item->cellTagSets, sizeof(Ttk_TagSet) * newSize); } for (i = item->nTagSets; i < newSize; i++) { item->cellTagSets[i] = NULL; } item->nTagSets = newSize; } if (item->cellTagSets[columnNumber] == NULL) { item->cellTagSets[columnNumber] = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, NULL); } } /* + $tv tag cell add $tag $cells */ static int TreeviewCtagAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; TreeCell *cells; TreeItem *item; TkSizeT i, nCells, columnNumber; if (objc != 6) { Tcl_WrongNumArgs(interp, 4, objv, "tagName cells"); return TCL_ERROR; } cells = GetCellListFromObj(interp, tv, objv[5], &nCells); if (cells == NULL) { return TCL_ERROR; } tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[4]); for (i = 0; i < nCells; i++) { if (cells[i].column == &tv->tree.column0) { columnNumber = 0; } else { columnNumber = cells[i].column - tv->tree.columns + 1; } item = cells[i].item; AllocCellTagSets(tv, item, columnNumber); Ttk_TagSetAdd(item->cellTagSets[columnNumber], tag); } ckfree(cells); TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + $tv tag remove $tag ?$items? */ static void RemoveTag(TreeItem *item, Ttk_Tag tag) { if (Ttk_TagSetRemove(item->tagset, tag)) { if (item->tagsObj) Tcl_DecrRefCount(item->tagsObj); item->tagsObj = Ttk_NewTagSetObj(item->tagset); Tcl_IncrRefCount(item->tagsObj); } } /* Remove tag from all cells at row 'item' */ static void RemoveTagFromCellsAtItem(TreeItem *item, Ttk_Tag tag) { TkSizeT i; for (i = 0; i < item->nTagSets; i++) { if (item->cellTagSets[i] != NULL) { Ttk_TagSetRemove(item->cellTagSets[i], tag); } } } static int TreeviewTagRemoveCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?items?"); return TCL_ERROR; } tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); if (objc == 5) { TreeItem **items = GetItemListFromObj(interp, tv, objv[4]); int i; if (!items) { return TCL_ERROR; } for (i = 0; items[i]; ++i) { RemoveTag(items[i], tag); } ckfree(items); } else if (objc == 4) { TreeItem *item = tv->tree.root; while (item) { RemoveTag(item, tag); item = NextPreorder(item); } } TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + $tv tag cell remove $tag ?$cells? */ static int TreeviewCtagRemoveCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; TreeCell *cells; TreeItem *item; TkSizeT i, nCells, columnNumber; if (objc < 5 || objc > 6) { Tcl_WrongNumArgs(interp, 4, objv, "tagName ?cells?"); return TCL_ERROR; } tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[4]); if (objc == 6) { cells = GetCellListFromObj(interp, tv, objv[5], &nCells); if (cells == NULL) { return TCL_ERROR; } for (i = 0; i < nCells; i++) { if (cells[i].column == &tv->tree.column0) { columnNumber = 0; } else { columnNumber = cells[i].column - tv->tree.columns + 1; } item = cells[i].item; AllocCellTagSets(tv, item, columnNumber); Ttk_TagSetRemove(item->cellTagSets[columnNumber], tag); } ckfree(cells); } else { item = tv->tree.root; while (item) { RemoveTagFromCellsAtItem(item, tag); item = NextPreorder(item); } } TtkRedisplayWidget(&tv->core); return TCL_OK; } static const Ttk_Ensemble TreeviewCtagCommands[] = { { "add", TreeviewCtagAddCommand,0 }, { "has", TreeviewCtagHasCommand,0 }, { "remove", TreeviewCtagRemoveCommand,0 }, { 0,0,0 } }; static const Ttk_Ensemble TreeviewTagCommands[] = { { "add", TreeviewTagAddCommand,0 }, { "bind", TreeviewTagBindCommand,0 }, { "cell", 0,TreeviewCtagCommands }, { "configure", TreeviewTagConfigureCommand,0 }, { "delete", TreeviewTagDeleteCommand,0 }, { "has", TreeviewTagHasCommand,0 }, { "names", TreeviewTagNamesCommand,0 }, { "remove", TreeviewTagRemoveCommand,0 }, { 0,0,0 } }; /*------------------------------------------------------------------------ * +++ Widget commands record. */ static const Ttk_Ensemble TreeviewCommands[] = { { "bbox", TreeviewBBoxCommand,0 }, { "cellselection" , TreeviewCellSelectionCommand,0 }, { "children", TreeviewChildrenCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, { "column", TreeviewColumnCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "delete", TreeviewDeleteCommand,0 }, { "detach", TreeviewDetachCommand,0 }, { "drag", TreeviewDragCommand,0 }, { "drop", TreeviewDropCommand,0 }, { "exists", TreeviewExistsCommand,0 }, { "focus", TreeviewFocusCommand,0 }, { "heading", TreeviewHeadingCommand,0 }, { "identify", TreeviewIdentifyCommand,0 }, { "index", TreeviewIndexCommand,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 } }; /*------------------------------------------------------------------------ |
︙ | ︙ | |||
3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 | TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT) TTK_NODE("Treeitem.image", TTK_PACK_LEFT) TTK_NODE("Treeitem.text", TTK_FILL_BOTH))) TTK_LAYOUT("Cell", TTK_GROUP("Treedata.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.text", TTK_FILL_BOTH))) TTK_LAYOUT("Heading", TTK_NODE("Treeheading.cell", TTK_FILL_BOTH) TTK_GROUP("Treeheading.border", TTK_FILL_BOTH, TTK_GROUP("Treeheading.padding", TTK_FILL_BOTH, TTK_NODE("Treeheading.image", TTK_PACK_RIGHT) TTK_NODE("Treeheading.text", TTK_FILL_X)))) TTK_LAYOUT("Row", TTK_NODE("Treeitem.row", TTK_FILL_BOTH)) TTK_END_LAYOUT_TABLE /*------------------------------------------------------------------------ * +++ Tree indicator element. */ typedef struct { | > > > > | 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 | TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT) TTK_NODE("Treeitem.image", TTK_PACK_LEFT) TTK_NODE("Treeitem.text", TTK_FILL_BOTH))) TTK_LAYOUT("Cell", TTK_GROUP("Treedata.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.image", TTK_PACK_LEFT) TTK_NODE("Treeitem.text", TTK_FILL_BOTH))) TTK_LAYOUT("Heading", TTK_NODE("Treeheading.cell", TTK_FILL_BOTH) TTK_GROUP("Treeheading.border", TTK_FILL_BOTH, TTK_GROUP("Treeheading.padding", TTK_FILL_BOTH, TTK_NODE("Treeheading.image", TTK_PACK_RIGHT) TTK_NODE("Treeheading.text", TTK_FILL_X)))) TTK_LAYOUT("Row", TTK_NODE("Treeitem.row", TTK_FILL_BOTH)) TTK_LAYOUT("Separator", TTK_NODE("Treeitem.separator", TTK_FILL_BOTH)) TTK_END_LAYOUT_TABLE /*------------------------------------------------------------------------ * +++ Tree indicator element. */ typedef struct { |
︙ | ︙ | |||
3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 | Ttk_Theme theme = Ttk_GetDefaultTheme(interp); RegisterWidget(interp, "ttk::treeview", &TreeviewWidgetSpec); Ttk_RegisterElement(interp, theme, "Treeitem.indicator", &TreeitemIndicatorElementSpec, 0); Ttk_RegisterElement(interp, theme, "Treeitem.row", &RowElementSpec, 0); Ttk_RegisterElement(interp, theme, "Treeheading.cell", &RowElementSpec, 0); Ttk_RegisterElement(interp, theme, "treearea", &ttkNullElementSpec, 0); Ttk_RegisterLayouts(theme, LayoutTable); } /*EOF*/ | > | 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 | Ttk_Theme theme = Ttk_GetDefaultTheme(interp); RegisterWidget(interp, "ttk::treeview", &TreeviewWidgetSpec); Ttk_RegisterElement(interp, theme, "Treeitem.indicator", &TreeitemIndicatorElementSpec, 0); Ttk_RegisterElement(interp, theme, "Treeitem.row", &RowElementSpec, 0); Ttk_RegisterElement(interp, theme, "Treeitem.separator", &RowElementSpec, 0); Ttk_RegisterElement(interp, theme, "Treeheading.cell", &RowElementSpec, 0); Ttk_RegisterElement(interp, theme, "treearea", &ttkNullElementSpec, 0); Ttk_RegisterLayouts(theme, LayoutTable); } /*EOF*/ |
Changes to generic/ttk/ttkWidget.c.
1 | /* | | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * Copyright © 2003, Joe English * * Core widget utilities. */ #include "tkInt.h" #include "ttkThemeInt.h" #include "ttkWidget.h" /*------------------------------------------------------------------------ * +++ Internal helper routines. */ /* UpdateLayout -- * Call the widget's get-layout hook to recompute corePtr->layout. * Returns TCL_OK if successful, returns TCL_ERROR and leaves |
︙ | ︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | } if (!(corePtr->flags & REDISPLAY_PENDING)) { Tcl_DoWhenIdle(DrawWidget, corePtr); corePtr->flags |= REDISPLAY_PENDING; } } /* TtkResizeWidget -- * Recompute widget size, schedule geometry propagation and redisplay. */ void TtkResizeWidget(WidgetCore *corePtr) { if (corePtr->flags & WIDGET_DESTROYED) { return; } | > > > > > > > > > > > > > > | < | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | } if (!(corePtr->flags & REDISPLAY_PENDING)) { Tcl_DoWhenIdle(DrawWidget, corePtr); corePtr->flags |= REDISPLAY_PENDING; } } /* * WidgetWorldChanged -- * Default Tk_ClassWorldChangedProc() for widgets. * Invoked whenever fonts or other system resources are changed; * recomputes geometry. */ static void WidgetWorldChanged(ClientData clientData) { WidgetCore *corePtr = (WidgetCore *)clientData; (void)UpdateLayout(corePtr->interp, corePtr); SizeChanged(corePtr); TtkRedisplayWidget(corePtr); } /* TtkResizeWidget -- * Recompute widget size, schedule geometry propagation and redisplay. */ void TtkResizeWidget(WidgetCore *corePtr) { if (corePtr->flags & WIDGET_DESTROYED) { return; } WidgetWorldChanged(corePtr); } /* TtkWidgetChangeState -- * Set / clear the specified bits in the 'state' flag, */ void TtkWidgetChangeState(WidgetCore *corePtr, unsigned int setBits, unsigned int clearBits) |
︙ | ︙ | |||
308 309 310 311 312 313 314 | case EnterNotify: corePtr->state |= TTK_STATE_HOVER; TtkRedisplayWidget(corePtr); break; case VirtualEvent: { const char *name = ((XVirtualEvent *)eventPtr)->name; if ((name != NULL) && !strcmp("ThemeChanged", name)) { | < | < < < < < < < < < < < < < < | | | | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | case EnterNotify: corePtr->state |= TTK_STATE_HOVER; TtkRedisplayWidget(corePtr); break; case VirtualEvent: { const char *name = ((XVirtualEvent *)eventPtr)->name; if ((name != NULL) && !strcmp("ThemeChanged", name)) { WidgetWorldChanged(corePtr); } break; } default: /* can't happen... */ break; } } static const Tk_ClassProcs widgetClassProcs = { sizeof(Tk_ClassProcs), /* size */ WidgetWorldChanged, /* worldChangedProc */ NULL, /* createProc */ NULL /* modalProc */ }; /* * TtkWidgetConstructorObjCmd -- * General-purpose widget constructor command implementation. * ClientData is a WidgetSpec *. */ |
︙ | ︙ | |||
790 791 792 793 794 795 796 797 798 799 800 | element = Ttk_IdentifyElement(corePtr->layout, x, y); if (element) { const char *elementName = Ttk_ElementName(element); Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1)); } return TCL_OK; } /*EOF*/ | > > > > > > > > > > > > > > > > > > > > | 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | element = Ttk_IdentifyElement(corePtr->layout, x, y); 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*/ |
Changes to generic/ttk/ttkWidget.h.
︙ | ︙ | |||
85 86 87 88 89 90 91 92 93 | MODULE_SCOPE void TtkWidgetDoLayout(void *recordPtr); MODULE_SCOPE void TtkWidgetDisplay(void *recordPtr, Drawable); MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask); /* Common widget commands: */ MODULE_SCOPE int TtkWidgetConfigureCommand( void *,Tcl_Interp *, int, Tcl_Obj*const[]); | > > | | | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | MODULE_SCOPE void TtkWidgetDoLayout(void *recordPtr); MODULE_SCOPE void TtkWidgetDisplay(void *recordPtr, Drawable); 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 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 TtkWidgetStyleCommand( void *,Tcl_Interp *, int, Tcl_Obj*const[]); /* Widget constructor: */ MODULE_SCOPE int TtkWidgetConstructorObjCmd( ClientData, Tcl_Interp*, int, Tcl_Obj*const[]); #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ TtkWidgetConstructorObjCmd, (void *)specPtr,NULL) /* WIDGET_TAKEFOCUS_TRUE -- * WIDGET_TAKEFOCUS_FALSE -- * Add one or the other of these to each OptionSpecs table * to indicate whether the widget should take focus * during keyboard traversal. */ |
︙ | ︙ | |||
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | Tcl_Interp *interp, Ttk_TagTable, Tcl_Obj *objPtr); MODULE_SCOPE Tcl_Obj *Ttk_NewTagSetObj(Ttk_TagSet); MODULE_SCOPE void Ttk_FreeTagSet(Ttk_TagSet); MODULE_SCOPE int Ttk_TagSetContains(Ttk_TagSet, Ttk_Tag tag); MODULE_SCOPE int Ttk_TagSetAdd(Ttk_TagSet, Ttk_Tag tag); MODULE_SCOPE int Ttk_TagSetRemove(Ttk_TagSet, Ttk_Tag tag); MODULE_SCOPE void Ttk_TagSetValues(Ttk_TagTable, Ttk_TagSet, void *record); MODULE_SCOPE void Ttk_TagSetApplyStyle(Ttk_TagTable,Ttk_Style,Ttk_State,void*); /* * String tables for widget resource specifications: */ | > > | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | Tcl_Interp *interp, Ttk_TagTable, Tcl_Obj *objPtr); MODULE_SCOPE Tcl_Obj *Ttk_NewTagSetObj(Ttk_TagSet); MODULE_SCOPE void Ttk_FreeTagSet(Ttk_TagSet); MODULE_SCOPE int Ttk_TagSetContains(Ttk_TagSet, Ttk_Tag tag); MODULE_SCOPE int Ttk_TagSetAdd(Ttk_TagSet, Ttk_Tag tag); MODULE_SCOPE int Ttk_TagSetAddSet(Ttk_TagSet, Ttk_TagSet); MODULE_SCOPE int Ttk_TagSetRemove(Ttk_TagSet, Ttk_Tag tag); MODULE_SCOPE void Ttk_TagSetDefaults(Ttk_TagTable, Ttk_Style, void *); MODULE_SCOPE void Ttk_TagSetValues(Ttk_TagTable, Ttk_TagSet, void *record); MODULE_SCOPE void Ttk_TagSetApplyStyle(Ttk_TagTable,Ttk_Style,Ttk_State,void*); /* * String tables for widget resource specifications: */ |
︙ | ︙ |
Changes to library/bgerror.tcl.
1 2 3 4 5 6 7 8 | # bgerror.tcl -- # # Implementation of the bgerror procedure. It posts a dialog box with # the error message and gives the user a chance to see a more detailed # stack trace, and possible do something more interesting with that # trace (like save it to a log). This is adapted from work done by # Donal K. Fellows. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # bgerror.tcl -- # # Implementation of the bgerror procedure. It posts a dialog box with # the error message and gives the user a chance to see a more detailed # stack trace, and possible do something more interesting with that # trace (like save it to a log). This is adapted from work done by # Donal K. Fellows. # # Copyright © 1998-2000 Ajuba Solutions. # Copyright © 2007 ActiveState Software Inc. # Copyright © 2007 Daniel A. Steffen <[email protected]> # Copyright © 2009 Pat Thoyts <[email protected]> namespace eval ::tk::dialog::error { namespace import -force ::tk::msgcat::* namespace export bgerror option add *ErrorDialog.function.text [mc "Save To Log"] \ |
︙ | ︙ |
Changes to library/button.tcl.
︙ | ︙ | |||
37 38 39 40 41 42 43 | tk::ButtonUp %W } bind Checkbutton <Leave> { tk::ButtonLeave %W } } if {"win32" eq [tk windowingsystem]} { | | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | tk::ButtonUp %W } bind Checkbutton <Leave> { tk::ButtonLeave %W } } if {"win32" eq [tk windowingsystem]} { bind Checkbutton <=> { tk::CheckRadioInvoke %W select } bind Checkbutton <+> { tk::CheckRadioInvoke %W select } bind Checkbutton <minus> { tk::CheckRadioInvoke %W deselect } bind Checkbutton <Button-1> { tk::CheckRadioDown %W |
︙ | ︙ |
Changes to library/choosedir.tcl.
1 2 3 4 | # choosedir.tcl -- # # Choose directory dialog implementation for Unix/Mac. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # choosedir.tcl -- # # Choose directory dialog implementation for Unix/Mac. # # Copyright © 1998-2000 Scriptics Corporation. # All rights reserved. # Make sure the tk::dialog namespace, in which all dialogs should live, exists namespace eval ::tk::dialog {} namespace eval ::tk::dialog::file {} # Make the chooseDir namespace inside the dialog namespace |
︙ | ︙ |
Changes to library/comdlg.tcl.
︙ | ︙ | |||
25 26 27 28 29 30 31 | # w = widget record to modify. Must be the pathname of a widget. # # specs = { # {-commandlineswitch resourceName ResourceClass defaultValue verifier} # {....} # } # | | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # w = widget record to modify. Must be the pathname of a widget. # # specs = { # {-commandlineswitch resourceName ResourceClass defaultValue verifier} # {....} # } # # flags = a list of flags. Currently supported flags are: # DONTSETDEFAULTS = skip default values setting # # argList = The list of "-option value" pairs. # proc tclParseConfigSpec {w specs flags argList} { upvar #0 $w data # 1: Put the specs in associative arrays for faster access |
︙ | ︙ | |||
59 60 61 62 63 64 65 | } return -code error -errorcode {TK VALUE_MISSING} \ "value for \"$cmdsw\" missing" } # 2: set the default values # | > | | > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | } return -code error -errorcode {TK VALUE_MISSING} \ "value for \"$cmdsw\" missing" } # 2: set the default values # if {"DONTSETDEFAULTS" ni $flags} { foreach cmdsw [array names cmd] { set data($cmdsw) $def($cmdsw) } } # 3: parse the argument list # foreach {cmdsw value} $argList { if {![info exists cmd($cmdsw)]} { return -code error -errorcode [list TK LOOKUP OPTION $cmdsw] \ |
︙ | ︙ |
Changes to library/console.tcl.
︙ | ︙ | |||
87 88 89 90 91 92 93 | menu .menubar.help -tearoff 0 AmpMenuArgs .menubar.help add command -label [mc &About...] \ -command tk::ConsoleAbout } AmpMenuArgs .menubar.edit add separator if {$::tk::console::useFontchooser} { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | menu .menubar.help -tearoff 0 AmpMenuArgs .menubar.help add command -label [mc &About...] \ -command tk::ConsoleAbout } AmpMenuArgs .menubar.edit add separator if {$::tk::console::useFontchooser} { if {[tk windowingsystem] eq "aqua"} { .menubar.edit add command -label tk_choose_font_marker set index [.menubar.edit index tk_choose_font_marker] .menubar.edit entryconfigure $index \ -label [mc "Show Fonts"]\ -accelerator "$mod-T"\ -command [list ::tk::console::FontchooserToggle] bind Console <<TkFontchooserVisibility>> \ [list ::tk::console::FontchooserVisibility $index] ::tk::console::FontchooserVisibility $index } else { AmpMenuArgs .menubar.edit add command -label [mc "&Font..."] \ -command [list ::tk::console::FontchooserToggle] } bind Console <FocusIn> [list ::tk::console::FontchooserFocus %W 1] bind Console <FocusOut> [list ::tk::console::FontchooserFocus %W 0] } AmpMenuArgs .menubar.edit add command -label [mc "&Increase Font Size"] \ -accel "$mod++" -command {event generate .console <<Console_FontSizeIncr>>} AmpMenuArgs .menubar.edit add command -label [mc "&Decrease Font Size"] \ -accel "$mod+-" -command {event generate .console <<Console_FontSizeDecr>>} AmpMenuArgs .menubar.edit add command -label [mc "Fit To Screen Width"] \ -command {event generate .console <<Console_FitScreenWidth>>} if {[tk windowingsystem] eq "aqua"} { .menubar add cascade -label [mc Window] -menu [menu .menubar.window] .menubar add cascade -label [mc Help] -menu [menu .menubar.help] } . configure -menu .menubar # See if we can find a better font than the TkFixedFont catch {font create TkConsoleFont {*}[font configure TkFixedFont]} set families [font families] switch -exact -- [tk windowingsystem] { aqua { set preferred {Monaco 10} } win32 { set preferred {ProFontWindows 8 Consolas 8} } default { set preferred {} } } foreach {family size} $preferred { if {$family in $families} { font configure TkConsoleFont -family $family -size $size break } } # Provide the right border for the text widget (platform dependent). ::ttk::style layout ConsoleFrame { Entry.field -sticky news -border 1 -children { ConsoleFrame.padding -sticky news } } ::ttk::frame .consoleframe -style ConsoleFrame set con [text .console -yscrollcommand [list .sb set] -setgrid true \ -borderwidth 0 -highlightthickness 0 -font TkConsoleFont] if {[tk windowingsystem] eq "aqua"} { scrollbar .sb -command [list $con yview] } else { ::ttk::scrollbar .sb -command [list $con yview] } pack .sb -in .consoleframe -fill both -side right -padx 1 -pady 1 pack $con -in .consoleframe -fill both -expand 1 -side left -padx 1 -pady 1 pack .consoleframe -fill both -expand 1 -side left ConsoleBind $con |
︙ | ︙ | |||
211 212 213 214 215 216 217 | proc ::tk::ConsoleSource {} { set filename [tk_getOpenFile -defaultextension .tcl -parent . \ -title [mc "Select a file to source"] \ -filetypes [list \ [list [mc "Tcl Scripts"] .tcl] \ [list [mc "All Files"] *]]] if {$filename ne ""} { | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | proc ::tk::ConsoleSource {} { set filename [tk_getOpenFile -defaultextension .tcl -parent . \ -title [mc "Select a file to source"] \ -filetypes [list \ [list [mc "Tcl Scripts"] .tcl] \ [list [mc "All Files"] *]]] if {$filename ne ""} { set cmd [list source -encoding utf-8 $filename] if {[catch {consoleinterp eval $cmd} result]} { ConsoleOutput stderr "$result\n" } } } # ::tk::ConsoleInvoke -- |
︙ | ︙ | |||
269 270 271 272 273 274 275 | # cmd - Which action to take: prev, next, reset. set ::tk::HistNum 1 proc ::tk::ConsoleHistory {cmd} { variable HistNum switch $cmd { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | # cmd - Which action to take: prev, next, reset. set ::tk::HistNum 1 proc ::tk::ConsoleHistory {cmd} { variable HistNum switch $cmd { prev { incr HistNum -1 if {$HistNum == 0} { set cmd {history event [expr {[history nextid] -1}]} } else { set cmd "history event $HistNum" } if {[catch {consoleinterp eval $cmd} cmd]} { incr HistNum return } .console delete promptEnd end .console insert promptEnd $cmd {input stdin} .console see end } next { incr HistNum if {$HistNum == 0} { set cmd {history event [expr {[history nextid] -1}]} } elseif {$HistNum > 0} { set cmd "" set HistNum 1 } else { set cmd "history event $HistNum" } if {$cmd ne ""} { catch {consoleinterp eval $cmd} cmd } .console delete promptEnd end .console insert promptEnd $cmd {input stdin} .console see end } reset { set HistNum 1 } } } # ::tk::ConsolePrompt -- # This procedure draws the prompt. If tcl_prompt1 or tcl_prompt2 # exists in the main interpreter it will be called to generate the # prompt. Otherwise, a hard coded default prompt is printed. # # Arguments: # partial - Flag to specify which prompt to print. proc ::tk::ConsolePrompt {{partial normal}} { set w .console if {$partial eq "normal"} { set temp [$w index "end - 1 char"] $w mark set output end if {[consoleinterp eval "info exists tcl_prompt1"]} { consoleinterp eval "eval \[set tcl_prompt1\]" } else { puts -nonewline [EvalAttached $::tk::console::defaultPrompt] } } else { set temp [$w index output] $w mark set output end if {[consoleinterp eval "info exists tcl_prompt2"]} { consoleinterp eval "eval \[set tcl_prompt2\]" } else { puts -nonewline "> " } } flush stdout $w mark set output $temp ::tk::TextSetCursor $w end $w mark set promptEnd insert $w mark gravity promptEnd left ::tk::console::ConstrainBuffer $w $::tk::console::maxLines $w see end } # Copy selected text from the console proc ::tk::console::Copy {w} { if {![catch {set data [$w get sel.first sel.last]}]} { clipboard clear -displayof $w clipboard append -displayof $w $data } } # Copies selected text. If the selection is within the current active edit # region then it will be cut, if not it is only copied. proc ::tk::console::Cut {w} { if {![catch {set data [$w get sel.first sel.last]}]} { clipboard clear -displayof $w clipboard append -displayof $w $data if {[$w compare sel.first >= output]} { $w delete sel.first sel.last } } } # Paste text from the clipboard proc ::tk::console::Paste {w} { catch { set clip [::tk::GetSelection $w CLIPBOARD] set list [split $clip \n\r] tk::ConsoleInsert $w [lindex $list 0] foreach x [lrange $list 1 end] { $w mark set insert {end - 1c} tk::ConsoleInsert $w "\n" tk::ConsoleInvoke tk::ConsoleInsert $w $x } } } # Fit TkConsoleFont to window width proc ::tk::console::FitScreenWidth {w} { set width [winfo screenwidth $w] set cwidth [$w cget -width] set s -50 set fit 0 array set fi [font configure TkConsoleFont] while {$s < 0} { set fi(-size) $s set f [font create {*}[array get fi]] set c [font measure $f "eM"] font delete $f if {$c * $cwidth < 1.667 * $width} { font configure TkConsoleFont -size $s break } incr s 2 } } # ::tk::ConsoleBind -- # This procedure first ensures that the default bindings for the Text # class have been defined. Then certain bindings are overridden for |
︙ | ︙ | |||
420 421 422 423 424 425 426 | ## ...or any Control-v binding (would block <<Paste>>) bind Console <Control-v> {} # For the moment, transpose isn't enabled until the console # gets and overhaul of how it handles input -- hobbs bind Console <Control-t> {} | | > > | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | ## ...or any Control-v binding (would block <<Paste>>) bind Console <Control-v> {} # For the moment, transpose isn't enabled until the console # gets and overhaul of how it handles input -- hobbs bind Console <Control-t> {} # Ignore all Alt, Meta, Control, Command, and Fn keypresses unless explicitly bound. # Otherwise, if a widget binding for one of these is defined, the # <Keypress> class binding will also fire and insert the character # which is wrong. bind Console <Alt-Key> {# nothing } bind Console <Meta-Key> {# nothing} bind Console <Control-Key> {# nothing} bind Console <Command-Key> {# nothing} bind Console <Fn-Key> {# nothing} foreach {ev key} { <<Console_NextImmediate>> <Control-n> <<Console_PrevImmediate>> <Control-p> <<Console_PrevSearch>> <Control-r> <<Console_NextSearch>> <Control-s> |
︙ | ︙ | |||
450 451 452 453 454 455 456 | <<Console_Eval>> <KP_Enter> <<Console_Clear>> <Control-l> <<Console_KillLine>> <Control-k> <<Console_Transpose>> <Control-t> <<Console_ClearLine>> <Control-u> <<Console_SaveCommand>> <Control-z> | | > > < < < < < < < < | | < | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | <<Console_Eval>> <KP_Enter> <<Console_Clear>> <Control-l> <<Console_KillLine>> <Control-k> <<Console_Transpose>> <Control-t> <<Console_ClearLine>> <Control-u> <<Console_SaveCommand>> <Control-z> <<Console_FontSizeIncr>> <Control-+> <<Console_FontSizeDecr>> <Control-minus> <<Console_FontSizeIncr>> <Command-+> <<Console_FontSizeDecr>> <Command-minus> } { event add $ev $key bind Console $key {} } if {$::tk::console::useFontchooser} { bind Console <Command-t> [list ::tk::console::FontchooserToggle] } bind Console <<Console_Expand>> { if {[%W compare insert > promptEnd]} { ::tk::console::Expand %W } } bind Console <<Console_ExpandFile>> { |
︙ | ︙ | |||
590 591 592 593 594 595 596 | bind Console <Key> { tk::ConsoleInsert %W %A } bind Console <F9> { eval destroy [winfo child .] source -encoding utf-8 [file join $tk_library console.tcl] } | < | | < | | | | | | | | | | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | bind Console <Key> { tk::ConsoleInsert %W %A } bind Console <F9> { eval destroy [winfo child .] source -encoding utf-8 [file join $tk_library console.tcl] } bind Console <Command-q> { exit } bind Console <<Cut>> { ::tk::console::Cut %W } bind Console <<Copy>> { ::tk::console::Copy %W } bind Console <<Paste>> { ::tk::console::Paste %W } bind Console <<Console_FontSizeIncr>> { set size [font configure TkConsoleFont -size] if {$size < 0} {set sign -1} else {set sign 1} set size [expr {(abs($size) + 1) * $sign}] font configure TkConsoleFont -size $size if {$::tk::console::useFontchooser} { tk fontchooser configure -font TkConsoleFont } } bind Console <<Console_FontSizeDecr>> { set size [font configure TkConsoleFont -size] if {abs($size) < 2} { return } if {$size < 0} {set sign -1} else {set sign 1} set size [expr {(abs($size) - 1) * $sign}] font configure TkConsoleFont -size $size if {$::tk::console::useFontchooser} { tk fontchooser configure -font TkConsoleFont } } bind Console <<Console_FitScreenWidth>> { ::tk::console::FitScreenWidth %W } |
︙ | ︙ |
Changes to library/demos/cscroll.tcl.
︙ | ︙ | |||
110 111 112 113 114 115 116 | } } if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} { # Support for mousewheels on Linux/Unix commonly comes through mapping # the wheel to the extended buttons. If you have a mousewheel, find # Linux configuration info at: | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | } } if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} { # Support for mousewheels on Linux/Unix commonly comes through mapping # the wheel to the extended buttons. If you have a mousewheel, find # Linux configuration info at: # https://linuxreviews.org/HOWTO_change_the_mouse_speed_in_X bind $c <Button-4> { if {!$tk_strictMotif} { %W yview scroll -5 units } } bind $c <Shift-Button-4> { if {!$tk_strictMotif} { |
︙ | ︙ |
Changes to library/demos/en.msg.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ::msgcat::mcset en "Widget Demonstration" ::msgcat::mcset en "tkWidgetDemo" ::msgcat::mcset en "&File" ::msgcat::mcset en "About..." ::msgcat::mcset en "&About..." ::msgcat::mcset en "<F1>" ::msgcat::mcset en "&Quit" ::msgcat::mcset en "Meta+Q" ;# Displayed hotkey ::msgcat::mcset en "Meta-q" ;# Actual binding sequence ::msgcat::mcset en "Ctrl+Q" ;# Displayed hotkey ::msgcat::mcset en "Control-q" ;# Actual binding sequence ::msgcat::mcset en "Variable values" ::msgcat::mcset en "Variable values:" ::msgcat::mcset en "OK" ::msgcat::mcset en "Run the \"%s\" sample program" ::msgcat::mcset en "Dismiss" ::msgcat::mcset en "Rerun Demo" ::msgcat::mcset en "Demo code: %s" ::msgcat::mcset en "About Widget Demo" | > > | < < < < < < > | | | | | < | < | | < < < | | < | > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | ::msgcat::mcset en "Widget Demonstration" ::msgcat::mcset en "tkWidgetDemo" ::msgcat::mcset en "&File" ::msgcat::mcset en "About..." ::msgcat::mcset en "&About..." ::msgcat::mcset en "<F1>" ::msgcat::mcset en "&Quit" ::msgcat::mcset en "Meta+Q" ;# Displayed hotkey ::msgcat::mcset en "Meta-q" ;# Actual binding sequence ::msgcat::mcset en "Ctrl+Q" ;# Displayed hotkey ::msgcat::mcset en "Control-q" ;# Actual binding sequence ::msgcat::mcset en "See Variables" ::msgcat::mcset en "Variable values" ::msgcat::mcset en "Variable values:" ::msgcat::mcset en "OK" ::msgcat::mcset en "Run the \"%s\" sample program" ::msgcat::mcset en "Dismiss" ::msgcat::mcset en "Rerun Demo" ::msgcat::mcset en "Print Code" ::msgcat::mcset en "Demo code: %s" ::msgcat::mcset en "About Widget Demo" ::msgcat::mcset en "Tk widget demonstration" ::msgcat::mcset en "Copyright © %s" ::msgcat::mcset en "Tk Widget Demonstrations" ::msgcat::mcset en "This application provides a front end for several short scripts" ::msgcat::mcset en "that demonstrate what you can do with Tk widgets. Each of the" ::msgcat::mcset en "numbered lines below describes a demonstration; you can click on" ::msgcat::mcset en "it to invoke the demonstration. Once the demonstration window" ::msgcat::mcset en "appears, you can click the" ::msgcat::mcset en "See Code" "See Code" ;# This is also button text! ::msgcat::mcset en "button to see the Tcl/Tk code that created the demonstration. If" ::msgcat::mcset en "you wish, you can edit the code and click the" ::msgcat::mcset en "button in the code window to reinvoke the demonstration with the" ::msgcat::mcset en "modified code." ::msgcat::mcset en "Labels, buttons, checkbuttons, and radiobuttons" ::msgcat::mcset en "Labels (text and bitmaps)" ::msgcat::mcset en "Labels and UNICODE text" ::msgcat::mcset en "Buttons" ::msgcat::mcset en "Check-buttons (select any of a group)" ::msgcat::mcset en "Radio-buttons (select one of a group)" ::msgcat::mcset en "A 15-puzzle game made out of buttons" ::msgcat::mcset en "Iconic buttons that use bitmaps" ::msgcat::mcset en "Two labels displaying images" ::msgcat::mcset en "A simple user interface for viewing images" ::msgcat::mcset en "Labelled frames" ::msgcat::mcset en "Listboxes" ::msgcat::mcset en "The 50 states" ::msgcat::mcset en "Colors: change the color scheme for the application" ::msgcat::mcset en "A collection of famous and infamous sayings" ::msgcat::mcset en "Entries and Spin-boxes" ::msgcat::mcset en "Entries without scrollbars" ::msgcat::mcset en "Entries with scrollbars" ::msgcat::mcset en "Validated entries and password fields" ::msgcat::mcset en "Spin-boxes" ::msgcat::mcset en "Simple Rolodex-like form" ::msgcat::mcset en "Text" ::msgcat::mcset en "Basic editable text" ::msgcat::mcset en "Text display styles" ::msgcat::mcset en "Hypertext (tag bindings)" ::msgcat::mcset en "A text widget with embedded windows" ::msgcat::mcset en "A search tool built with a text widget" ::msgcat::mcset en "Canvases" ::msgcat::mcset en "The canvas item types" ::msgcat::mcset en "A simple 2-D plot" ::msgcat::mcset en "Text items in canvases" ::msgcat::mcset en "An editor for arrowheads on canvas lines" ::msgcat::mcset en "A ruler with adjustable tab stops" ::msgcat::mcset en "A building floor plan" ::msgcat::mcset en "A simple scrollable canvas" ::msgcat::mcset en "Scales" ::msgcat::mcset en "Horizontal scale" ::msgcat::mcset en "Vertical scale" ::msgcat::mcset en "Paned Windows" ::msgcat::mcset en "Horizontal paned window" ::msgcat::mcset en "Vertical paned window" ::msgcat::mcset en "Menus" ::msgcat::mcset en "Menus and cascades (sub-menus)" ::msgcat::mcset en "Menu-buttons" ::msgcat::mcset en "Common Dialogs" ::msgcat::mcset en "Message boxes" ::msgcat::mcset en "File selection dialog" ::msgcat::mcset en "Color picker" ::msgcat::mcset en "Font selection dialog" ::msgcat::mcset en "System tray icon and notification" ::msgcat::mcset en "Printing from canvas and text widgets" ::msgcat::mcset en "Animation" ::msgcat::mcset en "Animated labels" ::msgcat::mcset en "Animated wave" ::msgcat::mcset en "Pendulum simulation" ::msgcat::mcset en "A celebration of Rube Goldberg" ::msgcat::mcset en "Miscellaneous" ::msgcat::mcset en "The built-in bitmaps" ::msgcat::mcset en "A dialog box with a local grab" ::msgcat::mcset en "A dialog box with a global grab" ::msgcat::mcset en "Window icons and badges" |
Changes to library/demos/entry3.tcl.
︙ | ︙ | |||
60 61 62 63 64 65 66 | after 200 [list focusAndFlash $W $fg $bg [expr {$count-1}]] } } labelframe $w.l1 -text "Integer Entry" # Alternatively try using {string is digit} for arbitrary length numbers, # and not just 32-bit ones. | | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | after 200 [list focusAndFlash $W $fg $bg [expr {$count-1}]] } } labelframe $w.l1 -text "Integer Entry" # Alternatively try using {string is digit} for arbitrary length numbers, # and not just 32-bit ones. entry $w.l1.e -validate focus -validatecommand {string is integer %P} $w.l1.e configure -invalidcommand \ "focusAndFlash %W [$w.l1.e cget -fg] [$w.l1.e cget -bg]" pack $w.l1.e -fill x -expand 1 -padx 1m -pady 1m labelframe $w.l2 -text "Length-Constrained Entry" entry $w.l2.e -validate key -invcmd bell -validatecommand {expr {[string length %P]<10}} pack $w.l2.e -fill x -expand 1 -padx 1m -pady 1m ### PHONE NUMBER ENTRY ### # Note that the source to this is quite a bit longer as the behaviour # demonstrated is a lot more ambitious than with the others. # Initial content for the third entry widget |
︙ | ︙ | |||
157 158 159 160 161 162 163 | bell return -code break } } labelframe $w.l3 -text "US Phone-Number Entry" entry $w.l3.e -validate key -invcmd bell -textvariable entry3content \ | | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | bell return -code break } } labelframe $w.l3 -text "US Phone-Number Entry" entry $w.l3.e -validate key -invcmd bell -textvariable entry3content \ -validatecommand {validatePhoneChange %W %v %i %S} # Click to focus goes to the first editable character... bind $w.l3.e <FocusIn> { if {"%d" ne "NotifyAncestor"} { %W icursor 3 after idle {%W selection clear} } } bind $w.l3.e <<PrevChar>> {phoneSkipLeft %W} bind $w.l3.e <<NextChar>> {phoneSkipRight %W} pack $w.l3.e -fill x -expand 1 -padx 1m -pady 1m labelframe $w.l4 -text "Password Entry" entry $w.l4.e -validate key -show "*" -validatecommand {expr {[string length %P]<=8}} pack $w.l4.e -fill x -expand 1 -padx 1m -pady 1m lower [frame $w.mid] grid $w.l1 $w.l2 -in $w.mid -padx 3m -pady 1m -sticky ew grid $w.l3 $w.l4 -in $w.mid -padx 3m -pady 1m -sticky ew grid columnconfigure $w.mid {0 1} -uniform 1 pack $w.msg -side top pack $w.mid -fill both -expand 1 |
Changes to library/demos/floor.tcl.
︙ | ︙ | |||
329 330 331 332 333 334 335 | # # Arguments: # w - The canvas window. # color - Color to use for drawing foreground information. proc fg1 {w color} { global floorLabels floorItems | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | # # Arguments: # w - The canvas window. # color - Color to use for drawing foreground information. proc fg1 {w color} { global floorLabels floorItems set i [$w create polygon 375 246 375 172 341 172 341 246 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 101 set {floorItems(101)} $i $w create text 358 209 -text 101 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 307 240 339 240 339 206 307 206 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) {Pub Lift1} set {floorItems(Pub Lift1)} $i $w create text 323 223 -text {Pub Lift1} -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 339 205 307 205 307 171 339 171 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) {Priv Lift1} set {floorItems(Priv Lift1)} $i $w create text 323 188 -text {Priv Lift1} -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 42 389 42 337 1 337 1 389 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 110 set {floorItems(110)} $i $w create text 21.5 363 -text 110 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 59 389 59 385 90 385 90 337 44 337 44 389 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 109 set {floorItems(109)} $i $w create text 67 363 -text 109 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 51 300 51 253 6 253 6 300 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 111 set {floorItems(111)} $i $w create text 28.5 276.5 -text 111 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 98 248 98 309 79 309 79 248 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 117B set {floorItems(117B)} $i $w create text 88.5 278.5 -text 117B -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 51 251 51 204 6 204 6 251 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 112 set {floorItems(112)} $i $w create text 28.5 227.5 -text 112 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 6 156 51 156 51 203 6 203 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 113 set {floorItems(113)} $i $w create text 28.5 179.5 -text 113 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 85 169 79 169 79 192 85 192 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 117A set {floorItems(117A)} $i $w create text 82 180.5 -text 117A -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 77 302 77 168 53 168 53 302 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 117 set {floorItems(117)} $i $w create text 65 235 -text 117 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 51 155 51 115 6 115 6 155 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 114 set {floorItems(114)} $i $w create text 28.5 135 -text 114 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 95 115 53 115 53 168 95 168 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 115 set {floorItems(115)} $i $w create text 74 141.5 -text 115 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 87 113 87 27 10 27 10 113 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 116 set {floorItems(116)} $i $w create text 48.5 70 -text 116 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 89 91 128 91 128 113 89 113 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 118 set {floorItems(118)} $i $w create text 108.5 102 -text 118 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 178 128 178 132 216 132 216 91 163 91 163 112 149 112 149 128 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 120 set {floorItems(120)} $i $w create text 189.5 111.5 -text 120 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 79 193 87 193 87 169 136 169 136 192 156 192 156 169 175 169 175 246 79 246 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 122 set {floorItems(122)} $i $w create text 131 207.5 -text 122 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 138 169 154 169 154 191 138 191 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 121 set {floorItems(121)} $i $w create text 146 180 -text 121 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 99 300 126 300 126 309 99 309 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 106A set {floorItems(106A)} $i $w create text 112.5 304.5 -text 106A -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 128 299 128 309 150 309 150 248 99 248 99 299 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 105 set {floorItems(105)} $i $w create text 124.5 278.5 -text 105 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 174 309 174 300 152 300 152 309 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 106B set {floorItems(106B)} $i $w create text 163 304.5 -text 106B -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 176 299 176 309 216 309 216 248 152 248 152 299 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 104 set {floorItems(104)} $i $w create text 184 278.5 -text 104 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 138 385 138 337 91 337 91 385 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 108 set {floorItems(108)} $i $w create text 114.5 361 -text 108 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 256 337 140 337 140 385 256 385 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 107 set {floorItems(107)} $i $w create text 198 361 -text 107 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 300 353 300 329 260 329 260 353 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) Smoking set {floorItems(Smoking)} $i $w create text 280 341 -text Smoking -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 314 135 314 170 306 170 306 246 177 246 177 135 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 123 set {floorItems(123)} $i $w create text 245.5 190.5 -text 123 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 217 248 301 248 301 326 257 326 257 310 217 310 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 103 set {floorItems(103)} $i $w create text 259 287 -text 103 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 396 188 377 188 377 169 316 169 316 131 396 131 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 124 set {floorItems(124)} $i $w create text 356 150 -text 124 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 397 226 407 226 407 189 377 189 377 246 397 246 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 125 set {floorItems(125)} $i $w create text 392 217.5 -text 125 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 399 187 409 187 409 207 474 207 474 164 399 164 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 126 set {floorItems(126)} $i $w create text 436.5 185.5 -text 126 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 409 209 409 229 399 229 399 253 486 253 486 239 474 239 474 209 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 127 set {floorItems(127)} $i $w create text 436.5 231 -text 127 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 501 164 501 174 495 174 495 188 490 188 490 204 476 204 476 164 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) MShower set {floorItems(MShower)} $i $w create text 488.5 184 -text MShower -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 497 176 513 176 513 204 492 204 492 190 497 190 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) Closet set {floorItems(Closet)} $i $w create text 502.5 190 -text Closet -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 476 237 476 206 513 206 513 254 488 254 488 237 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) WShower set {floorItems(WShower)} $i $w create text 494.5 230 -text WShower -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 486 131 558 131 558 135 724 135 724 166 697 166 697 275 553 275 531 254 515 254 515 174 503 174 503 161 486 161 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 130 set {floorItems(130)} $i $w create text 638.5 205 -text 130 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 308 242 339 242 339 248 342 248 342 246 397 246 397 276 393 276 393 309 300 309 300 248 308 248 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 102 set {floorItems(102)} $i $w create text 367.5 278.5 -text 102 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 397 255 486 255 486 276 397 276 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 128 set {floorItems(128)} $i $w create text 441.5 265.5 -text 128 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 510 309 486 309 486 255 530 255 552 277 561 277 561 325 510 325 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 129 set {floorItems(129)} $i $w create text 535.5 293 -text 129 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 696 281 740 281 740 387 642 387 642 389 561 389 561 277 696 277 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 133 set {floorItems(133)} $i $w create text 628.5 335 -text 133 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 742 387 742 281 800 281 800 387 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 132 set {floorItems(132)} $i $w create text 771 334 -text 132 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 800 168 800 280 699 280 699 168 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 134 set {floorItems(134)} $i $w create text 749.5 224 -text 134 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 726 131 726 166 800 166 800 131 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 135 set {floorItems(135)} $i $w create text 763 148.5 -text 135 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 340 360 335 363 331 365 326 366 304 366 304 312 396 312 396 288 400 288 404 288 409 290 413 292 418 297 421 302 422 309 421 318 417 325 411 330 405 332 397 333 344 333 340 334 336 336 335 338 332 342 331 347 332 351 334 354 336 357 341 359 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) {Ramona Stair} set {floorItems(Ramona Stair)} $i $w create text 368 323 -text {Ramona Stair} -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 30 23 30 5 93 5 98 5 104 7 110 10 116 16 119 20 122 28 123 32 123 68 220 68 220 87 90 87 90 23 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) {University Stair} set {floorItems(University Stair)} $i $w create text 155 77.5 -text {University Stair} -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 282 37 295 40 312 49 323 56 337 70 352 56 358 48 363 39 365 29 348 25 335 22 321 14 300 5 283 1 260 0 246 0 242 2 236 4 231 8 227 13 223 17 221 22 220 34 260 34 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) {Plaza Stair} set {floorItems(Plaza Stair)} $i $w create text 317.5 28.5 -text {Plaza Stair} -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 220 34 260 34 282 37 295 40 312 49 323 56 337 70 350 83 365 94 377 100 386 104 386 128 220 128 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) {Plaza Deck} set {floorItems(Plaza Deck)} $i $w create text 303 81 -text {Plaza Deck} -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 257 336 77 336 6 336 6 301 77 301 77 310 257 310 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 106 set {floorItems(106)} $i $w create text 131.5 318.5 -text 106 -fill $color -anchor c -tags {floor1 label} set i [$w create polygon 146 110 162 110 162 91 130 91 130 115 95 115 95 128 114 128 114 151 157 151 157 153 112 153 112 130 97 130 97 168 175 168 175 131 146 131 -fill {} -outline {} -tags {floor1 room}] set floorLabels($i) 119 set {floorItems(119)} $i $w create text 143.5 133 -text 119 -fill $color -anchor c -tags {floor1 label} $w create line 155 191 155 189 -fill $color -tags {floor1 wall} $w create line 155 177 155 169 -fill $color -tags {floor1 wall} $w create line 96 129 96 169 -fill $color -tags {floor1 wall} $w create line 78 169 176 169 -fill $color -tags {floor1 wall} |
︙ | ︙ | |||
692 693 694 695 696 697 698 | # # Arguments: # w - The canvas window. # color - Color to use for drawing foreground information. proc fg2 {w color} { global floorLabels floorItems | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | # # Arguments: # w - The canvas window. # color - Color to use for drawing foreground information. proc fg2 {w color} { global floorLabels floorItems set i [$w create polygon 748 188 755 188 755 205 758 205 758 222 800 222 800 168 748 168 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 238 set {floorItems(238)} $i $w create text 774 195 -text 238 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 726 188 746 188 746 166 800 166 800 131 726 131 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 237 set {floorItems(237)} $i $w create text 763 148.5 -text 237 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 497 187 497 204 559 204 559 324 641 324 643 324 643 291 641 291 641 205 696 205 696 291 694 291 694 314 715 314 715 291 715 205 755 205 755 190 724 190 724 187 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 246 set {floorItems(246)} $i $w create text 600 264 -text 246 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 694 279 643 279 643 314 694 314 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 247 set {floorItems(247)} $i $w create text 668.5 296.5 -text 247 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 232 250 308 250 308 242 339 242 339 246 397 246 397 255 476 255 476 250 482 250 559 250 559 274 482 274 482 278 396 278 396 274 232 274 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 202 set {floorItems(202)} $i $w create text 285.5 260 -text 202 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 53 228 53 338 176 338 233 338 233 196 306 196 306 180 175 180 175 169 156 169 156 196 176 196 176 228 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 206 set {floorItems(206)} $i $w create text 143 267 -text 206 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 51 277 6 277 6 338 51 338 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 212 set {floorItems(212)} $i $w create text 28.5 307.5 -text 212 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 557 276 486 276 486 309 510 309 510 325 557 325 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 245 set {floorItems(245)} $i $w create text 521.5 300.5 -text 245 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 560 389 599 389 599 326 560 326 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 244 set {floorItems(244)} $i $w create text 579.5 357.5 -text 244 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 601 389 601 326 643 326 643 389 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 243 set {floorItems(243)} $i $w create text 622 357.5 -text 243 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 688 316 645 316 645 365 688 365 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 242 set {floorItems(242)} $i $w create text 666.5 340.5 -text 242 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 802 367 759 367 759 226 802 226 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) {Barbecue Deck} set {floorItems(Barbecue Deck)} $i $w create text 780.5 296.5 -text {Barbecue Deck} -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 755 262 755 314 717 314 717 262 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 240 set {floorItems(240)} $i $w create text 736 288 -text 240 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 755 316 689 316 689 365 755 365 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 241 set {floorItems(241)} $i $w create text 722 340.5 -text 241 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 755 206 717 206 717 261 755 261 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 239 set {floorItems(239)} $i $w create text 736 233.5 -text 239 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 695 277 643 277 643 206 695 206 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 248 set {floorItems(248)} $i $w create text 669 241.5 -text 248 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 676 135 676 185 724 185 724 135 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 236 set {floorItems(236)} $i $w create text 700 160 -text 236 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 675 135 635 135 635 145 628 145 628 185 675 185 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 235 set {floorItems(235)} $i $w create text 651.5 160 -text 235 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 626 143 633 143 633 135 572 135 572 143 579 143 579 185 626 185 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 234 set {floorItems(234)} $i $w create text 606 160 -text 234 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 557 135 571 135 571 145 578 145 578 185 527 185 527 131 557 131 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 233 set {floorItems(233)} $i $w create text 552.5 158 -text 233 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 476 249 557 249 557 205 476 205 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 230 set {floorItems(230)} $i $w create text 516.5 227 -text 230 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 476 164 486 164 486 131 525 131 525 185 476 185 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 232 set {floorItems(232)} $i $w create text 500.5 158 -text 232 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 476 186 495 186 495 204 476 204 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 229 set {floorItems(229)} $i $w create text 485.5 195 -text 229 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 474 207 409 207 409 187 399 187 399 164 474 164 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 227 set {floorItems(227)} $i $w create text 436.5 185.5 -text 227 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 399 228 399 253 474 253 474 209 409 209 409 228 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 228 set {floorItems(228)} $i $w create text 436.5 231 -text 228 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 397 246 397 226 407 226 407 189 377 189 377 246 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 226 set {floorItems(226)} $i $w create text 392 217.5 -text 226 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 377 169 316 169 316 131 397 131 397 188 377 188 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 225 set {floorItems(225)} $i $w create text 356.5 150 -text 225 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 234 198 306 198 306 249 234 249 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 224 set {floorItems(224)} $i $w create text 270 223.5 -text 224 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 270 179 306 179 306 170 314 170 314 135 270 135 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 223 set {floorItems(223)} $i $w create text 292 157 -text 223 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 268 179 221 179 221 135 268 135 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 222 set {floorItems(222)} $i $w create text 244.5 157 -text 222 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 177 179 219 179 219 135 177 135 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 221 set {floorItems(221)} $i $w create text 198 157 -text 221 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 299 327 349 327 349 284 341 284 341 276 299 276 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 204 set {floorItems(204)} $i $w create text 324 301.5 -text 204 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 234 276 297 276 297 327 257 327 257 338 234 338 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 205 set {floorItems(205)} $i $w create text 265.5 307 -text 205 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 256 385 256 340 212 340 212 385 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 207 set {floorItems(207)} $i $w create text 234 362.5 -text 207 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 210 340 164 340 164 385 210 385 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 208 set {floorItems(208)} $i $w create text 187 362.5 -text 208 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 115 340 162 340 162 385 115 385 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 209 set {floorItems(209)} $i $w create text 138.5 362.5 -text 209 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 89 228 89 156 53 156 53 228 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 217 set {floorItems(217)} $i $w create text 71 192 -text 217 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 89 169 97 169 97 190 89 190 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 217A set {floorItems(217A)} $i $w create text 93 179.5 -text 217A -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 89 156 89 168 95 168 95 135 53 135 53 156 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 216 set {floorItems(216)} $i $w create text 71 145.5 -text 216 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 51 179 51 135 6 135 6 179 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 215 set {floorItems(215)} $i $w create text 28.5 157 -text 215 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 51 227 6 227 6 180 51 180 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 214 set {floorItems(214)} $i $w create text 28.5 203.5 -text 214 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 51 275 6 275 6 229 51 229 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 213 set {floorItems(213)} $i $w create text 28.5 252 -text 213 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 114 340 67 340 67 385 114 385 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 210 set {floorItems(210)} $i $w create text 90.5 362.5 -text 210 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 59 389 59 385 65 385 65 340 1 340 1 389 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 211 set {floorItems(211)} $i $w create text 33 364.5 -text 211 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 393 309 350 309 350 282 342 282 342 276 393 276 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 203 set {floorItems(203)} $i $w create text 367.5 292.5 -text 203 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 99 191 91 191 91 226 174 226 174 198 154 198 154 192 109 192 109 169 99 169 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 220 set {floorItems(220)} $i $w create text 132.5 208.5 -text 220 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 339 205 307 205 307 171 339 171 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) {Priv Lift2} set {floorItems(Priv Lift2)} $i $w create text 323 188 -text {Priv Lift2} -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 307 240 339 240 339 206 307 206 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) {Pub Lift 2} set {floorItems(Pub Lift 2)} $i $w create text 323 223 -text {Pub Lift 2} -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 175 168 97 168 97 131 175 131 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 218 set {floorItems(218)} $i $w create text 136 149.5 -text 218 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 154 191 111 191 111 169 154 169 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 219 set {floorItems(219)} $i $w create text 132.5 180 -text 219 -fill $color -anchor c -tags {floor2 label} set i [$w create polygon 375 246 375 172 341 172 341 246 -fill {} -outline {} -tags {floor2 room}] set floorLabels($i) 201 set {floorItems(201)} $i $w create text 358 209 -text 201 -fill $color -anchor c -tags {floor2 label} $w create line 641 186 678 186 -fill $color -tags {floor2 wall} $w create line 757 350 757 367 -fill $color -tags {floor2 wall} $w create line 634 133 634 144 -fill $color -tags {floor2 wall} $w create line 634 144 627 144 -fill $color -tags {floor2 wall} |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | # # Arguments: # w - The canvas window. # color - Color to use for drawing foreground information. proc fg3 {w color} { global floorLabels floorItems | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 | # # Arguments: # w - The canvas window. # color - Color to use for drawing foreground information. proc fg3 {w color} { global floorLabels floorItems set i [$w create polygon 89 228 89 180 70 180 70 228 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 316 set {floorItems(316)} $i $w create text 79.5 204 -text 316 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 115 368 162 368 162 323 115 323 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 309 set {floorItems(309)} $i $w create text 138.5 345.5 -text 309 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 164 323 164 368 211 368 211 323 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 308 set {floorItems(308)} $i $w create text 187.5 345.5 -text 308 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 256 368 212 368 212 323 256 323 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 307 set {floorItems(307)} $i $w create text 234 345.5 -text 307 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 244 276 297 276 297 327 260 327 260 321 244 321 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 305 set {floorItems(305)} $i $w create text 270.5 301.5 -text 305 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 251 219 251 203 244 203 244 219 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 324B set {floorItems(324B)} $i $w create text 247.5 211 -text 324B -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 251 249 244 249 244 232 251 232 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 324A set {floorItems(324A)} $i $w create text 247.5 240.5 -text 324A -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 223 135 223 179 177 179 177 135 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 320 set {floorItems(320)} $i $w create text 200 157 -text 320 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 114 368 114 323 67 323 67 368 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 310 set {floorItems(310)} $i $w create text 90.5 345.5 -text 310 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 23 277 23 321 68 321 68 277 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 312 set {floorItems(312)} $i $w create text 45.5 299 -text 312 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 23 229 68 229 68 275 23 275 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 313 set {floorItems(313)} $i $w create text 45.5 252 -text 313 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 68 227 23 227 23 180 68 180 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 314 set {floorItems(314)} $i $w create text 45.5 203.5 -text 314 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 95 179 95 135 23 135 23 179 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 315 set {floorItems(315)} $i $w create text 59 157 -text 315 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 99 226 99 204 91 204 91 226 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 316B set {floorItems(316B)} $i $w create text 95 215 -text 316B -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 91 202 99 202 99 180 91 180 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 316A set {floorItems(316A)} $i $w create text 95 191 -text 316A -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 97 169 109 169 109 192 154 192 154 198 174 198 174 226 101 226 101 179 97 179 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 319 set {floorItems(319)} $i $w create text 141.5 209 -text 319 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 65 368 58 368 58 389 1 389 1 333 23 333 23 323 65 323 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 311 set {floorItems(311)} $i $w create text 29.5 361 -text 311 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 154 191 111 191 111 169 154 169 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 318 set {floorItems(318)} $i $w create text 132.5 180 -text 318 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 175 168 97 168 97 131 175 131 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 317 set {floorItems(317)} $i $w create text 136 149.5 -text 317 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 274 194 274 221 306 221 306 194 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 323 set {floorItems(323)} $i $w create text 290 207.5 -text 323 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 306 222 274 222 274 249 306 249 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 325 set {floorItems(325)} $i $w create text 290 235.5 -text 325 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 263 179 224 179 224 135 263 135 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 321 set {floorItems(321)} $i $w create text 243.5 157 -text 321 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 314 169 306 169 306 192 273 192 264 181 264 135 314 135 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 322 set {floorItems(322)} $i $w create text 293.5 163.5 -text 322 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 307 240 339 240 339 206 307 206 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) {Pub Lift3} set {floorItems(Pub Lift3)} $i $w create text 323 223 -text {Pub Lift3} -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 339 205 307 205 307 171 339 171 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) {Priv Lift3} set {floorItems(Priv Lift3)} $i $w create text 323 188 -text {Priv Lift3} -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 350 284 376 284 376 276 397 276 397 309 350 309 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 303 set {floorItems(303)} $i $w create text 373.5 292.5 -text 303 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 272 203 272 249 252 249 252 230 244 230 244 221 252 221 252 203 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 324 set {floorItems(324)} $i $w create text 262 226 -text 324 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 299 276 299 327 349 327 349 284 341 284 341 276 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 304 set {floorItems(304)} $i $w create text 324 301.5 -text 304 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 375 246 375 172 341 172 341 246 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 301 set {floorItems(301)} $i $w create text 358 209 -text 301 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 397 246 377 246 377 185 397 185 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 327 set {floorItems(327)} $i $w create text 387 215.5 -text 327 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 316 131 316 169 377 169 377 185 397 185 397 131 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 326 set {floorItems(326)} $i $w create text 356.5 150 -text 326 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 308 251 242 251 242 274 342 274 342 282 375 282 375 274 397 274 397 248 339 248 339 242 308 242 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 302 set {floorItems(302)} $i $w create text 319.5 261 -text 302 -fill $color -anchor c -tags {floor3 label} set i [$w create polygon 70 321 242 321 242 200 259 200 259 203 272 203 272 193 263 180 242 180 175 180 175 169 156 169 156 196 177 196 177 228 107 228 70 228 70 275 107 275 107 248 160 248 160 301 107 301 107 275 70 275 -fill {} -outline {} -tags {floor3 room}] set floorLabels($i) 306 set {floorItems(306)} $i $w create text 200.5 284.5 -text 306 -fill $color -anchor c -tags {floor3 label} $w create line 341 275 341 283 -fill $color -tags {floor3 wall} $w create line 162 197 155 197 -fill $color -tags {floor3 wall} $w create line 396 247 399 247 -fill $color -tags {floor3 wall} $w create line 399 129 399 311 -fill $color -tags {floor3 wall} |
︙ | ︙ |
Changes to library/demos/goldberg.tcl.
︙ | ︙ | |||
73 74 75 76 77 78 79 | array set speed {1 10 2 20 3 50 4 80 5 100 6 150 7 200 8 300 9 400 10 500} set MSTART 0; set MGO 1; set MPAUSE 2; set MSSTEP 3; set MBSTEP 4; set MDONE 5 set S(mode) $::MSTART # Colors for everything set C(fg) black | < > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | array set speed {1 10 2 20 3 50 4 80 5 100 6 150 7 200 8 300 9 400 10 500} set MSTART 0; set MGO 1; set MPAUSE 2; set MSSTEP 3; set MBSTEP 4; set MDONE 5 set S(mode) $::MSTART # Colors for everything set C(fg) black set C(bg) cornflowerblue set C(0) white; set C(1a) darkgreen; set C(1b) yellow set C(2) red; set C(3a) green; set C(3b) darkblue set C(4) $C(fg); set C(5a) brown; set C(5b) white set C(6) magenta; set C(7) green; set C(8) $C(fg) set C(9) blue4; set C(10a) white; set C(10b) cyan set C(11a) yellow; set C(11b) mediumblue; set C(12) tan2 set C(13a) yellow; set C(13b) red; set C(14) white set C(15a) green; set C(15b) yellow; set C(16) gray65 set C(17) \#A65353; set C(18) $C(fg); set C(19) gray50 set C(20) cyan; set C(21) gray65; set C(22) $C(20) set C(23a) blue; set C(23b) red; set C(23c) yellow set C(24a) red; set C(24b) white; set C(24c) black; set C(26) $C(0); proc DoDisplay {w} { global S C ttk::frame $w.ctrl -relief ridge -borderwidth 2 -padding 5 pack [frame $w.screen -bd 2 -relief raised] \ -side left -fill both -expand 1 |
︙ | ︙ | |||
1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 | 494 627 548 613 548 613 480 574 577 473 577 473 474 538 445 508 431 441 431 440 400 502 347 465 347 465 } $w.c create poly $xy -tag I24 -fill $::C(24b) -outline $::C(24a) \ -width 10 -smooth 1 set msg [subst $S(message)] $w.c create text [Centroid $w I24] -text $msg -tag {I24 I24t} \ -justify center -font {{Times Roman} 18 bold} return 1 } $w.c itemconfig I24t -font [list {Times Roman} [expr {18 + 6*$step}] bold] $w.c move I24 0 -60 $w.c scale I24 {*}[Centroid $w I24] 1.25 1.25 | > | 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | 494 627 548 613 548 613 480 574 577 473 577 473 474 538 445 508 431 441 431 440 400 502 347 465 347 465 } $w.c create poly $xy -tag I24 -fill $::C(24b) -outline $::C(24a) \ -width 10 -smooth 1 set msg [subst $S(message)] $w.c create text [Centroid $w I24] -text $msg -tag {I24 I24t} \ -fill $::C(24c) \ -justify center -font {{Times Roman} 18 bold} return 1 } $w.c itemconfig I24t -font [list {Times Roman} [expr {18 + 6*$step}] bold] $w.c move I24 0 -60 $w.c scale I24 {*}[Centroid $w I24] 1.25 1.25 |
︙ | ︙ | |||
1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 | proc Move26 {w {step {}}} { global S set step [GetStep 26 $step] if {$step >= 3} { $w.c delete I24 I26 $w.c create text 430 755 -anchor s -tag I26 \ -text "click to continue" -font {{Times Roman} 24 bold} bind $w.c <Button-1> [list Reset $w] return 4 } $w.c scale I24 {*}[Centroid $w I24] .8 .8 $w.c move I24 0 60 | > | 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 | proc Move26 {w {step {}}} { global S set step [GetStep 26 $step] if {$step >= 3} { $w.c delete I24 I26 $w.c create text 430 755 -anchor s -tag I26 \ -fill $::C(26) \ -text "click to continue" -font {{Times Roman} 24 bold} bind $w.c <Button-1> [list Reset $w] return 4 } $w.c scale I24 {*}[Centroid $w I24] .8 .8 $w.c move I24 0 60 |
︙ | ︙ |
Changes to library/demos/image2.tcl.
︙ | ︙ | |||
90 91 92 93 94 95 96 | pack $w.dir.e -side left -fill both -padx 2m -pady 2m -expand true pack $w.dir.b -side left -fill y -padx {0 2m} -pady 2m labelframe $w.f -text "File:" -padx 2m -pady 2m listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set" ttk::scrollbar $w.f.scroll -command "$w.f.list yview" pack $w.f.list $w.f.scroll -side left -fill y -expand 1 | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | pack $w.dir.e -side left -fill both -padx 2m -pady 2m -expand true pack $w.dir.b -side left -fill y -padx {0 2m} -pady 2m labelframe $w.f -text "File:" -padx 2m -pady 2m listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set" ttk::scrollbar $w.f.scroll -command "$w.f.list yview" pack $w.f.list $w.f.scroll -side left -fill y -expand 1 $w.f.list insert 0 earth.gif earthris.gif teapot.ppm Tcl.svg bind $w.f.list <Double-Button-1> "loadImage $w %x %y" catch {image delete image2a} image create photo image2a labelframe $w.image -text "Image:" label $w.image.image -image image2a pack $w.image.image -padx 2m -pady 2m |
︙ | ︙ |
Added library/demos/images/Tcl.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Created with Inkscape (http://www.inkscape.org/) --> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="124.98526" height="264.6875" id="svg2309" sodipodi:version="0.32" inkscape:version="0.45" sodipodi:modified="true" version="1.0"> <defs id="defs2311" /> <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" gridtolerance="10000" guidetolerance="10" objecttolerance="10" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="375" inkscape:cy="520" inkscape:document-units="px" inkscape:current-layer="layer1" inkscape:window-width="910" inkscape:window-height="626" inkscape:window-x="5" inkscape:window-y="49" /> <metadata id="metadata2314"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> </cc:Work> </rdf:RDF> </metadata> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(-311.79308,-365.73272)"> <g style="opacity:1;display:inline" id="g2244" transform="translate(308.95998,366.42022)"> <path id="path4426" d="M 445.52492,372.22514 C 445.90652,395.55723 445.21415,418.63757 425.02492,440.56889 L 424.27492,441.41264 L 425.39992,441.41264 L 433.64992,441.53764 C 420.24442,469.42405 411.52244,497.23134 392.24367,525.00639 L 391.55617,526.00639 L 392.74367,525.78764 L 402.93117,523.85014 C 395.71427,542.16045 383.37359,554.28293 369.99367,558.35014 C 366.31107,506.78151 392.04593,461.26308 413.89992,415.88139 C 413.92002,415.83965 413.94233,415.79813 413.96242,415.75639 L 413.14992,415.19389 C 377.36425,455.2074 361.23872,511.6427 355.14992,558.19389 C 343.02146,551.34666 338.97913,542.28079 334.86867,529.94389 L 343.33742,533.50639 L 344.21242,533.88139 L 344.02492,532.94389 C 337.58858,504.32416 347.5814,483.78143 357.27492,456.78764 L 364.24367,461.44389 L 365.05617,462.00639 L 365.02492,461.03764 C 364.47892,439.10645 379.24595,417.08983 398.83742,397.44389 L 401.55617,404.72514 L 401.93117,405.69389 L 402.46242,404.78764 L 408.43117,394.85014 L 408.46242,394.78764 C 418.31429,381.21812 428.72988,376.80082 445.52492,372.22514 z " style="fill:#c3b15f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" transform="translate(-324.02492,-364.63139)" /> <path sodipodi:nodetypes="ccccccccccccccccccccccc" id="path7600" d="M 121.54988,7.5808058 C 104.81215,12.147023 94.270242,16.613077 84.4375,30.15625 L 84.40625,30.21875 L 78.4375,40.15625 L 77.90625,41.0625 L 77.53125,40.09375 L 74.8125,32.8125 C 55.22103,52.45844 40.454,74.47506 41,96.40625 L 41.03125,97.375 L 40.21875,96.8125 L 33.25,92.15625 C 23.55648,119.15004 13.56366,139.69277 20,168.3125 L 20.1875,169.25 L 19.3125,168.875 L 10.9375,165.34375 C 10.96447,165.51523 11.003113,165.67421 11.03125,165.84375 C 15.080346,177.9015 19.176955,186.81713 31.125,193.5625 C 31.596616,189.95681 32.122231,186.27456 32.71875,182.5625 C 18.12816,148.39836 30.79293,123.2814 36.5625,100.6875 L 45.4375,105.8125 C 44.211577,84.657017 56.63174,61.842112 72.78125,41.9375 L 77.46875,50.1875 C 89.477498,25.486664 98.97512,15.57175 121.54988,7.5808058 z " style="opacity:1;fill:#eff1cb;fill-opacity:1;fill-rule:evenodd;stroke:#eff1cb;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" /> <path style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" d="M 126.9375,-0.6875 L 126.40625,-0.59375 C 106.72165,2.83976 87.4508,10.07244 79,27.375 L 75.4375,21.15625 L 75.125,20.59375 L 74.65625,21.0625 C 64.96254,30.33838 54.55574,42.35306 46.875,54.15625 C 39.66528,65.23562 34.88327,76.07934 35.40625,84.375 L 30.375,78.09375 L 29.875,77.46875 L 29.53125,78.1875 C 23.40732,91.41649 17.22694,107.69157 13.53125,122.625 C 10.02725,136.78385 8.77244,149.67206 12.03125,157.78125 L 3.75,152.96875 L 3.0625,152.5625 L 3,153.375 C 1.44089,176.99202 11.0382,188.26833 22.0625,199.15625 L 12.875,201.4375 L 11.03125,201.90625 L 12.875,202.40625 C 18.14953,203.83558 23.15023,205.44485 26.625,208.125 C 30.09977,210.80515 32.09598,214.49082 31.5,220.375 L 31.5,220.40625 L 31.5,245.90625 L 31.5,246.0625 L 31.59375,246.1875 L 43.09375,262.6875 L 44,264 L 44,262.40625 L 44,223.53125 C 45.52181,216.98735 47.30807,212.4833 49.875,209.5 C 52.44193,206.5167 55.78211,204.98483 60.5625,204.40625 L 62.28125,204.1875 L 60.71875,203.46875 L 54.65625,200.59375 C 69.11174,191.89001 85.3013,170.55445 89.5625,150.28125 L 89.75,149.46875 L 88.96875,149.6875 L 81.46875,151.71875 C 88.13174,145.46249 94.84392,133.06721 101.21875,118.625 C 107.9798,103.3078 114.29247,85.96032 119.46875,72.09375 L 119.75,71.34375 L 118.96875,71.40625 L 113.1875,71.8125 C 120.3346,64.22669 124.30703,51.6996 126.25,38.46875 C 128.27227,24.69793 128.13035,10.1977 127,-0.15625 L 126.9375,-0.6875 z M 121.5,7.59375 C 121.8816,30.92584 121.18923,54.00618 101,75.9375 L 100.25,76.78125 L 101.375,76.78125 L 109.625,76.90625 C 96.2195,104.79266 87.49752,132.59995 68.21875,160.375 L 67.53125,161.375 L 68.71875,161.15625 L 78.90625,159.21875 C 71.68935,177.52906 59.34867,189.65154 45.96875,193.71875 C 42.28615,142.15012 68.02101,96.63169 89.875,51.25 C 89.8951,51.20826 89.91741,51.16674 89.9375,51.125 L 89.125,50.5625 C 53.33933,90.57601 37.2138,147.01131 31.125,193.5625 C 18.99654,186.71527 14.95421,177.6494 10.84375,165.3125 L 19.3125,168.875 L 20.1875,169.25 L 20,168.3125 C 13.56366,139.69277 23.55648,119.15004 33.25,92.15625 L 40.21875,96.8125 L 41.03125,97.375 L 41,96.40625 C 40.454,74.47506 55.22103,52.45844 74.8125,32.8125 L 77.53125,40.09375 L 77.90625,41.0625 L 78.4375,40.15625 L 84.40625,30.21875 L 84.4375,30.15625 C 94.28937,16.58673 104.70496,12.16943 121.5,7.59375 z " id="path2177" /> </g> </g> </svg> |
Added library/demos/images/Tk_feather.png.
cannot compute difference between binary files
Changes to library/demos/images/earth.gif.
cannot compute difference between binary files
Added library/demos/images/plowed_field.png.
cannot compute difference between binary files
Added library/demos/images/starry_night.png.
cannot compute difference between binary files
Added library/demos/mac_styles.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | # mac_styles.tcl -- # # This demonstration script creates a toplevel window containing a notebook # whose pages provide examples of the various mac-specific widgets that are # provided via special values for the -style option. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk set w .mac_styles catch {destroy $w} toplevel $w package require Tk wm title $w "Tk Aqua Widgets" wm iconname $w "mac_styles" positionWindow $w ## # System images we use in our buttons set featherImg [file join $tk_demoDirectory images Tk_feather.png] set starryImg [file join $tk_demoDirectory images starry_night.png] set fieldImg [file join $tk_demoDirectory images plowed_field.png] image create nsimage action -source NSAction -width 48 -height 48 image create nsimage bonjour -source NSBonjour -width 48 -height 48 image create nsimage bonjour1 -source NSBonjour -width 48 -height 48 -pressed 1 image create nsimage tkfeather -source $featherImg -as file -width 48 -height 48 image create nsimage tkfeather1 -source $featherImg -as file -width 48 -height 48 -pressed 1 image create nsimage starry -source $starryImg -as file -width 96 -radius 10 image create nsimage starry1 -source $starryImg -as file -width 96 -radius 10 -pressed 1 image create nsimage starry2 -source $starryImg -as file -width 96 -radius 10 -ring 3 image create nsimage field -source $fieldImg -as file -width 96 -radius 10 image create nsimage field1 -source $fieldImg -as file -width 96 -radius 10 -pressed 1 image create nsimage field2 -source $fieldImg -as file -width 96 -radius 10 -ring 3 image create nsimage add -source NSAddTemplate -width 11 -height 11 image create nsimage remove -source NSRemoveTemplate -width 11 -height 11 # Off state and variables for checkbuttons and radio buttons set off {!selected !alternate} variable $w.checkVar variable $w.radioVar variable $w.triangleVar variable $w.popupVar variable $w.stepVar variable $w.comboVar # Make a disclosure triangle change state when clicked. proc toggleTriangle {tri} { $tri instate {user1} { $tri state {!user1} return } $tri instate {!user1} { $tri state {user1} } } proc popupButton {win varName firstValue args} { upvar #0 $varName var if {![info exists var]} { set var $firstValue } ttk::menubutton $win -textvariable $varName -menu $win.menu -direction flush menu $win.menu -tearoff 0 $win.menu add radiobutton -label $firstValue -variable $varName foreach i $args { $win.menu add radiobutton -label $i -variable $varName } return $win.menu } set mag [encoding convertfrom utf-8 "\xf0\x9f\x94\x8d"] proc searchFocusOut {e} { global mag if {[$e get] eq ""} { $e configure -foreground gray60 $e insert 0 "Search" } } proc searchFocusIn {e} { if {[$e cget -foreground] == {gray60}} { $e delete 0 end $e configure -foreground black } } ## Make the notebook and set up Ctrl+Tab traversal ttk::notebook $w.notebook ttk::notebook::enableTraversal $w.notebook # Frames pane set framesFrame [ttk::frame $w.notebook.frames -padding {40 35 40 50}] $w.notebook add $framesFrame -text "Frames" pack [ttk::labelframe $framesFrame.darker -text Darker -padding {50 30 50 50}] \ -fill both -expand 1 pack [ttk::label $framesFrame.darker.label -padding {0 0 0 6} \ -text "This Group Box is nested to depth 2"] \ -fill x pack [ttk::labelframe $framesFrame.darker.darker -text "Darker Still" -padding 24] \ -fill both -expand 1 pack [ttk::label $framesFrame.darker.darker.label \ -text "This Group Box is nested to depth 3"] -fill x pack [button $framesFrame.darker.darker.tkbutton -text "Tk Button" -width 7 \ -highlightbackground systemWindowBackgroundColor3] -pady 10 pack [ttk::button $framesFrame.darker.darker.ttkbutton -text "Ttk Button" \ -width 7 -padding {-4 0 -4 0}] \ -pady 3 # Button pane set buttonFrame [ttk::frame $w.notebook.buttons -padding {100 20 0 20}] $w.notebook add $buttonFrame -text "Buttons" grid columnconfigure $buttonFrame 0 -minsize 100 grid columnconfigure $buttonFrame 1 -minsize 100 set plain [ttk::button $buttonFrame.plain -text Button -padding {-12 0}] popupButton $buttonFrame.options .popupVar "Item 1" "Item 2" "Item 3" set options $buttonFrame.options set check [ttk::checkbutton $buttonFrame.check -text Check -variable .checkVar] set radio [ttk::frame $buttonFrame.radio] pack [ttk::radiobutton $radio.r1 -text "Radio 1" -variable .radioVar -value 1] -pady 4 pack [ttk::radiobutton $radio.r2 -text "Radio 2" -variable .radioVar -value 2] -pady 4 set triangle [ttk::checkbutton $buttonFrame.triangle -style Item -variable TriangleVar] bind $triangle <Button-1> {toggleTriangle %W} set bonjour [ttk::button $buttonFrame.bonjour -style ImageButton -text Bonjour \ -image {bonjour pressed bonjour1}] set feather [ttk::button $buttonFrame.feather -style ImageButton -text Tk \ -image {tkfeather pressed tkfeather1}] set gradient [ttk::frame $buttonFrame.gradient] pack [ttk::button $buttonFrame.gradient.add -style GradientButton \ -image add -padding 7] -side left pack [ttk::button $buttonFrame.gradient.remove -style GradientButton \ -image remove -padding 7] -side left set disclosure [ttk::checkbutton $buttonFrame.disclosure -style DisclosureButton] set help [ttk::button $buttonFrame.help -style HelpButton]; $check state $off $radio.r1 state $off $radio.r2 state $off grid [ttk::label $buttonFrame.plainLabel -text "Push Button:"]\ -row 0 -column 0 -padx 4 -sticky e grid $plain -pady 4 -row 0 -column 1 -sticky w grid [ttk::label $buttonFrame.optionsLabel -text "Pop-up Button:"]\ -row 1 -column 0 -padx 4 -sticky e grid $options -pady 4 -row 1 -column 1 -sticky w grid [ttk::label $buttonFrame.checkLabel -text "Check Button:"]\ -row 2 -column 0 -padx 4 -sticky e grid $check -pady 4 -row 2 -column 1 -sticky w grid [ttk::label $buttonFrame.radioLabel -text "Radio Buttons:"]\ -row 3 -column 0 -padx 4 -sticky e grid $radio -pady 4 -row 3 -column 1 -sticky w grid [ttk::label $buttonFrame.triangleLabel -text "Disclosure Triangle:"]\ -row 4 -column 0 -padx 4 -sticky e grid $triangle -pady 4 -row 4 -column 1 -sticky w grid [ttk::label $buttonFrame.disclosureLabel -text "Disclosure Button:"]\ -row 5 -column 0 -padx 4 -sticky e grid $disclosure -row 5 -column 1 -sticky w grid [ttk::label $buttonFrame.imageLabel -text "Image Buttons:"]\ -row 7 -column 0 -padx 4 -sticky e grid $bonjour -pady 4 -row 6 -rowspan 4 -column 1 -sticky w grid $feather -padx 10 -pady 4 -row 6 -rowspan 4 -column 2 grid [ttk::label $buttonFrame.gradentLabel -text "Gradient Buttons:"]\ -row 10 -column 0 -padx 4 -sticky e grid $gradient -pady 4 -row 10 -column 1 -sticky w grid [ttk::label $buttonFrame.helpLabel -text "Help Button:"]\ -row 11 -column 0 -padx 4 -sticky e grid $help -row 11 -column 1 -sticky w #ttk::button .f.b1 -style Toolbutton -image action #pack $buttonFrame # Entries Frame set entryFrame [ttk::frame $w.notebook.entries -padding {0 30 80 0}] grid columnconfigure $entryFrame 0 -minsize 200 $w.notebook add $entryFrame -text "Entries" set textfield [ttk::entry $entryFrame.text -width 17] set searchfield [ttk::entry $entryFrame.search -width 1] set combo [ttk::combobox $entryFrame.combo -width 1 -textvariable comboVar \ -values {"Item 1" "Item 2" "Item 3"}] set stepper [ttk::spinbox $entryFrame.stepper -width 1 -textvariable stepVar \ -from 99000 -to 101000 -increment 1] set stepVar 100000 searchFocusOut $searchfield bind $searchfield <FocusIn> {searchFocusIn %W} bind $searchfield <FocusOut> {searchFocusOut %W} grid [ttk::label $entryFrame.l0 -text "Text Field"] -row 0 -column 0 -padx 20 -sticky e grid $textfield -sticky ew -row 0 -column 1 -pady 13 grid [ttk::label $entryFrame.l1 -text "Search Field"] -row 1 -column 0 -padx 20 -sticky e grid $searchfield -sticky ew -row 1 -column 1 -pady 13 grid [ttk::label $entryFrame.l2 -text "Combo Box"] -row 2 -column 0 -padx 20 -sticky e grid $combo -sticky ew -row 2 -column 1 -pady 13 grid [ttk::label $entryFrame.l3 -text "Stepper"] -row 3 -column 0 -padx 20 -sticky e grid $stepper -sticky ew -row 3 -column 1 -pady 13 #Scales Frame set scaleFrame [ttk::frame $w.notebook.scales -padding {0 40 0 80}] $w.notebook add $scaleFrame -text "Scales" variable topVar 50 set topSlider [ttk::scale $scaleFrame.topSlider -from 0 -to 100 \ -length 280 -variable topVar] set topProgress [ttk::progressbar $scaleFrame.topProgress \ -maximum 100 -variable topVar] variable bottomVar 50 set bottomSlider [ttk::scale $scaleFrame.bottomSlider -from 0 -to 100 \ -length 280 -variable bottomVar] $bottomSlider state alternate set bottomProgress [ttk::progressbar $scaleFrame.bottomProgress \ -maximum 100 -variable bottomVar] grid $topSlider -padx 80 -pady 12 -sticky ew -row 0 -column 0 -columnspan 2 grid $topProgress -padx 120 -pady 15 -sticky ew -row 1 -column 0 -columnspan 2 grid [ttk::frame $scaleFrame.spacer] -row 2 -column 0 -columnspan 2 -pady 32 grid $bottomSlider -padx 80 -sticky new -row 3 -column 0 -columnspan 2 grid [ttk::label $scaleFrame.low -text Low -padding {70 0 0 0}] \ -row 4 -column 0 -sticky sw grid [ttk::label $scaleFrame.high -text High -padding {0 0 70 0}] \ -row 4 -column 1 -sticky se grid $bottomProgress -padx 120 -pady 15 -sticky ew -row 5 -column 0 -columnspan 2 #Appearance Frame set appearanceFrame [ttk::frame $w.notebook.appearance -padding {0 40 0 80}] grid [ttk::label $w.notebook.appearance.info -justify left -padding {0 20 0 40}\ -text "Use the image buttons below to view this demo in light or dark mode."] \ -row 0 -column 0 -columnspan 3 set light [ttk::button $appearanceFrame.light -style ImageButton -text Light \ -image {field pressed field1 selected field2} \ -command "beLight $appearanceFrame $w"] grid columnconfigure $appearanceFrame 1 -minsize 10 grid $light -row 1 -column 0 -sticky e set dark [ttk::button $appearanceFrame.dark -style ImageButton -text Dark \ -image {starry pressed starry1 selected starry2} \ -command "beDark $appearanceFrame $w"] grid $dark -row 1 -column 2 -sticky w if { [::tk::unsupported::MacWindowStyle isdark $w] } { $dark state selected } else { $light state selected } proc beLight {f w} { ::tk::unsupported::MacWindowStyle appearance $w aqua $f.dark state !selected $f.light state selected after 10 $f.light state !hover } proc beDark {f w} { ::tk::unsupported::MacWindowStyle appearance $w darkaqua $f.light state !selected $f.dark state selected after 10 $f.dark state !hover } $w.notebook add $appearanceFrame -text "Appearance" ## See Code / Dismiss pack [addSeeDismiss $w.buttons $w] -side bottom -fill x ## Notebook pack $w.notebook -side bottom -fill both -expand 1 -padx 16 -pady 16 |
Changes to library/demos/mclist.tcl.
︙ | ︙ | |||
17 18 19 20 21 22 23 | positionWindow $w ## Explanatory text ttk::label $w.msg -font $font -wraplength 4i -justify left -anchor n -padding {10 2 10 6} -text "Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which can be configured to display multiple columns of informational data without displaying the tree itself. This is a simple way to build a listbox that has multiple columns. Clicking on the heading for a column will sort the data by that column. You can also change the width of the columns by dragging the boundary between them." pack $w.msg -fill x ## See Code / Dismiss | | > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | positionWindow $w ## Explanatory text ttk::label $w.msg -font $font -wraplength 4i -justify left -anchor n -padding {10 2 10 6} -text "Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which can be configured to display multiple columns of informational data without displaying the tree itself. This is a simple way to build a listbox that has multiple columns. Clicking on the heading for a column will sort the data by that column. You can also change the width of the columns by dragging the boundary between them." pack $w.msg -fill x ## See Code / Dismiss pack [addSeeDismiss $w.seeDismiss $w {} { ttk::checkbutton $w.seeDismiss.cb1 -text Grid -variable mclistGrid -command tglGrid }] -side bottom -fill x ttk::frame $w.container ttk::treeview $w.tree -columns {country capital currency} -show headings \ -yscroll "$w.vsb set" -xscroll "$w.hsb set" ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview" ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview" pack $w.container -fill both -expand 1 |
︙ | ︙ | |||
113 114 115 116 117 118 119 | if {[ttk::style theme use] eq "aqua"} { # Aqua theme displays native sort arrows when user1 state is set $tree heading $col state "user1" } else { $tree heading $col -image [expr {$direction?"upArrow":"downArrow"}] } } | > > > > > > > > > > > > > > > | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | if {[ttk::style theme use] eq "aqua"} { # Aqua theme displays native sort arrows when user1 state is set $tree heading $col state "user1" } else { $tree heading $col -image [expr {$direction?"upArrow":"downArrow"}] } } set mclistGrid 0 proc tglGrid {} { if {$::mclistGrid} { .mclist.tree configure -stripe 1 foreach col [.mclist.tree cget -columns] { .mclist.tree column $col -separator 1 } } else { .mclist.tree configure -stripe 0 foreach col [.mclist.tree cget -columns] { .mclist.tree column $col -separator 0 } } } |
Changes to library/demos/menu.tcl.
︙ | ︙ | |||
14 15 16 17 18 19 20 | toplevel $w wm title $w "Menu Demonstration" wm iconname $w "menu" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left if {[tk windowingsystem] eq "aqua"} { | < | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | toplevel $w wm title $w "Menu Demonstration" wm iconname $w "menu" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left if {[tk windowingsystem] eq "aqua"} { $w.msg configure -text "This window has a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by selecting the first item in the menu." } else { $w.msg configure -text "This window contains a menubar with cascaded menus. You can post a menu from the keyboard by typing Alt+x, where \"x\" is the character underlined on the menu. You can then traverse among the menus using the arrow keys. When a menu is posted, you can invoke the current entry by typing space, or you can invoke any entry by typing its underlined character. If a menu entry has an accelerator, you can invoke the entry without posting the menu just by typing the accelerator. The rightmost menu can be torn off into a palette by selecting the first item in the menu." } pack $w.msg -side top set menustatus " " |
︙ | ︙ | |||
59 60 61 62 63 64 65 | } elseif {[tk windowingsystem] == "win32"} { set modifier Control } else { set modifier Meta } foreach i {A B C D E F} { $m add command -label "Print letter \"$i\"" -underline 14 \ | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | } elseif {[tk windowingsystem] == "win32"} { set modifier Control } else { set modifier Meta } foreach i {A B C D E F} { $m add command -label "Print letter \"$i\"" -underline 14 \ -accelerator $modifier+$i -command "puts $i" bind $w <$modifier-[string tolower $i]> "puts $i" } set m $w.menu.cascade $w.menu add cascade -label "Cascades" -menu $m -underline 0 menu $m -tearoff 0 $m add command -label "Print hello" \ |
︙ | ︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | set m $w.menu.more $w.menu add cascade -label "More" -menu $m -underline 0 menu $m -tearoff 0 foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Does almost nothing also} {Make life meaningful}} { $m add command -label $i -command [list puts "You invoked \"$i\""] } $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \ -command [list \ tk_dialog $w.compound {Compound Menu Entry} \ "The menu entry you invoked displays both a bitmap and a\ text string. Other than this, it is just like any other\ menu entry." {} 0 OK ] $m entryconfigure "Does almost nothing also" -image lilearth -compound left \ -command [list \ tk_dialog $w.compound {Compound Menu Entry} \ "The menu entry you invoked displays both a image and a\ text string. Other than this, it is just like any other\ menu entry." {} 0 OK ] set m $w.menu.colors $w.menu add cascade -label "Colors" -menu $m -underline 1 menu $m -tearoff 1 | > > > > > | > > > > > > > > > > > | | > < < | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | set m $w.menu.more $w.menu add cascade -label "More" -menu $m -underline 0 menu $m -tearoff 0 foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Does almost nothing also} {Make life meaningful}} { $m add command -label $i -command [list puts "You invoked \"$i\""] } set emojiLabel [encoding convertfrom utf-8 "\xF0\x9F\x98\x8D Make friends"] $m add command -label $emojiLabel -command [list puts "Menu labels can include non-BMP characters."] $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \ -command [list \ tk_dialog $w.compound {Compound Menu Entry} \ "The menu entry you invoked displays both a bitmap and a\ text string. Other than this, it is just like any other\ menu entry." {} 0 OK ] $m entryconfigure "Does almost nothing also" -image lilearth -compound left \ -command [list \ tk_dialog $w.compound {Compound Menu Entry} \ "The menu entry you invoked displays both a image and a\ text string. Other than this, it is just like any other\ menu entry." {} 0 OK ] set m $w.menu.colors $w.menu add cascade -label "Colors" -menu $m -underline 1 menu $m -tearoff 1 if {[tk windowingsystem] eq "aqua"} { # Aqua ignores the -background and -foreground options, but a compound # button can be used for selecting colors. foreach i {red orange yellow green blue} { image create photo image_$i -height 16 -width 16 image_$i put black -to 0 0 16 1 image_$i put black -to 0 1 1 16 image_$i put black -to 0 15 16 16 image_$i put black -to 15 1 16 16 image_$i put $i -to 1 1 15 15 $m add command -label $i -image image_$i -compound left -command [list \ puts "You invoked \"$i\"" ] } } else { foreach i {red orange yellow green blue} { $m add command -label $i -background $i -command [list \ puts "You invoked \"$i\"" ] } } $w configure -menu $w.menu bind Menu <<MenuSelect>> { global $menustatus if {[catch {%W entrycget active -label} label]} { set label " " } set menustatus $label update idletasks } |
Changes to library/demos/menubu.tcl.
︙ | ︙ | |||
14 15 16 17 18 19 20 | toplevel $w wm title $w "Menu Button Demonstration" wm iconname $w "menubutton" positionWindow $w frame $w.body pack $w.body -expand 1 -fill both | < | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | toplevel $w wm title $w "Menu Button Demonstration" wm iconname $w "menubutton" positionWindow $w frame $w.body pack $w.body -expand 1 -fill both menubutton $w.body.below -text "Below" -underline 0 -direction below -menu $w.body.below.m -relief raised menu $w.body.below.m -tearoff 0 $w.body.below.m add command -label "Below menu: first item" -command "puts \"You have selected the first item from the Below menu.\"" $w.body.below.m add command -label "Below menu: second item" -command "puts \"You have selected the second item from the Below menu.\"" grid $w.body.below -row 0 -column 1 -sticky n menubutton $w.body.right -text "Right" -underline 0 -direction right -menu $w.body.right.m -relief raised |
︙ | ︙ | |||
82 83 84 85 86 87 88 | } $m configure -tearoff 1 foreach i {Black gray75 gray50 White} { $m entryconfigure $i -columnbreak 1 } pack $body.buttons.colors -side left -padx 25 -pady 25 | < < | 81 82 83 84 85 86 87 | } $m configure -tearoff 1 foreach i {Black gray75 gray50 White} { $m entryconfigure $i -columnbreak 1 } pack $body.buttons.colors -side left -padx 25 -pady 25 |
Changes to library/demos/nl.msg.
1 | ::msgcat::mcset nl "Widget Demonstration" "Demonstratie van widgets" | | < | > | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ::msgcat::mcset nl "Widget Demonstration" "Demonstratie van widgets" ::msgcat::mcset nl "tkWidgetDemo" ::msgcat::mcset nl "&File" "&Bestand" ::msgcat::mcset nl "About..." "Info..." ::msgcat::mcset nl "&About..." "&Info..." ::msgcat::mcset nl "<F1>" "<F1>" ::msgcat::mcset nl "&Quit" "&Einde" ::msgcat::mcset nl "Meta+Q" "Meta+E" ;# Displayed hotkey ::msgcat::mcset nl "Meta-q" "Meta-e" ;# Actual binding sequence ::msgcat::mcset nl "Ctrl+Q" "Ctrl+E" ;# Displayed hotkey ::msgcat::mcset nl "Control-q" "Control-e" ;# Actual binding sequence ::msgcat::mcset nl "See Variables" "Bekijk Variabelen" ::msgcat::mcset nl "Variable values" "Waarden variabelen" ::msgcat::mcset nl "Variable values:" "Waarden variabelen" ::msgcat::mcset nl "OK" ::msgcat::mcset nl "Run the \"%s\" sample program" "Start voorbeeld \"%s\"" ::msgcat::mcset nl "Dismiss" "Sluiten" ::msgcat::mcset nl "Rerun Demo" "Herstart Demo" ;# This is also button text! ::msgcat::mcset nl "Print Code" "Code Afdrukken" ::msgcat::mcset nl "Demo code: %s" "Code van Demo %s" ::msgcat::mcset nl "About Widget Demo" "Over deze demonstratie" ::msgcat::mcset nl "Tk widget demonstration" "Demonstratie van Tk widgets" ::msgcat::mcset nl "Copyright © %s" ::msgcat::mcset nl "Tk Widget Demonstrations" "Demonstratie van Tk widgets" |
︙ | ︙ | |||
32 33 34 35 36 37 38 | ::msgcat::mcset nl "appears, you can click the" \ "Zodra het nieuwe venster verschijnt, kun je op de knop" ::msgcat::mcset nl "See Code" "Bekijk Code" ;# This is also button text! ::msgcat::mcset nl "button to see the Tcl/Tk code that created the demonstration. If" \ "drukken om de achterliggende Tcl/Tk code te zien. Als je dat wilt," ::msgcat::mcset nl "you wish, you can edit the code and click the" \ "kun je de code wijzigen en op de knop" | < < | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | ::msgcat::mcset nl "appears, you can click the" \ "Zodra het nieuwe venster verschijnt, kun je op de knop" ::msgcat::mcset nl "See Code" "Bekijk Code" ;# This is also button text! ::msgcat::mcset nl "button to see the Tcl/Tk code that created the demonstration. If" \ "drukken om de achterliggende Tcl/Tk code te zien. Als je dat wilt," ::msgcat::mcset nl "you wish, you can edit the code and click the" \ "kun je de code wijzigen en op de knop" ::msgcat::mcset nl "button in the code window to reinvoke the demonstration with the" \ "drukken in het codevenster om de demonstratie uit te voeren met de" ::msgcat::mcset nl "modified code." \ "nieuwe code." ::msgcat::mcset nl "Labels, buttons, checkbuttons, and radiobuttons" \ "Labels, knoppen, vinkjes/aankruishokjes en radioknoppen" ::msgcat::mcset nl "Labels (text and bitmaps)" "Labels (tekst en plaatjes)" ::msgcat::mcset nl "Labels and UNICODE text" "Labels en tekst in UNICODE" ::msgcat::mcset nl "Buttons" "Buttons (drukknoppen)" ::msgcat::mcset nl "Check-buttons (select any of a group)" \ "Check-buttons (een of meer uit een groep)" ::msgcat::mcset nl "Radio-buttons (select one of a group)" \ "Radio-buttons (een van een groep)" |
︙ | ︙ | |||
102 103 104 105 106 107 108 | ::msgcat::mcset nl "Scales" "Schaalverdelingen" ::msgcat::mcset nl "Horizontal scale" "Horizontale schaal" ::msgcat::mcset nl "Vertical scale" "Verticale schaal" ::msgcat::mcset nl "Paned Windows" "Vensters opgedeeld in stukken" ::msgcat::mcset nl "Horizontal paned window" "Horizontaal gedeeld venster" ::msgcat::mcset nl "Vertical paned window" "Verticaal gedeeld venster" | < < | > > > > > > > > > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | ::msgcat::mcset nl "Scales" "Schaalverdelingen" ::msgcat::mcset nl "Horizontal scale" "Horizontale schaal" ::msgcat::mcset nl "Vertical scale" "Verticale schaal" ::msgcat::mcset nl "Paned Windows" "Vensters opgedeeld in stukken" ::msgcat::mcset nl "Horizontal paned window" "Horizontaal gedeeld venster" ::msgcat::mcset nl "Vertical paned window" "Verticaal gedeeld venster" ::msgcat::mcset nl "Menus" "Menu's" ::msgcat::mcset nl "Menus and cascades (sub-menus)" \ "Menu's en cascades (submenu's)" ::msgcat::mcset nl "Menu-buttons" "Menu-buttons" ::msgcat::mcset nl "Common Dialogs" "Veel voorkomende dialoogvensters" ::msgcat::mcset nl "Message boxes" "Mededeling (message box)" ::msgcat::mcset nl "File selection dialog" "Selectie van bestanden" ::msgcat::mcset nl "Color picker" "Kleurenpalet" ::msgcat::mcset nl "Font selection dialog" "Selectie van fonts" ::msgcat::mcset nl "System tray icon and notification" "Systeemvakpictogram en melding" ::msgcat::mcset nl "Printing from canvas and text widgets" "Afdrukken van canvas en tekst widgets" ::msgcat::mcset nl "Animation" "Animaties" ::msgcat::mcset nl "Animated labels" "Geanimeerde labels" ::msgcat::mcset nl "Animated wave" "Geanimeerde golf" ::msgcat::mcset nl "Pendulum simulation" "Pendulum simulatie" ::msgcat::mcset nl "A celebration of Rube Goldberg" "Een viering van Rube Goldberg" ::msgcat::mcset nl "Miscellaneous" "Diversen" ::msgcat::mcset nl "The built-in bitmaps" "Ingebouwde plaatjes" ::msgcat::mcset nl "A dialog box with a local grab" \ "Een dialoogvenster met een locale \"grab\"" ::msgcat::mcset nl "A dialog box with a global grab" \ "Een dialoogvenster met een globale \"grab\"" ::msgcat::mcset nl "Window icons and badges" "Vensterpictogrammen en badges" |
Changes to library/demos/pendulum.tcl.
︙ | ︙ | |||
90 91 92 93 94 95 96 | # Update the phase-space graph according to the current angle and the # rate at which the angle is changing (the first derivative with # respect to time.) proc showPhase {canvas} { global Theta dTheta points psw psh lappend points [expr {$Theta+$psw}] [expr {-20*$dTheta+$psh}] if {[llength $points] > 100} { | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | # Update the phase-space graph according to the current angle and the # rate at which the angle is changing (the first derivative with # respect to time.) proc showPhase {canvas} { global Theta dTheta points psw psh lappend points [expr {$Theta+$psw}] [expr {-20*$dTheta+$psh}] if {[llength $points] > 100} { set points [lrange $points end-99 end] } for {set i 0} {$i<100} {incr i 10} { set list [lrange $points end-[expr {$i-1}] end-[expr {$i-12}]] if {[llength $list] >= 4} { $canvas coords graph$i $list } } |
︙ | ︙ |
Added library/demos/print.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # print.tcl -- # # This demonstration script showcases the tk print commands. # if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } set w .print destroy $w toplevel $w wm title $w "Printing Demonstration" positionWindow $w image create photo logo -data {R0lGODlhMABLAPUAAP//////zP//mf//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM/8zMzMyZzMyZmcyZZsyZAMxmZsxmM8xmAMwzM8wzAJnMzJmZzJmZmZlmmZlmZplmM5kzZpkzM5kzAGaZzGZmzGZmmWYzZmYzMzNmzDNmmTMzmTMzZgAzmQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+BSAtZGwtACH5BAEKAAIALAAAAAAwAEsAAAb+QIFwSCwahY9HRMI8Op/JJVNSqVqv2OvjyRU8slbIJGwYg60S5ZR6jRi/4ITBOhkYIOd8dltEnAdmFQMJeoVXCEd/VnKGjRVOZ3NVgHlsjpBxVRCEYBIEAAARl4lgZmVgEQAKFx8Mo0ZnpqgAFyi2JqKGmGebWRIAILbCIo27cYFWASTCtievRXqSVwQfzLYeeYESxlnSVRIW1igjWHJmjBXbpKXeFQTizlh1eJNVHbYf0LGc39XW2PIoVZE0whasWPSqFBBHrkKEA3QG0DFTEMXBUsjCWesg4oMFAGwgtKsiwqA+jGiCiRPGAM6pLCVLGKHQ6EGJlc0IuDxzAgX+CCOW9DjAaUsEyAoT+GHpeSRoHgxEUWgAUEUpFhMWgTbKEPUBAU15TBZxekYD0RMEqCDLIpYIWTAcmGEd9rWQBxQyjeQqdK/ZTWEO3mK5l+9No75SrcHhm9WwnlzNoA5zdM+JHz0HCPQdUauZowoFnSw+c2CBvw6dUXT4LMKE6EIHUqMexgCiIREknOwl7Q+FhNQoLuzOc6Kw3kIIVOLqjYKBYCwinmgo9CBEswfMAziK7mRDoQhcUZxwoBKFibq3n3jXI0GyCPLC0DrS8GR1oaEoRBRYVhT99/qG4DcCA/yNU4Ajbjhhnx4P2DJggR3YZog6RyyYxwM9PSgMBaP+sQdgIRL0JAKBwnTooRMAFWLdiPyJ8JwvTnyQoh5midCASh149ZkTIFAmHnzOZOBfIU6U4Mhd4zF34DNEoDAhARGY50BvJkioyxFOGkKAShGkFsJwejiR5Xf8aZAaBp89coQJjuDXAQOApekEm45ANaAtIbyYxREf0OlICCK841uaahZBQjyfjXCACYjuaASjhFagRKSFNtloHg+hYWIxRohnBQWCSSAhBVZ+hkgRnlbxwJIVgIqGlaU6wkeTxHxjm6gVLImrFbHWVEQ1taZjWxJX7KqqnqgUEUxDwtqajrOaRkqhEDcxWwECbEjxTYe9gojqOJQ6JO231ob72bSqAjh4RgfsjiDCCfDCK8K8I9TL7r33nvGtCO7CO1dUAONk3LcBFxzwwEMwZ/DC4iAsRIE+CWNCbzeV8FfEtoDwVwnlacxMkcKQYIE/F5TQ2QcedUZCagyc3NsFGrXVZMipWVBCzKv4Q0JvCviDsjAwf4ylxBeX0KcwGs81ccgqGS3MBxc3RjDDVAvdBRcfeFy1MFd3bcQHJEQdlddkP5E1Cf9yXfbaV2d9RBAAOw== } pack [label $w.l -text "This demonstration showcases the tk print command. Clicking the buttons below print the data from the canvas and text widgets using platform-native dialogs."] -side top pack [frame $w.m] -fill both -expand yes -side top set c [canvas $w.m.c -bg white] pack $c -fill both -expand no -side left $c create rectangle 30 10 200 50 -fill blue -outline black $c create oval 30 60 200 110 -fill green $c create image 130 150 -image logo $c create text 150 250 -anchor n -font {Helvetica 12} \ -text "A short demo of simple canvas elements." set txt { Tcl, or Tool Command Language, is an open-source multi-purpose C library which includes a powerful dynamic scripting language. Together they provide ideal cross-platform development environment for any programming project. It has served for decades as an essential system component in organizations ranging from NASA to Cisco Systems, is a must-know language in the fields of EDA, and powers companies such as FlightAware and F5 Networks. Tcl is fit for both the smallest and largest programming tasks, obviating the need to decide whether it is overkill for a given job or whether a system written in Tcl will scale up as needed. Wherever a shell script might be used Tcl is a better choice, and entire web ecosystems and mission-critical control and testing systems have also been written in Tcl. Tcl excels in all these roles due to the minimal syntax of the language, the unique programming paradigm exposed at the script level, and the careful engineering that has gone into the design of the Tcl internals. } set t [text $w.m.t -wrap word] pack $t -side right -fill both -expand no $t insert end $txt pack [frame $w.f] -side top -fill both -expand no pack [button $w.f.b -text "Print Canvas" -command [list tk print $w.m.c]] -expand no pack [button $w.f.x -text "Print Text" -command [list tk print $w.m.t]] -expand no ## See Code / Dismiss buttons pack [addSeeDismiss $w.buttons $w] -side bottom -fill x |
Changes to library/demos/puzzle.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # puzzle.tcl -- # # This demonstration script creates a 15-puzzle game using a collection # of buttons. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk # puzzleSwitch -- # This procedure is invoked when the user clicks on a particular button; | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # puzzle.tcl -- # # This demonstration script creates a 15-puzzle game using a collection # of buttons. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk # puzzleSwitch -- # This procedure is invoked when the user clicks on a particular button; # if the button is next to the empty space, it moves the button into the # empty space. proc puzzleSwitch {w num} { global xpos ypos if {(($ypos($num) >= ($ypos(space) - .01)) && ($ypos($num) <= ($ypos(space) + .01)) && ($xpos($num) >= ($xpos(space) - .26)) |
︙ | ︙ |
Changes to library/demos/spin.tcl.
︙ | ︙ | |||
34 35 36 37 38 39 40 | set australianCities { Canberra Sydney Melbourne Perth Adelaide Brisbane Hobart Darwin "Alice Springs" } spinbox $w.s1 -from 1 -to 10 -width 10 -validate key \ | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | set australianCities { Canberra Sydney Melbourne Perth Adelaide Brisbane Hobart Darwin "Alice Springs" } spinbox $w.s1 -from 1 -to 10 -width 10 -validate key \ -validatecommand {string is integer %P} spinbox $w.s2 -from 0 -to 3 -increment .5 -format %05.2f -width 10 spinbox $w.s3 -values $australianCities -width 10 #entry $w.e1 #entry $w.e2 #entry $w.e3 pack $w.s1 $w.s2 $w.s3 -side top -pady 5 -padx 10 ;#-fill x |
︙ | ︙ |
Changes to library/demos/square.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # square -- # This script generates a demo application containing only a "square" # widget. It's only usable in the "tktest" application or if Tk has # been compiled with tkSquare.c. This demo arranges the following # bindings for the widget: # # Button-1 press/drag: moves square to mouse # "a": toggle size animation on/off | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # square -- # This script generates a demo application containing only a "square" # widget. It's only usable in the "tktest" application or if Tk has # been compiled with tkSquare.c. This demo arranges the following # bindings for the widget: # # Button-1 press/drag: moves square to mouse # "a": toggle size animation on/off package require tk ;# We use Tk generally, and... package require tk::test ;# ... we use the square widget too. square .s pack .s -expand yes -fill both wm minsize . 1 1 bind .s <Button-1> {center %x %y} bind .s <B1-Motion> {center %x %y} |
︙ | ︙ |
Added library/demos/systray.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | # systray.tcl -- # # This demonstration script showcases the tk systray and tk sysnotify commands. # if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } set w .systray destroy $w toplevel $w wm title $w "System Tray Demonstration" positionWindow $w catch {tk systray destroy} set trayIconExists false set iconmenu .menubar destroy $iconmenu menu $iconmenu $iconmenu add command -label "Status" -command { puts "status icon clicked" } $iconmenu add command -label "Exit" -command exit pack [label $w.l -text "This demonstration showcases the tk systray and tk sysnotify commands. Running this demo creates the systray icon. Clicking the buttons below modifies and destroys the icon and displays the notification."] image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== labelframe $w.f -text "Tray Icon" button $w.f.b0 -text "Create" -command create button $w.f.b1 -text "Modify" -command modify button $w.f.b2 -text "Destroy" -command remove pack $w.f.b0 $w.f.b1 $w.f.b2 -padx 5 -pady 3 -side left -expand true -fill x button $w.b3 -text "Display Notification" -command notify pack $w.f $w.b3 -expand true -fill x -padx 5 -pady 5 proc create {} { global trayIconExists if {$trayIconExists} { tk_messageBox -message "Systray icon already exists" return } tk systray create -image book -text "Systray sample" \ -button1 {puts "foo"} \ -button3 {tk_popup $iconmenu [winfo pointerx .] [winfo pointery .]} set trayIconExists true } proc modify {} { global trayIconExists if {!$trayIconExists} { tk_messageBox -message "Please create systray icon first" return } image create photo page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7 tk systray configure -image page tk systray configure -text "Modified text" tk systray configure -button1 {puts "this is a different output"} tk systray configure -button3 {puts "hello yall"} } proc notify {} { global trayIconExists if {!$trayIconExists} { tk_messageBox -message "Please create systray icon first" return } tk sysnotify "Alert" "This is an alert" } proc remove {} { global trayIconExists if {!$trayIconExists} { tk_messageBox -message "Systray icon was already destroyed" return } tk systray destroy set trayIconExists false } create ## See Code / Dismiss buttons pack [addSeeDismiss $w.buttons $w] -side bottom -fill x |
Changes to library/demos/tclIndex.
︙ | ︙ | |||
61 62 63 64 65 66 67 | set auto_index(plotMove) [list source -encoding utf-8 [file join $dir plot.tcl]] set auto_index(puzzleSwitch) [list source -encoding utf-8 [file join $dir puzzle.tcl]] set auto_index(setHeight) [list source -encoding utf-8 [file join $dir vscale.tcl]] set auto_index(showMessageBox) [list source -encoding utf-8 [file join $dir msgbox.tcl]] set auto_index(setColor) [list source -encoding utf-8 [file join $dir clrpick.tcl]] set auto_index(setColor_helper) [list source -encoding utf-8 [file join $dir clrpick.tcl]] set auto_index(fileDialog) [list source -encoding utf-8 [file join $dir filebox.tcl]] | > > > | 61 62 63 64 65 66 67 68 69 70 | set auto_index(plotMove) [list source -encoding utf-8 [file join $dir plot.tcl]] set auto_index(puzzleSwitch) [list source -encoding utf-8 [file join $dir puzzle.tcl]] set auto_index(setHeight) [list source -encoding utf-8 [file join $dir vscale.tcl]] set auto_index(showMessageBox) [list source -encoding utf-8 [file join $dir msgbox.tcl]] set auto_index(setColor) [list source -encoding utf-8 [file join $dir clrpick.tcl]] set auto_index(setColor_helper) [list source -encoding utf-8 [file join $dir clrpick.tcl]] set auto_index(fileDialog) [list source -encoding utf-8 [file join $dir filebox.tcl]] set auto_index(systray) [list source -encoding utf-8 [file join $dir systray.tcl]] set auto_index(windoicons [list source -encoding utf-8 [file join $dir windowicons.tcl]] |
Changes to library/demos/widget.
︙ | ︙ | |||
325 326 327 328 329 330 331 | @@demo radio Radio-buttons (select one of a group) @@demo puzzle A 15-puzzle game made out of buttons @@demo icon Iconic buttons that use bitmaps @@demo image1 Two labels displaying images @@demo image2 A simple user interface for viewing images @@demo labelframe Labelled frames @@demo ttkbut The simple Themed Tk widgets | | > > > > > > > | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | @@demo radio Radio-buttons (select one of a group) @@demo puzzle A 15-puzzle game made out of buttons @@demo icon Iconic buttons that use bitmaps @@demo image1 Two labels displaying images @@demo image2 A simple user interface for viewing images @@demo labelframe Labelled frames @@demo ttkbut The simple Themed Tk widgets } if {[tk windowingsystem] eq "aqua"} { addFormattedText { @@new @@demo mac_styles Special widgets for macOS } } addFormattedText { @@subtitle Listboxes and Trees @@demo states The 50 states @@demo colors Colors: change the color scheme for the application @@demo sayings A collection of famous and infamous sayings @@demo mclist A multi-column list of countries @@demo tree A directory browser tree |
︙ | ︙ | |||
362 363 364 365 366 367 368 | @@demo floor A building floor plan @@demo cscroll A simple scrollable canvas @@demo knightstour A Knight's tour of the chess board @@subtitle Scales and Progress Bars @@demo hscale Horizontal scale @@demo vscale Vertical scale | < > > > > > > | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | @@demo floor A building floor plan @@demo cscroll A simple scrollable canvas @@demo knightstour A Knight's tour of the chess board @@subtitle Scales and Progress Bars @@demo hscale Horizontal scale @@demo vscale Vertical scale @@demo ttkscale Themed scale linked to a label with traces @@demo ttkprogress Progress bar @@subtitle Paned Windows and Notebooks @@demo paned1 Horizontal paned window @@demo paned2 Vertical paned window @@demo ttkpane Themed nested panes @@demo ttknote Notebook widget @@subtitle Menus and Toolbars @@demo menu Menus and cascades (sub-menus) @@demo menubu Menu-buttons @@demo ttkmenu Themed menu buttons @@demo toolbar Themed toolbar @@subtitle Common Dialogs @@demo msgbox Message boxes @@demo filebox File selection dialog @@demo clrpick Color picker @@demo fontchoose Font selection dialog @@new @@demo systray System tray icon and notification @@new @@demo print Printing from canvas and text widgets @@subtitle Animation @@demo anilabel Animated labels @@demo aniwave Animated wave @@demo pendulum Pendulum simulation @@demo goldberg A celebration of Rube Goldberg @@subtitle Miscellaneous @@demo bitmap The built-in bitmaps @@demo dialog1 A dialog box with a local grab @@demo dialog2 A dialog box with a global grab @@new @@demo windowicons Window icons and badges } ############################################################################## .t configure -state disabled focus .s |
︙ | ︙ | |||
620 621 622 623 624 625 626 | } else { wm deiconify $top raise $top } wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]] wm iconname $top $file set id [open [file join $tk_demoDirectory $file]] | | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | } else { wm deiconify $top raise $top } wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]] wm iconname $top $file set id [open [file join $tk_demoDirectory $file]] fconfigure $id -encoding utf-8 -eofchar "\032 {}" $top.f.text delete 1.0 end $top.f.text insert 1.0 [read $id] $top.f.text mark set insert 1.0 close $id } # printCode -- # Prints the source code currently displayed in the See Code dialog. Much # thanks to Arjen Markus for this. # # Arguments: # w - Name of text widget containing code to print # file - Name of the original file (implicitly for title) proc printCode {w file} { tk print $w } # tkAboutDialog -- # # Pops up a message box with an "about" message # proc tkAboutDialog {} { tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \ -message [mc "Tk widget demonstration application"] -detail \ "[mc "Copyright © %s" {1996-1997 Sun Microsystems, Inc.}] [mc "Copyright © %s" {1997-2000 Ajuba Solutions, Inc.}] [mc "Copyright © %s" {2001-2009 Donal K. Fellows}] [mc "Copyright © %s" {2002-2007 Daniel A. Steffen}] [mc "Copyright © %s" {2021 Kevin Walzer}]" } # Local Variables: # mode: tcl # End: |
Added library/demos/windowicons.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # windowicons.tcl -- # # This demonstration script showcases the wm iconphoto and wm iconbadge commands. # if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } set w .windowicons destroy $w toplevel $w wm title $w "Window Icon Demonstration" positionWindow $w image create photo icon -data { iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGP C/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3Cc ulE8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAArQNAAK0DQEdFIm+AAAJ QElEQVRYw+WXW2xdV5nHf/ty7lcf2/FxYsdOnMSNC0HTpDiRKJWAQjWCEQNU SEAFfUOiQqrEC2+IxwpemDLSzNBBCCQeQEKqRJgBSikiuGlN22TqhsR27OPL 8eWc43Pdt7X22osHHydOm4FBPM6Slr69paX9/32Xtb614f/7MP6vC3O5f8L3 G7HJyZPHBwfz5wrF7HQ6nRwxLTOhQuU4PW+z3eq9Xa+33rq9cms7k8pHjvfS 3w8wOfk52u1u8oHpiUff897JJ8+dO/nI6LHho6OjQ3ahkMYwTTZ2O2zXutS3 G/7ayubq7Vtr/7Ve2f7RytLam4ViXq1t/vRvB0ilPsjzz3+LZ5/9j7MzM5Nf /8hj5//5H97/YNbK5hkfTFLMxAEQQvD766v0yBGIEBEEuPUGi9dv7lx77cb3 Vm9vfqc0WNi9evUKWr/xLh3rfuLj45+l0bjM7m768U98/OJ/fulLH/3wiemx eCafxRcKw7TJxKC+12RpbYdAx7HsOCrSRNpg+sQQj1w8nS0N5h8JAvm+rWr9 9ZmZB2qWdZq9vWt/GWBm5im+9rUn6HRGPv7EE4/++2P/eOFkV0FkJTDQgCaX TbO1tcV2R2EmCxBJQixs2+R9EwV00MFAceJE2ZiZOT7VaTsPLyxU5orFTK1c fphq9bX7A8zOfoV8Ps3c3NsXPvWpD37vc5//0ETNt8gNjDAzlsdAE0vliTCR xEhnC2CaRIZNMmZiaonv9mh1PcrDJQZzCfK5OGNjQ8e2tvZO37y5+ctk0naq 1fn7A4yOnmd5uVp4/PGHn/vylz8xe+zoEIP5JAMpA0OHeK6DG4TEk2li8Tha QxRpIg0q6DGUNjg6UuLYSInhYoYoigiCgHQ6TrGYnlpd3Q1ffvk3L128+ITe 2Hj1XoBLl55menqcbDb1haeeevyrDz102tJaE7ctLBMqG1X23Ag7kcKOJzAA DSilCVWEZdmMDaXJJCxSiRimaaK1RkqJ7/uUSlk6Hed0oxG9HI9bm+Pjs2xs vIp5AKC15oUX/lA8f/7MF2dnz8YADMNASslypYqrUxSHyqSy+f31hzaRZRpM DKVYr+7y4usVri1WWavWCWSIZZkYhoFSIRcuTI1MTAw9OTf33Tu7zz54SCRi nD17/Pzs7AMPFQqZPlTE8vo2DlmGhgbo12BffD/8SmukitiuNxHKoDwyzPJG nTdXmtiWwdnRNCN5GxWGDA/nOH26/NGpqSfHgPU7AJcuPc0nP/kBrl698YGZ mYmMEIJmx6Hn+my0DUZGC6gIzEOnhu4Lh2GEbRocGyxRSO/7c3QgiRuEVOtd EvEQrSN8IVEq5MSJ4YlSKX3OMKJ14G4KnnnmM9bkZPk92VyKy3M3eentJjd3 FUYyjxuEeELt7/NoP+eBVAipCFXEsYE4xcydYFIeSHKynOXhUwM0mh32egH1 tsdL16oo007kcskHs7kYly49fRcALqby+fQopklkZ4jHY3g6gQgjHF/QcgQd V+7DHJoGmnzSQuvD0QGlIsJQkU4luLXR4kgxxcRgjM1mQCyZHrv0sUe4JwKF XMmu7/VSXV9xaXqI0YzC8328QOJ4gq4raHQDGt2AtitwfIEbSAwibOvdJ7pS CiElR3IxGh2X5Y0GV66v0wnAsq3MN5759L1FqKMoCkQoX19u0QkkD47lKSYi Th1NoSLYafu0ehrTNNBaE2mNUop2z+DEUJKBbPxecSEIgoAoUjwwmmZpdZPl muL4oIFWkbx8rXIvQMfZ9p2e1xBCstOJcFe6nB1NcWokhW1ZHMkazK90qXXD fZFII0NFIBW/XQiZHraoNbsU81mmjhbxfZ8gCAiCgELKQitJGCoIQ6SQO//2 ze/fm4Kf/Px50dzr3Aoch1Ap2o4kn8tgW/sHynAxzcVTBQYzFp4v6boBjidw fcFCpcmPf7/Oz+ZrvPBalb12D9/370DUGk1evr6NacWIfD/yveDmXq3F3Nxz dwH+5dkfUq8155rb9dA2QcqQcjFx57DRGgaySR47d4RHZ0pYeh/C9QSOJ3EE CGWw3fJZ323j+x6e5xH4Pgu3d6g0FMWUjdvu7bo9/5oK1d0IzM09hwhCGrvN ubXFylI2pum4AZXtDqEURFGE1hoNxGMW5ZyB22nS8wQ9r1+QvsDzBc1uQGW7 jee6eN4+RMfxMdHkYgatWmtur9ZaOnD8TgQMA27c+uH68s3KT8O9BoYBv3pj kxuVGo7Tw+1/MAh83lreYm1P9r3fT4XjSVxf4voC1/NwHAfXdXFcB891KGVj hO2e16q3fzR2cjQwDPPeZrSx8SqXL2/RqDU2EnH7I8dPjQ8v7Tqs1RwmSzEs QoQQSBHw1lKVha0AEUb4IiQQIb4I8YUkkCHTQwa5WIjne9xY2mT+VouRfI7N xfVfrK8sfTuRSAavXP3Xd7fjavWPRq1+3TeiQTVcGnh0oHwktlZzmBq0SNsR QgiuXLvNL/+nQU/aBFL1xSW+kAghEb5PEkE5q3Bdl7dv72LGCrTXdzf+9Nb8 N5dXfrG6Wf1jeNDP3nkjigOFWm2xpvx0+tjI8LnMYMnMxQT5eIjruVye36LS TRAqRSD3vZdCIqUgEj5R4CEDj2O5kMZei3rHoLXV6Sy88cp3Fhf/ew6IAAGE 9wOIARmtw9Tu7vKa1yY+Wiqeee+ZYdsi4HdvrjK/HiKUiZQhoZREQhDJAC18 tPSIhEfouwSuQ9cx2VxpNK/PX/n+4uKvXwQdAAHgA/J+AAaQABJRJOydnVsr zZ1O13eMcSuezC61LJzQRgY+KvCJhI+WPpH0IAywIkEhaVIupAhdHS0t3F66 Nv/iD9bW/nAFtAM4QA9wAXX3RnEvQBoYODSL+fzEmalTsx+emjl3YWjsaMlM pcwg0ggZEimFoSNsI8JSCtF1wtpmdWt1aeGVSuW133leYwNoA01gr297BzVw v/8CA0gBBaDYtzkw87ns6PhI+czM0JHjp/PFUjmZSmUM07RCKUPP6XVae/Vq fbdys1ZbvOX5ja2+ULcP0Opbt18H/G8Ah+shDWQPzVQ/RSnLTGRsO5U0TMuM VKjC0PUjLd1+fgPAOxTybl9YcvdC9VcBDobV3x0JINm3MfYbmdX/hu57FfZF Dgot6Fe8eqfw3wLwzvVmX9jsvx8AHEAcnn91/BlySEFKTpuCtgAAABN0RVh0 QXV0aG9yAHdhcnN6YXdpYW5rYQy+S5cAAABYdEVYdENvcHlyaWdodABDQzAg UHVibGljIERvbWFpbiBEZWRpY2F0aW9uIGh0dHA6Ly9jcmVhdGl2ZWNvbW1v bnMub3JnL3B1YmxpY2RvbWFpbi96ZXJvLzEuMC/G4735AAAAIXRFWHRDcmVh dGlvbiBUaW1lADIwMTAtMDMtMjlUMDg6MDg6MzD47LxwAAAAJXRFWHRkYXRl OmNyZWF0ZQAyMDIxLTA4LTE1VDIwOjU0OjM5LTA0OjAwNBT3DQAAACV0RVh0 ZGF0ZTptb2RpZnkAMjAyMS0wOC0xNVQyMDo1NDoxMS0wNDowMDSDBqsAAADI elRYdERlc2NyaXB0aW9uAAAY042OwQqCQBCGn6B3GOy+Cl0qTAjEc1HRJVhW HXUrd2pmLXr7tDrVpcMP838w/F+wxxxyprsgB2ALclAxtRAbaBirRdB4f5mH oTeuJlUxYoly8nRRxHW4HahO30SvmI5Y+CCBF4dPhzg0CYwOLs45GdKfG+sK hBuy2H4xUlM1i76+BhcBwwirLj/bAlJqjXXzP9UyxmuHzp8feiknLPW6Q/H9 moy3yK1oqvROUE2yH99suX45PwEyf2MTOoCNrQAAABl0RVh0U29mdHdhcmUA d3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABWdEVYdFNvdXJjZQBodHRwczovL29w ZW5jbGlwYXJ0Lm9yZy9kZXRhaWwvMzUyMzMvdGFuZ28taW5ldHJuZXQtd2Vi LWJyb3dzZXItYnktd2Fyc3phd2lhbmth5nAuRgAAACB0RVh0VGl0bGUAdGF uZ28gaW5ldHJuZXQgd2ViIGJyb3dzZXLyr62TAAAAAElFTkSuQmCC } set ::tk::icons::base_icon(.) icon pack [button $w.i -text "Set Window Icon to Globe" -image $::tk::icons::base_icon(.) \ -compound top -command {wm iconphoto . $::tk::icons::base_icon(.) }] pack [button $w.b -text "Set Badge to 3" -command {wm iconbadge . 3}] pack [button $w.e -text "Set Badge to 11" -command {wm iconbadge . 11}] pack [button $w.f -text "Reset Badge" -command {wm iconbadge . ""}] ## See Code / Dismiss buttons pack [addSeeDismiss $w.buttons $w] -side bottom -fill x |
Changes to library/entry.tcl.
︙ | ︙ | |||
115 116 117 118 119 120 121 | tk::CancelRepeat } bind Entry <Control-Button-1> { %W icursor @%x } bind Entry <<PrevChar>> { | | | | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | tk::CancelRepeat } bind Entry <Control-Button-1> { %W icursor @%x } bind Entry <<PrevChar>> { tk::EntrySetCursor %W [tk::EntryPreviousChar %W insert] } bind Entry <<NextChar>> { tk::EntrySetCursor %W [tk::EntryNextChar %W insert] } bind Entry <<SelectPrevChar>> { tk::EntryKeySelect %W [tk::EntryPreviousChar %W insert] tk::EntrySeeInsert %W } bind Entry <<SelectNextChar>> { tk::EntryKeySelect %W [tk::EntryNextChar %W insert] tk::EntrySeeInsert %W } bind Entry <<PrevWord>> { tk::EntrySetCursor %W [tk::EntryPreviousWord %W insert] } bind Entry <<NextWord>> { tk::EntrySetCursor %W [tk::EntryNextWord %W insert] |
︙ | ︙ | |||
161 162 163 164 165 166 167 | tk::EntrySeeInsert %W } bind Entry <Delete> { if {[%W selection present]} { %W delete sel.first sel.last } else { | | > | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | tk::EntrySeeInsert %W } bind Entry <Delete> { if {[%W selection present]} { %W delete sel.first sel.last } else { %W delete [tk::startOfCluster [%W get] [%W index insert]] \ [tk::endOfCluster [%W get] [%W index insert]] } } bind Entry <BackSpace> { tk::EntryBackspace %W } bind Entry <Control-space> { |
︙ | ︙ | |||
191 192 193 194 195 196 197 | %W selection clear } bind Entry <Key> { tk::CancelRepeat tk::EntryInsert %W %A } | | < | < > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | %W selection clear } bind Entry <Key> { tk::CancelRepeat tk::EntryInsert %W %A } # Ignore all Alt, Meta, Control, Command, and Fn keypresses unless explicitly bound. # Otherwise, if a widget binding for one of these is defined, the # <Key> class binding will also fire and insert the character, # which is wrong. Ditto for Escape, Return, and Tab. bind Entry <Alt-Key> {# nothing} bind Entry <Meta-Key> {# nothing} bind Entry <Control-Key> {# nothing} bind Entry <Escape> {# nothing} bind Entry <Return> {# nothing} bind Entry <KP_Enter> {# nothing} bind Entry <Tab> {# nothing} bind Entry <Prior> {# nothing} bind Entry <Next> {# nothing} bind Entry <Command-Key> {# nothing} bind Entry <Fn-Key> {# nothing} # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] bind Entry <<NextLine>> {# nothing} bind Entry <<PrevLine>> {# nothing} # On Windows, paste is done using Shift-Insert. Shift-Insert already # generates the <<Paste>> event, so we don't need to do anything here. if {[tk windowingsystem] ne "win32"} { |
︙ | ︙ | |||
274 275 276 277 278 279 280 | # Bindings for IME text input and accents. bind Entry <<TkStartIMEMarkedText>> { dict set ::tk::Priv(IMETextMark) "%W" [%W index insert] } bind Entry <<TkEndIMEMarkedText>> { | | < < < < > > > > > > > > > > > > > > > > > | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | # Bindings for IME text input and accents. bind Entry <<TkStartIMEMarkedText>> { dict set ::tk::Priv(IMETextMark) "%W" [%W index insert] } bind Entry <<TkEndIMEMarkedText>> { ::tk::EntryEndIMEMarkedText %W } bind Entry <<TkClearIMEMarkedText>> { %W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert] } bind Entry <<TkAccentBackspace>> { tk::EntryBackspace %W } # ::tk::EntryEndIMEMarkedText -- # Handles input method text marking in an entry # # Arguments: # w - The entry window. proc ::tk::EntryEndIMEMarkedText {w} { variable Priv if {[catch { set mark [dict get $Priv(IMETextMark) $w] }]} { bell return } $w selection range $mark insert } # A few additional bindings of my own. bind Entry <Button-2> { if {!$tk_strictMotif} { ::tk::EntryScanMark %W %x } |
︙ | ︙ | |||
373 374 375 376 377 378 379 | } else { $w selection clear } } } word { if {$cur < $anchor} { | | | | | | | | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | } else { $w selection clear } } } word { if {$cur < $anchor} { set before [tk::wordBreakBefore [$w get] $cur] set after [tk::wordBreakAfter [$w get] $anchor-1] } elseif {$cur > $anchor} { set before [tk::wordBreakBefore [$w get] $anchor] set after [tk::wordBreakAfter [$w get] $cur-1] } else { if {[$w index @$Priv(pressX)] < $anchor} { incr anchor -1 } set before [tk::wordBreakBefore [$w get] $anchor] set after [tk::wordBreakAfter [$w get] $anchor] } if {$before < 0} { set before 0 } if {$after < 0} { set after end } |
︙ | ︙ | |||
501 502 503 504 505 506 507 | # Arguments: # w - The entry window in which to backspace. proc ::tk::EntryBackspace w { if {[$w selection present]} { $w delete sel.first sel.last } else { | | | | > | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | # Arguments: # w - The entry window in which to backspace. proc ::tk::EntryBackspace w { if {[$w selection present]} { $w delete sel.first sel.last } else { set x [expr {[$w index insert] - 1}] if {$x >= 0} { $w delete [tk::startOfCluster [$w get] $x] \ [tk::endOfCluster [$w get] $x] } if {[$w index @0] >= [$w index insert]} { set range [$w xview] set left [lindex $range 0] set right [lindex $range 1] $w xview moveto [expr {$left - ($right - $left)/2.0}] } |
︙ | ︙ | |||
561 562 563 564 565 566 567 | set i [$w index insert] if {$i < [$w index end]} { incr i } if {$i < 2} { return } | | | | | | > > > > > > > > > > > > > > > > > | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | set i [$w index insert] if {$i < [$w index end]} { incr i } if {$i < 2} { return } set first $i-2 set data [$w get] set new [string index $data $i-1][string index $data $first] $w delete $first $i $w insert insert $new EntrySeeInsert $w } # ::tk::EntryNextWord -- # Returns the index of the next word position after a given position in the # entry. The next word is platform dependent and may be either the next # end-of-word position or the next start-of-word position after the next # end-of-word position. # # Arguments: # w - The entry window in which the cursor is to move. # start - Position at which to start search. if {[tk windowingsystem] eq "win32"} { proc ::tk::EntryNextWord {w start} { set pos [tk::endOfWord [$w get] [$w index $start]] if {$pos >= 0} { set pos [tk::startOfNextWord [$w get] $pos] } if {$pos < 0} { return end } return $pos } } else { proc ::tk::EntryNextWord {w start} { set pos [tk::endOfWord [$w get] [$w index $start]] if {$pos < 0} { return end } return $pos } } # ::tk::EntryPreviousWord -- # # Returns the index of the previous word position before a given # position in the entry. # # Arguments: # w - The entry window in which the cursor is to move. # start - Position at which to start search. proc ::tk::EntryPreviousWord {w start} { set pos [tk::startOfPreviousWord [$w get] [$w index $start]] if {$pos < 0} { return 0 } return $pos } proc ::tk::EntryNextChar {w start} { set pos [tk::endOfCluster [$w get] [$w index $start]] if {$pos < 0} { return end } return $pos } proc ::tk::EntryPreviousChar {w start} { set pos [tk::startOfCluster [$w get] [expr {[$w index $start]-1}]] if {$pos < 0} { return 0 } return $pos } # ::tk::EntryScanMark -- # # Marks the start of a possible scan drag operation # # Arguments: # w - The entry window from which the text to get |
︙ | ︙ |
Changes to library/fontchooser.tcl.
1 2 3 4 | # fontchooser.tcl - # # A themeable Tk font selection dialog. See TIP #324. # | | | | | | | | < < | > > > > > > > > > > > > > > > > > > > > > | < < < < < | | > > > > > > > | > | > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | # fontchooser.tcl - # # A themeable Tk font selection dialog. See TIP #324. # # Copyright © 2008 Keith Vetter # Copyright © 2008 Pat Thoyts <[email protected]> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. namespace eval ::tk::fontchooser { variable S set S(W) .__tk__fontchooser set S(fonts) [lsort -dictionary -unique [font families]] set S(styles) [list \ [::msgcat::mc Regular] \ [::msgcat::mc Italic] \ [::msgcat::mc Bold] \ [::msgcat::mc {Bold Italic}] \ ] set S(sizes) {8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72} set S(strike) 0 set S(under) 0 set S(first) 1 set S(-parent) . set S(-title) {} set S(-command) "" set S(-font) TkDefaultFont set S(bad) [list ] } proc ::tk::fontchooser::Canonical {} { variable S foreach style $S(styles) { lappend S(styles,lcase) [string tolower $style] } set S(sizes,lcase) $S(sizes) set S(sampletext) [::msgcat::mc "AaBbYyZz01"] # Canonical versions of font families, styles, etc. for easier searching set S(fonts,lcase) {} foreach font $S(fonts) { lappend S(fonts,lcase) [string tolower $font] } set S(styles,lcase) {} foreach style $S(styles) { lappend S(styles,lcase) [string tolower $style] } } proc ::tk::fontchooser::Setup {} { variable S Canonical ::ttk::style layout FontchooserFrame { Entry.field -sticky news -border true -children { FontchooserFrame.padding -sticky news } } bind [winfo class .] <<ThemeChanged>> \ [list +ttk::style layout FontchooserFrame \ [ttk::style layout FontchooserFrame]] namespace ensemble create -map { show ::tk::fontchooser::Show hide ::tk::fontchooser::Hide configure ::tk::fontchooser::Configure } } ::tk::fontchooser::Setup proc ::tk::fontchooser::Show {} { variable S Canonical if {![winfo exists $S(W)]} { Create wm transient $S(W) [winfo toplevel $S(-parent)] tk::PlaceWindow $S(W) widget $S(-parent) if {[string trim $S(-title)] eq ""} { wm title $S(W) [::msgcat::mc "Font"] } else { wm title $S(W) $S(-title) } } set S(fonts) [lsort -dictionary -unique [font families]] set S(fonts,lcase) {} foreach font $S(fonts) { lappend S(fonts,lcase) [string tolower $font] } wm deiconify $S(W) } proc ::tk::fontchooser::Hide {} { variable S wm withdraw $S(W) } |
︙ | ︙ | |||
87 88 89 90 91 92 93 | } if {[llength $args] == 0} { set result {} foreach spec $specs { foreach {name xx yy default} $spec break lappend result $name \ | | | | | < | | | < < | | > | | > > > > > > > > > | > > | | | | | | | | | | | | | | | | | | | | | | > > | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | } if {[llength $args] == 0} { set result {} foreach spec $specs { foreach {name xx yy default} $spec break lappend result $name \ [expr {[info exists S($name)] ? $S($name) : $default}] } lappend result -visible \ [expr {[winfo exists $S(W)] && [winfo ismapped $S(W)]}] return $result } if {[llength $args] == 1} { set option [lindex $args 0] if {[string equal $option "-visible"]} { return [expr {[winfo exists $S(W)] && [winfo ismapped $S(W)]}] } elseif {[info exists S($option)]} { return $S($option) } return -code error -errorcode [list TK LOOKUP OPTION $option] \ "bad option \"$option\": must be\ -command, -font, -parent, -title or -visible" } set cache [dict create -parent $S(-parent) -title $S(-title) \ -font $S(-font) -command $S(-command)] set r [tclParseConfigSpec [namespace which -variable S] $specs DONTSETDEFAULTS $args] if {![winfo exists $S(-parent)]} { set code [list TK LOOKUP WINDOW $S(-parent)] set err "bad window path name \"$S(-parent)\"" array set S $cache return -code error -errorcode $code $err } if {[winfo exists $S(W)]} { if {{-font} in $args} { Init $S(-font) event generate $S(-parent) <<TkFontchooserFontChanged>> } if {[string trim $S(-title)] eq {}} { wm title $S(W) [::msgcat::mc Font] } else { wm title $S(W) $S(-title) } $S(W).ok configure -state $S(nstate) $S(W).apply configure -state $S(nstate) } return $r } proc ::tk::fontchooser::Create {} { variable S set windowName __tk__fontchooser if {$S(-parent) eq "."} { set S(W) .$windowName } else { set S(W) $S(-parent).$windowName } # Now build the dialog if {![winfo exists $S(W)]} { toplevel $S(W) -class TkFontDialog if {[package provide tcltest] ne {}} { set ::tk_dialog $S(W) } wm withdraw $S(W) wm title $S(W) $S(-title) wm transient $S(W) [winfo toplevel $S(-parent)] set scaling [tk scaling] set sizeWidth [expr {int([string length [::msgcat::mc "&Size:"]] * $scaling)}] set outer [::ttk::frame $S(W).outer -padding {10 10}] ::tk::AmpWidget ::ttk::label $S(W).font -text [::msgcat::mc "&Font:"] ::tk::AmpWidget ::ttk::label $S(W).style -text [::msgcat::mc "Font st&yle:"] ::tk::AmpWidget ::ttk::label $S(W).size -text [::msgcat::mc "&Size:"] -width $sizeWidth ttk::entry $S(W).efont -width 18 \ -textvariable [namespace which -variable S](font) ttk::entry $S(W).estyle -width 10 \ -textvariable [namespace which -variable S](style) ttk::entry $S(W).esize -textvariable [namespace which -variable S](size) \ -width 3 -validate key -validatecommand {regexp -- {^-*[0-9]*$} %P} ttk_slistbox $S(W).lfonts -height 7 -exportselection 0 \ -selectmode browse -activestyle none \ -listvariable [namespace which -variable S](fonts) ttk_slistbox $S(W).lstyles -width 5 -height 7 -exportselection 0 \ -selectmode browse -activestyle none \ -listvariable [namespace which -variable S](styles) ttk_slistbox $S(W).lsizes -width 4 -height 7 -exportselection 0 \ -selectmode browse -activestyle none \ -listvariable [namespace which -variable S](sizes) set WE $S(W).effects ::ttk::labelframe $WE -text [::msgcat::mc "Effects"] ::tk::AmpWidget ::ttk::checkbutton $WE.strike \ -variable [namespace which -variable S](strike) \ -text [::msgcat::mc "Stri&keout"] \ -command [namespace code [list Click strike]] ::tk::AmpWidget ::ttk::checkbutton $WE.under \ -variable [namespace which -variable S](under) \ -text [::msgcat::mc "&Underline"] \ -command [namespace code [list Click under]] set bbox [::ttk::frame $S(W).bbox] ::ttk::button $S(W).ok -text [::msgcat::mc OK] -default active\ -command [namespace code [list Done 1]] ::ttk::button $S(W).cancel -text [::msgcat::mc Cancel] \ -command [namespace code [list Done 0]] ::tk::AmpWidget ::ttk::button $S(W).apply -text [::msgcat::mc "&Apply"] \ -command [namespace code [list Apply]] wm protocol $S(W) WM_DELETE_WINDOW [namespace code [list Done 0]] # Calculate minimum sizes ttk::scrollbar $S(W).tmpvs set scroll_width [winfo reqwidth $S(W).tmpvs] destroy $S(W).tmpvs set minsize(gap) 10 set minsize(bbox) [winfo reqwidth $S(W).ok] set minsize(fonts) \ [expr {[font measure TkDefaultFont "Helvetica"] + $scroll_width}] set minsize(styles) \ [expr {[font measure TkDefaultFont "Bold Italic"] + $scroll_width}] set minsize(sizes) \ [expr {[font measure TkDefaultFont "-99"] + $scroll_width}] set min [expr {$minsize(gap) * 4}] foreach {what width} [array get minsize] { incr min $width } wm minsize $S(W) $min 260 bind $S(W) <Return> [namespace code [list Done 1]] bind $S(W) <Escape> [namespace code [list Done 0]] bind $S(W) <Map> [namespace code [list Visibility %W 1]] bind $S(W) <Unmap> [namespace code [list Visibility %W 0]] bind $S(W) <Destroy> [namespace code [list Visibility %W 0]] |
︙ | ︙ | |||
220 221 222 223 224 225 226 | bind $S(W).apply <<AltUnderlined>> [namespace code [list Apply]] bind $WE.strike <<AltUnderlined>> [list $WE.strike invoke] bind $WE.under <<AltUnderlined>> [list $WE.under invoke] set WS $S(W).sample ::ttk::labelframe $WS -text [::msgcat::mc "Sample"] ::ttk::label $WS.sample -relief sunken -anchor center \ | | < | < > | | | > > > > > | | < > > > | | > > | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | bind $S(W).apply <<AltUnderlined>> [namespace code [list Apply]] bind $WE.strike <<AltUnderlined>> [list $WE.strike invoke] bind $WE.under <<AltUnderlined>> [list $WE.under invoke] set WS $S(W).sample ::ttk::labelframe $WS -text [::msgcat::mc "Sample"] ::ttk::label $WS.sample -relief sunken -anchor center \ -textvariable [namespace which -variable S](sampletext) set S(sample) $WS.sample grid $WS.sample -sticky news -padx 6 -pady 4 grid rowconfigure $WS 0 -weight 1 grid columnconfigure $WS 0 -weight 1 grid propagate $WS 0 grid $S(W).ok -in $bbox -sticky new -pady {0 2} grid $S(W).cancel -in $bbox -sticky new -pady 2 grid $S(W).apply -in $bbox -sticky new -pady 2 grid columnconfigure $bbox 0 -weight 1 grid $WE.strike -sticky w -padx 10 grid $WE.under -sticky w -padx 10 -pady {0 30} grid columnconfigure $WE 1 -weight 1 grid $S(W).font x $S(W).style x $S(W).size x -in $outer -sticky w grid $S(W).efont x $S(W).estyle x $S(W).esize x $bbox -in $outer -sticky ew grid $S(W).lfonts x $S(W).lstyles x $S(W).lsizes x ^ -in $outer -sticky news grid $WE x $WS - - x ^ -in $outer -sticky news -pady {15 30} grid configure $bbox -sticky n grid rowconfigure $outer 2 -weight 1 grid columnconfigure $outer {1 3 5} -minsize $minsize(gap) grid columnconfigure $outer {0 2 4} -weight 1 grid columnconfigure $outer 0 -minsize $minsize(fonts) grid columnconfigure $outer 2 -minsize $minsize(styles) grid columnconfigure $outer 4 -minsize $minsize(sizes) grid columnconfigure $outer 6 -minsize $minsize(bbox) grid $outer -sticky news grid rowconfigure $S(W) 0 -weight 1 grid columnconfigure $S(W) 0 -weight 1 Init $S(-font) trace add variable [namespace which -variable S](size) \ write [namespace code [list Tracer]] trace add variable [namespace which -variable S](style) \ write [namespace code [list Tracer]] trace add variable [namespace which -variable S](font) \ write [namespace code [list Tracer]] trace add variable [namespace which -variable S](strike) \ write [namespace code [list Tracer]] trace add variable [namespace which -variable S](under) \ write [namespace code [list Tracer]] } Init $S(-font) return } # ::tk::fontchooser::Done -- # # Handles teardown of the dialog, calling -command if needed # # Arguments: # ok true if user pressed OK # proc ::tk::fontchooser::Done {ok} { variable S if {! $ok} { set S(result) "" } trace vdelete S(size) w [namespace code [list Tracer]] trace vdelete S(style) w [namespace code [list Tracer]] trace vdelete S(font) w [namespace code [list Tracer]] trace vdelete S(strike) w [namespace code [list Tracer]] trace vdelete S(under) w [namespace code [list Tracer]] destroy $S(W) if {$ok} { if {$S(-command) ne ""} { uplevel #0 $S(-command) [list $S(result)] } event generate $S(-parent) <<TkFontchooserFontChanged>> } } # ::tk::fontchooser::Apply -- # # Call the -command procedure appending the current font # Errors are reported via the background error mechanism |
︙ | ︙ | |||
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | # Arguments: # defaultFont font to use as the default # proc ::tk::fontchooser::Init {{defaultFont ""}} { variable S if {$S(first) || $defaultFont ne ""} { if {$defaultFont eq ""} { set defaultFont [[entry .___e] cget -font] destroy .___e } array set F [font actual $defaultFont] set S(font) $F(-family) set S(size) $F(-size) set S(strike) $F(-overstrike) set S(under) $F(-underline) | > > < < < < < < < | | < | < | | | | | | | > > > > | < < | > | | > | > > | | > | > > | > > > | > | > > | > > | > > | > > | > | > > | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | # Arguments: # defaultFont font to use as the default # proc ::tk::fontchooser::Init {{defaultFont ""}} { variable S if {$S(first) || $defaultFont ne ""} { Canonical if {$defaultFont eq ""} { set defaultFont [[entry .___e] cget -font] destroy .___e } array set F [font actual $defaultFont] set S(font) $F(-family) set S(style) [::msgcat::mc "Regular"] set S(size) $F(-size) set S(strike) $F(-overstrike) set S(under) $F(-underline) if {$F(-weight) eq "bold" && $F(-slant) eq "italic"} { set S(style) [::msgcat::mc "Bold Italic"] } elseif {$F(-weight) eq "bold"} { set S(style) [::msgcat::mc "Bold"] } elseif {$F(-slant) eq "italic"} { set S(style) [::msgcat::mc "Italic"] } set S(first) 0 } } # ::tk::fontchooser::Click -- # # Handles all button clicks, updating the appropriate widgets # # Arguments: # who which widget got pressed # proc ::tk::fontchooser::Click {who} { variable S if {$who eq "font"} { set S(font) [$S(W).lfonts get [$S(W).lfonts curselection]] } elseif {$who eq "style"} { set S(style) [$S(W).lstyles get [$S(W).lstyles curselection]] } elseif {$who eq "size"} { set S(size) [$S(W).lsizes get [$S(W).lsizes curselection]] } } # ::tk::fontchooser::Tracer -- # # Handles traces on key variables, updating the appropriate widgets # # Arguments: # standard trace arguments (not used) # proc ::tk::fontchooser::Tracer {var1 var2 op} { variable S # We don't need to process strike and under if {$var2 ni [list strike under]} { # Make selection in listbox set value [string tolower $S($var2)] $S(W).l${var2}s selection clear 0 end set n [lsearch -exact $S(${var2}s,lcase) $value] $S(W).l${var2}s selection set $n if {$n >= 0} { set S($var2) [lindex $S(${var2}s) $n] $S(W).e$var2 icursor end $S(W).e$var2 selection clear if {[set i [lsearch $S(bad) $var2]] >= 0} { set S(bad) [lreplace $S(bad) $i $i] } } else { # No match, try prefix set n [lsearch -glob $S(${var2}s,lcase) "$value*"] if {$var2 ne "size" || !([regexp -- {^(-[0-9]+|[0-9]+)$} $value] && $value >= -4096 && $value <= 4096)} { if {[lsearch $S(bad) $var2] < 0} { lappend S(bad) $var2 } } else { if {[set i [lsearch $S(bad) $var2]] >= 0} { set S(bad) [lreplace $S(bad) $i $i] } } } $S(W).l${var2}s see $n } if {[llength $S(bad)] == 0} { set S(nstate) normal Update } else { set S(nstate) disabled } $S(W).ok configure -state $S(nstate) $S(W).apply configure -state $S(nstate) } # ::tk::fontchooser::Update -- # # Shows a sample of the currently selected font # proc ::tk::fontchooser::Update {} { variable S set S(result) [list $S(font) $S(size)] if {$S(style) eq [::msgcat::mc "Bold"]} { lappend S(result) bold } if {$S(style) eq [::msgcat::mc "Italic"]} { lappend S(result) italic } if {$S(style) eq [::msgcat::mc "Bold Italic"]} { lappend S(result) bold italic } if {$S(strike)} { lappend S(result) overstrike } if {$S(under)} { lappend S(result) underline } $S(sample) configure -font $S(result) set S(-font) $S(result) } # ::tk::fontchooser::Visibility -- # # Notify the parent when the dialog visibility changes # proc ::tk::fontchooser::Visibility {w visible} { variable S if {$w eq $S(W)} { event generate $S(-parent) <<TkFontchooserVisibility>> } } # ::tk::fontchooser::ttk_slistbox -- # # Create a properly themed scrolled listbox. # This is exactly right on XP but may need adjusting on other platforms. # proc ::tk::fontchooser::ttk_slistbox {w args} { set f [ttk::frame $w -style FontchooserFrame -padding 2] if {[catch { |
︙ | ︙ |
Added library/iconbadges.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | # iconbadges.tcl -- # # Notification badges for Tk applications. # # # Copyright © 2021 Kevin Walzer/WordTech Communications LLC namespace eval ::tk::icons {} image create photo ::tk::icons::1-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA kFBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/HBz/V1f/Rkb/BQX/Dw//oKD/////y8v/Bgb/Pz//ra3/+/v/ zMz/Li7/5ub/+vr/8fH/Ly//uLj/Zmb/n5//Bwf/Dg7/kpL/YWH/rq7/h4f/Cgr/ AQH/AgLXmjE+AAAAEXRSTlMAAA5Vq9/4NK/0St3cDa7z4Pnet34AAAABYktHRBib aYUeAAAAnElEQVQY022Q5w6DMBCD78hi03RQuvegg77/25ULCakq/MenT4piGwAQ A8aFlIKzABGAiAojbRSFihhinOheSdwyVKn+UaoQsry7x5PpjDzPgBWGlPNqUdJR MODky9V6U20N0hwE2W5/ODokQJKdzperQ7JDt7uuPRL299o/5P+IuxA9akO4qI/n 622jukLNp3GFBmoPjOMnHNkJv3kDExXHctm+AAAAJXRFWHRkYXRlOmNyZWF0ZQAy MDIxLTA4LTEwVDA4OjM1OjE0LTA0OjAw0aX6GwAAACV0RVh0ZGF0ZTptb2RpZnkA MjAyMS0wOC0xMFQwODozNToxNC0wNDowMKD4QqcAAAAASUVORK5CYII= } image create photo ::tk::icons::2-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA 21BMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/Cwv/ODj/UlL/UFD/MjL/CAj/ExP/oKD/8fH//v7//f3/7u7/ kJD/DAz/ZWX/9fX/jIz/lpb/+vr/9/f/TEz/TU3/m5v/iYn/Ly//6+v/////YmL/ nJz/5OT/MDD/KSn/srL/7Oz/ZGT/AQH/Nzf/zs7/zc3/SUn/AgL/ICD/ysr/7e3/ gYH/VVX/WVn/Kir/fX3/eXn/AwP/dnb/rKz/qan/q6vjChO4AAAAEXRSTlMAAA5V q9/4NK/0St3cDa7z4Pnet34AAAABYktHRCy63XGrAAAAwElEQVQY021Q1xLCMAxz uktpS9hQoOwZ9t57/P8XUSesB/RinXz2SQIAQiRZUTVNVWSJEABUdMOkHKaho0ZI yKIfWKFAI3qY/iCsE7AdZNFYPJFMIXNskN1gpjNZL5cv+AF1ZVBwVfRK5Uq1Vkeu gIqj0Wz57Q7rIldBe/1N91h/gER7S8ORN55MhcQP6WzOFssVFYf8/XrDtrv94Sje cxMnxnEWJtDq5Xq7B3gkhFUeaCUwFYH+xP5TzrfCyKvCJ3EzGUFH/1QDAAAAJXRF WHRkYXRlOmNyZWF0ZQAyMDIxLTA4LTEwVDA4OjM1OjE0LTA0OjAw0aX6GwAAACV0 RVh0ZGF0ZTptb2RpZnkAMjAyMS0wOC0xMFQwODozNToxNC0wNDowMKD4QqcAAAAA SUVORK5CYII= } image create photo ::tk::icons::3-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA +VBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/CQn/NTX/UlL/Tk7/Kir/BAT/ERH/mZn/8PD/+Pj/+vr/5ub/ cHD/AgL/Vlb/9PT/5eX/X1//nZ3/////29v/HR3/Fhb/QED/RET/Cwv/f3//1dX/ Ghr/Bwf/mpr/9vb/+fn/b2//lZX/2tr//Pz/wsL/Jyf/Dg7/Bgb/MzP/c3P/XV3/ wMD/qqr/ExP/KSn/4+P/bm7/Q0P/6ur/vb3/x8f/19f/KCj/SEj/qan/zc3/y8v/ oKD/ODj/BQX/DQ3/AwON+4wDAAAAEXRSTlMAAA5Vq9/4NK/0St3cDa7z4Pnet34A AAABYktHRCXDAckPAAAAx0lEQVQY021Q1RLCQBDbo4qW4l7ssOLu7g7//zH07oo8 kJfNZGczyQIAQhaOF0RR4DkLQgBEkWSrSmGVJaIhZLOrH9hthoYkh/oDh4TA6SLM 4/X5A0HCXE7gFGOGwpFoLJ7QDKpwwJNVMpXOZHEuTzgPAhmFYkkv40qVcAFEZlur N5otysS3pLc73V6fSfRQ8wyGozges0NqP5nO5oslXjF7GmK96W53eH9gIWhU7Xg6 X643M6pZ6D54PN+F/tT+85zvC93mC1+z9hl5VNGhJwAAACV0RVh0ZGF0ZTpjcmVh dGUAMjAyMS0wOC0xMFQwODozNToxNC0wNDowMNGl+hsAAAAldEVYdGRhdGU6bW9k aWZ5ADIwMjEtMDgtMTBUMDg6MzU6MTQtMDQ6MDCg+EKnAAAAAElFTkSuQmCC } image create photo ::tk::icons::4-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA 1VBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/AgL/OTn/W1v/ODj/QED/4uL/////oaH/AQH/KSn/zs7/oqL/ Fhb/tbX/9PT/1NT/Cgr/l5f//Pz/h4f/fHz/dXX/+/v/trb/HBz/fX3/qKj/DAz/ EBD/ysr/4eH/zc3/5eX/8fH/lJT/BAT/Dw//uLj/5+f/5ub/8vL/+vr/paX/BQX/ HR3/JCT/ISH/iYn/sLD/Ghr/Tk7/rq7/a2vT0ZXAAAAAEXRSTlMAAA5Vq9/4NK/0 St3cDa7z4Pnet34AAAABYktHRBibaYUeAAAAvklEQVQY022QVRPCMBCEL1RSg5Ji Ibi7W9Hi//8n0aRBHtiXvflm7mZvAQChmKJquq6pSgwhAE6wYRIh08CcIWTZ5CPb ChnCDvmRgxHEE9HspdIZ7ok4KG6EsjmaZ6G7CqgRKRQpLXFEVNAEKVeqNYk00LnV G81WWyJdINbp9voDOhxFiC+OJ3Q6m9PFciUW+fn1xt/6O7o/HMV5HsI7BcH5Qq83 JkK8o5L74ymjfh5iHpMP/Xn7TznfCpOywhdM6Ra8aC+AYwAAACV0RVh0ZGF0ZTpj cmVhdGUAMjAyMS0wOC0xMFQwODozNToxNS0wNDowMHfS8a8AAAAldEVYdGRhdGU6 bW9kaWZ5ADIwMjEtMDgtMTBUMDg6MzU6MTUtMDQ6MDAGj0kTAAAAAElFTkSuQmCC } image create photo ::tk::icons::5-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA 7VBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/ICD/MjL/Li7/CQn/Bgb/q6v/8/P/8vL/9PT/4uL/FRX/0tL/ ////wsL/xcX/uLj/Jib/Kyv/6ur/8fH/aGj/XV3/SUn/Fhb/AQH/+Pj//Pz/7Oz/ +fn/l5f/Dg7/ODj/qan/sLD/W1v/fn7/9/f/+vr/WVn/EBD/Ghr/2dn/gID/X1// oKD/EhL/5OT/Y2P/S0v/7e3/vb3/ycn/yMj/HR3/AwP/Skr/zc3/LCz/BQX/DAz/ AgKLBoLHAAAAEXRSTlMAAA5Vq9/4NK/0St3cDa7z4Pnet34AAAABYktHRB5yCiAr AAAAyUlEQVQY021Q1RLDMAxzVhp1XcbYMXXMzIz//zmLk9HD9GKdzvZJAgBCbJKs qKoiSzZCAFDR7A7K4bBrqBHidNEPXE6mEc1Nf+DWCOgeZD4/QyDImEcHyWAzFI5E I7F4gFFDAhmXEkkzmUpnsshlUHDk8oViqVyxkCug4ihXa/VGtNlCrgqp3en2+oPh SEj80AqO6WRqzsQhfz/PLJa5lbkW77mJzba225uHozDBrZ7Oncu+eaXC6ivQrXV/ vAP9if2nnG+F3leFT2jDGOnV8F/uAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTA4 LTEwVDA4OjM1OjE1LTA0OjAwd9LxrwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0w OC0xMFQwODozNToxNS0wNDowMAaPSRMAAAAASUVORK5CYII= } image create photo ::tk::icons::6-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA 9lBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/AQH/ICD/S0v/UlL/NDT/CAj/WVn/2dn/+Pj/+fn/8PD/jY3/ Cgr/LCz/4OD//f3/hob/cHD/5eX/1NT/NTX/bGz/////39//T0//Bwf/j4//5ub/ wcH/7+//4uL/f3//CQn/lpb/+/v/n5//iIj/8vL/9/f/UVH/hYX/3t7/Hx//vb3/ VVX/6Oj/MzP/ExP/x8f/e3v/EhL/t7f/0tL/wMD/MTH/IiL/xsb/zc3/qKj/QkL/ AgL/Cwv/Dg7/BQWiS7IgAAAAEXRSTlMAAA5Vq9/4NK/0St3cDa7z4Pnet34AAAAB YktHRCi9sLWyAAAAyklEQVQY021Q1RLCQBDbowalBYq7y+FWirs7/P/PwPawB/Ky mezsThIAIMTC8YIoCjxnIQQAFclq00zYrBJqhMh27QO7/NSIpGg/UCQCqgOZ2+P1 +QPIHCpwTlSCoXAkGos/qZMDHleJZCqdyebyyHkQcBRoMeEvecrIBRBxVGi1Vm80 W8hFJrWp3jG6vT6TzMMBHY4CY2qwQ/P9RJ/O5gu6ZO9NE6s13Wz14o6ZYFb3scPx dHYzq69Al+vt/g70J/afcr4Vul4VPgDLCRmO3FuJegAAACV0RVh0ZGF0ZTpjcmVh dGUAMjAyMS0wOC0xMFQwODozNToxNS0wNDowMHfS8a8AAAAldEVYdGRhdGU6bW9k aWZ5ADIwMjEtMDgtMTBUMDg6MzU6MTUtMDQ6MDAGj0kTAAAAAElFTkSuQmCC } image create photo ::tk::icons::7-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA xlBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/Hh7/Njb/NTX/Ghr/i4v/9/f/8/P/8vL/8fH/9PT/eHj/fHz/ 3Nz/2Nj/19f/6Oj/////+Pj/YGD/DQ3/Fxf/FRX/IiL/trb/j4//CQn/Zmb/+/v/ xsb/GBj/HR3/0tL//f3/Xl7/ZGT/1dX/BAT/p6f/n5//AQH/Fhb/09P/c3P/GRn/ mZn/qqr/PT3/AgKXVg1iAAAAEXRSTlMAAA5Vq9/4NK/0St3cDa7z4Pnet34AAAAB YktHRCJdZVysAAAAu0lEQVQY022Q1xKCMBBFN5LQixFR7Bp77wU7//9TJgTFB+7L njmTydxdAECooGCiqgQrBYQAhNF0gyYxdE04hEyL/mKZ3CHNpn+xNQSOy6Hkl3n8 gKPrgOLxWamGYa3eaHL0FMDieavd6fZYfyAYAxFjOBpPpmw2F0xATf9dLFfrBNSv 2mx3e5oqIuHAjoEkIr+npzO7RFJhWYJeb+wuDS+RVKWP5+stFa8qF4riOFsoZ+2c 42QnLKYn/ADYChWCRPB9rQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wOC0xMFQw ODozNToxNS0wNDowMHfS8a8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDgtMTBU MDg6MzU6MTUtMDQ6MDAGj0kTAAAAAElFTkSuQmCC } image create photo ::tk::icons::8-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA 6lBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/Bwf/MjL/UVH/TU3/Kir/BAT/DAz/j4//7e3/+Pj/5+f/eXn/ BQX/Skr/9/f/7+//Z2f/fn7/+/v/6ur/MDD/UFD/4uL/Jib/QUH/9PT/NTX/EhL/ srL/////09P/2tr/m5v/CAj/ycn//f3/y8v/1dX/s7P/GBj/hYX/HR3/Zmb/0dH/ LCz/5eX/dHT/S0v/wsL/NDT/V1f/sLD/zc3/ysr/paX/RUX/AQH/Bgb/Dg7/DQ3m iTf5AAAAEXRSTlMAAA5Vq9/4NK/0St3cDa7z4Pnet34AAAABYktHRC8j1CARAAAA yklEQVQY021Q1RLCQBDbowZFSpEWh+J+xd3d/v936N5hD+QlmezsTrIAQIhLECVZ lkTBRQgAOorbozN43Ap6hKhe/QOv6nhE8ek/8CkE/AFUoXAkapioAn4QNIdj8UQy mUpnHKkJIOIom7PyhWKpjFoECalSrNbqDauJWgIZqdWmdod2e6hlbhn9wXBExxNu scUptWfhFJ3zRXY+TheT5Yqu+XkWYmMNtkNa3fEQLGpmfziezpcrj/oqdLs/zHeh P7X/POf7wuDrhU+46hlBGTVCQgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wOC0x MFQwODozNToxNS0wNDowMHfS8a8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDgt MTBUMDg6MzU6MTUtMDQ6MDAGj0kTAAAAAElFTkSuQmCC } image create photo ::tk::icons::9-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA 8FBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/DAz/OTn/U1P/R0f/HBz/AQH/Fhb/oqL/8/P/+fn/+Pj/1NT/ S0v/cXH/////29v/W1v/mJj/0ND/AgL/paX/np7/Ly//7e3//Pz/lZX/vr7/GBj/ VVX/9fX/c3P/QED/5ub//f3/19f/4OD/+/v/eXn/Pz//mZn/oaH/dXX/6Oj/Z2f/ Kir/cHD/enr/FRX/TU3/8PD/Ojr/Ozv/2tr/nJz/CAj/Tk7/sbH/z8//wcH/Bgb/ Dw//CgoJOUsyAAAAEXRSTlMAAA5Vq9/4NK/0St3cDa7z4Pnet34AAAABYktHRCCz az2AAAAAy0lEQVQY022Q1RLCQAxFs9QovlAozuLu7u72/39D0y3yQB6SO2cmmXsD AITYBFGSZUkUbIQAIFHsKjVLtSvICHE46aecDoMRxUV/yqUQcHtQ+QNaMKSj8rhB 8BozHInG4okkIq8AIs4US2eyLBdCLYJk9HyBFWmpXNEQSSDjqLJavdFkLdQyR+1O t9cfsCFHuEj10XgynbE5XzTPL5ar9Sa+3fHzpon9rFI7sOOJmzCt5s+X6221tqxa ge6Pp/4O9Cf2n+d8X+izXvgCm5cZM7QQ1AwAAAAldEVYdGRhdGU6Y3JlYXRlADIw MjEtMDgtMTBUMDg6MzU6MTUtMDQ6MDB30vGvAAAAJXRFWHRkYXRlOm1vZGlmeQAy MDIxLTA4LTEwVDA4OjM1OjE1LTA0OjAwBo9JEwAAAABJRU5ErkJggg== } image create photo ::tk::icons::9plus-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAB OFBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/ERH/AAD/NDT/AQH/AAD/AAD/Cgr/Nzf/U1P/SUn/Hx//AQH/mJj/8fH/+fn/ 2dn/VFT/BAT/YmL//f3/4uL/YGD/j4//IyP/GBj/xsb/xcX/Fxf/lZX/////rKz/ JSX/5eX/3t7/3Nz/AgL/hob/yMj/Hh7/Skr/fn7/MTH/srL/vr7/9fX/NDT/NTX/ 39///v7/3d3/+vr/g4P/RET/9PT/+/v/8/P/R0f/OTn/lpb/pKT/c3P/4eH/dHT/ Dw//Pz//VVX/5ub/ExP/JCT/bW3/fX3/Ghr/QUH/Rkb/Gxv/wsL/1dX/p6f/DAz/ e3v/enr/Dg7/ra3/zs7/w8P/gYH/GRn/Bgb/CwuphzIHAAAAFHRSTlMAAA5Vq9/4 NK/0St3cDa7z8/Ou4A5hHfoAAAABYktHRCy63XGrAAAA+ElEQVQY02NgYGBkZGJm YWVjY2VhZmJkZGAAibBzcIqAAScHO0iMkZGLWwQOuLmAYozsPCJIgIedkYGXT1RM XEJSCibGx8vAzC8tIysrJw/kKUhKKogIMDOwKCopq6gqyamJiKhraGqJiLAwsGrr 6Erp6euoABUZGEoqGLEysBnrmJiayeiYW1haWVtbWdqwMbDZ2tnLOTjqODm7uNrb u7q5szGwinh4enn76Pj6+QcE6gf4B7EysASHhIaFu1lHiIhEGhiGgYxnFvSxj4rW iYkVEfGLi08AOYJXKCIxKTklFcmpQA+lJaRLIXsIi7exBA4iCIWhQQgAiNMk9J5+ e/MAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDgtMTBUMDg6MzU6MTYtMDQ6MDBG OusyAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTA4LTEwVDA4OjM1OjE2LTA0OjAw N2dTjgAAAABJRU5ErkJggg== } image create photo ::tk::icons::!-badge -data { iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAABGdBTUEAALGPC/xh BQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA olBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/Fhb/QED/Pj7/ExP/VVX/9PT/8PD/SUn/WFj//v7/+fn/S0v/ SEj/PDz/MjL/6Oj/Jyf/ICD/4+P/2Nj/Fxf/Dw//qKj/nZ3/Cgr/IyP/hIT/gYH/ Hh7/PT3/Ly//paX/oqL/KCj/AgL///8V6AjgAAAAEXRSTlMAAA5Vq9/4NK/0St3c Da7z4Pnet34AAAABYktHRDXettlrAAAAoElEQVQY022QxxKCQBBEZ9hERkygophz lv//NmF3Bz0wp1dd1V3dAwCIDuNCSsGZgwjQKMr1Un2eqxoN0Q/S9gK/1lCF6d+F CiGKNfYHw5GGOAKWaBpn+URDwoAbw3RWzA1xEAYWRVYaEiANLPPV2pAkabPd7Umy xsPxdCajjb9cb3eKtyXq+AeVsFWfr/eHqtKgqmoHdczueM7vhT37wi9PRRMHXNeq aAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wOC0xMFQwODozNToxNi0wNDowMEY6 6zIAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDgtMTBUMDg6MzU6MTYtMDQ6MDA3 Z1OOAAAAAElFTkSuQmCC } if {[tk windowingsystem] eq "x11"} { # ::tk::icons::IconBadge -- # This procedure creates an icon with an overlay badge on systems that # do not have a native icon/badge API. # # Arguments: # win - window name # badgenumber - badge number to draw over the window icon proc ::tk::icons::IconBadge {win badgenumber} { variable ::tk::icons::base_icon if {![info exists ::tk::icons::base_icon]} { return -code error "::tk::icons::base_icon($win) must be set on X11" } if {![info exists ::tk::icons::base_icon($win)]} { return -code error "::tk::icons::base_icon($win) must be set on X11" } if {[lsearch -exact [image names] $::tk::icons::base_icon($win)] <= 0} { return -code error "can't use \"$::tk::icons::base_icon($win)\" as iconphoto: not a photo image" } if {!([string is integer $badgenumber] && $badgenumber > 0) && [string match $badgenumber "!"] == 0 && $badgenumber ne ""} { return -code error "can't use \"$badgenumber\" as icon badge" } wm iconphoto $win $::tk::icons::base_icon($win) if {$badgenumber eq ""} { return } image create photo overlay switch -glob -- $badgenumber { ! { set badge ::tk::icons::!-badge } [1-9] { set badge ::tk::icons::$badgenumber-badge } default { set badge ::tk::icons::9plus-badge } } overlay copy $::tk::icons::base_icon($win) overlay copy $badge -from 0 0 18 18 -to 18 0 wm iconphoto $win overlay } } |
Changes to library/iconlist.tcl.
︙ | ︙ | |||
22 23 24 25 26 27 28 | # <path> see <index> # <path> selection anchor ?<int>? # <path> selection clear <first> ?<last>? # <path> selection get # <path> selection includes <item> # <path> selection set <first> ?<last>? | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # <path> see <index> # <path> selection anchor ?<int>? # <path> selection clear <first> ?<last>? # <path> selection get # <path> selection includes <item> # <path> selection set <first> ?<last>? package require tk ::tk::Megawidget create ::tk::IconList ::tk::FocusableWidget { variable w canvas sbar accel accelCB fill font index \ itemList itemsPerColumn list maxIH maxIW maxTH maxTW noScroll \ numItems oldX oldY options rect selected selection textList constructor args { next {*}$args |
︙ | ︙ | |||
334 335 336 337 338 339 340 | foreach sublist $list { set usedColumn 1 lassign $sublist iTag tTag rTag iW iH tW tH set i_dy [expr {($dy - $iH)/2}] set t_dy [expr {($dy - $tH)/2}] | | | | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | foreach sublist $list { set usedColumn 1 lassign $sublist iTag tTag rTag iW iH tW tH set i_dy [expr {($dy - $iH)/2}] set t_dy [expr {($dy - $tH)/2}] $canvas coords $iTag $x [expr {$y + $i_dy}] $canvas coords $tTag [expr {$x + $shift}] [expr {$y + $t_dy}] $canvas coords $rTag $x $y [expr {$x+$dx}] [expr {$y+$dy}] incr y $dy if {($y + $dy) > $H} { set y [expr {$pad * 1}] ; # *1 ? incr x $dx set usedColumn 0 |
︙ | ︙ | |||
452 453 454 455 456 457 458 | bind $canvas <<PrevLine>> [namespace code {my UpDown -1}] bind $canvas <<NextLine>> [namespace code {my UpDown 1}] bind $canvas <<PrevChar>> [namespace code {my LeftRight -1}] bind $canvas <<NextChar>> [namespace code {my LeftRight 1}] bind $canvas <Return> [namespace code {my ReturnKey}] bind $canvas <Key> [namespace code {my KeyPress %A}] | > > | > | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | bind $canvas <<PrevLine>> [namespace code {my UpDown -1}] bind $canvas <<NextLine>> [namespace code {my UpDown 1}] bind $canvas <<PrevChar>> [namespace code {my LeftRight -1}] bind $canvas <<NextChar>> [namespace code {my LeftRight 1}] bind $canvas <Return> [namespace code {my ReturnKey}] bind $canvas <Key> [namespace code {my KeyPress %A}] bind $canvas <Alt-Key> {# nothing} bind $canvas <Meta-Key> {# nothing} bind $canvas <Control-Key> {# nothing} bind $canvas <Command-Key> {# nothing} bind $canvas <Fn-Key> {# nothing} bind $canvas <FocusIn> [namespace code {my FocusIn}] bind $canvas <FocusOut> [namespace code {my FocusOut}] return $w } |
︙ | ︙ |
Changes to library/icons.tcl.
1 2 3 4 5 6 | # icons.tcl -- # # A set of stock icons for use in Tk dialogs. The icons used here # were provided by the Tango Desktop project which provides a # unified set of high quality icons licensed under the # Creative Commons Attribution Share-Alike license | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # icons.tcl -- # # A set of stock icons for use in Tk dialogs. The icons used here # were provided by the Tango Desktop project which provides a # unified set of high quality icons licensed under the # Creative Commons Attribution Share-Alike license # (https://creativecommons.org/licenses/by-sa/3.0/) # # See http://tango.freedesktop.org/Tango_Desktop_Project # # Copyright © 2009 Pat Thoyts <[email protected]> namespace eval ::tk::icons {} |
︙ | ︙ |
Changes to library/listbox.tcl.
1 2 3 4 5 6 7 | # listbox.tcl -- # # This file defines the default bindings for Tk listbox widgets # and provides procedures that help in implementing those bindings. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # listbox.tcl -- # # This file defines the default bindings for Tk listbox widgets # and provides procedures that help in implementing those bindings. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. # Copyright © 1998 Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. #-------------------------------------------------------------------------- # tk::Priv elements used in this file: # |
︙ | ︙ | |||
173 174 175 176 177 178 179 | %W scan mark %x %y } bind Listbox <B2-Motion> { %W scan dragto %x %y } bind Listbox <MouseWheel> { | | | | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | %W scan mark %x %y } bind Listbox <B2-Motion> { %W scan dragto %x %y } bind Listbox <MouseWheel> { tk::MouseWheel %W y %D -40.0 } bind Listbox <Option-MouseWheel> { tk::MouseWheel %W y %D -12.0 } bind Listbox <Shift-MouseWheel> { tk::MouseWheel %W x %D -40.0 } bind Listbox <Shift-Option-MouseWheel> { tk::MouseWheel %W x %D -12.0 } # ::tk::ListboxBeginSelect -- # # This procedure is typically invoked on button-1 presses. It begins # the process of making a selection in the listbox. Its exact behavior # depends on the selection mode currently in effect for the listbox; |
︙ | ︙ | |||
244 245 246 247 248 249 250 | $w selection clear 0 end $w selection set $el set Priv(listboxPrev) $el tk::FireListboxSelectEvent $w } extended { set i $Priv(listboxPrev) | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | $w selection clear 0 end $w selection set $el set Priv(listboxPrev) $el tk::FireListboxSelectEvent $w } extended { set i $Priv(listboxPrev) if {$i < 0} { set i $el $w selection set $el } if {[$w selection includes anchor]} { $w selection clear $i $el $w selection set anchor $el } else { |
︙ | ︙ | |||
454 455 456 457 458 459 460 | proc ::tk::ListboxCancel w { variable ::tk::Priv if {[$w cget -selectmode] ne "extended"} { return } set first [$w index anchor] set last $Priv(listboxPrev) | | | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | proc ::tk::ListboxCancel w { variable ::tk::Priv if {[$w cget -selectmode] ne "extended"} { return } set first [$w index anchor] set last $Priv(listboxPrev) if {$last < 0} { # Not actually doing any selection right now return } if {$first > $last} { set tmp $first set first $last set last $tmp |
︙ | ︙ |
Changes to library/megawidget.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 | # megawidget.tcl # # Basic megawidget support classes. Experimental for any use other than # the ::tk::IconList megawdget, which is itself only designed for use in # the Unix file dialogs. # # Copyright © 2009-2010 Donal K. Fellows # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # megawidget.tcl # # Basic megawidget support classes. Experimental for any use other than # the ::tk::IconList megawdget, which is itself only designed for use in # the Unix file dialogs. # # Copyright © 2009-2010 Donal K. Fellows # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # package require tk ::oo::class create ::tk::Megawidget { superclass ::oo::class method unknown {w args} { if {[string match .* $w]} { [self] create $w {*}$args return $w |
︙ | ︙ |
Changes to library/menu.tcl.
1 2 3 4 5 6 7 8 | # menu.tcl -- # # This file defines the default bindings for Tk menus and menubuttons. # It also implements keyboard traversal of menus and implements a few # other utility procedures related to menus. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # menu.tcl -- # # This file defines the default bindings for Tk menus and menubuttons. # It also implements keyboard traversal of menus and implements a few # other utility procedures related to menus. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 2007 Daniel A. Steffen <[email protected]> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # #------------------------------------------------------------------------- |
︙ | ︙ | |||
265 266 267 268 269 270 271 | "can't post $menu: it isn't a descendant of $w" } set cur $Priv(postedMb) if {$cur ne ""} { MenuUnpost {} } if {$::tk_strictMotif} { | | | | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | "can't post $menu: it isn't a descendant of $w" } set cur $Priv(postedMb) if {$cur ne ""} { MenuUnpost {} } if {$::tk_strictMotif} { set Priv(cursor) [$w cget -cursor] $w configure -cursor arrow } if {[tk windowingsystem] ne "aqua"} { set Priv(relief) [$w cget -relief] $w configure -relief raised } else { $w configure -state active } set Priv(postedMb) $w set Priv(focus) [focus] $menu activate {} GenerateMenuSelect $menu update idletasks if {[catch {PostMenubuttonMenu $w $menu $x $y} msg opt]} { # Error posting menu (e.g. bogus -postcommand). Unpost it and # reflect the error. MenuUnpost {} return -options $opt $msg } set Priv(tearoff) $tearoff |
︙ | ︙ | |||
339 340 341 342 343 344 345 | catch { if {$mb ne ""} { set menu [$mb cget -menu] $menu unpost set Priv(postedMb) {} if {$::tk_strictMotif} { | | | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | catch { if {$mb ne ""} { set menu [$mb cget -menu] $menu unpost set Priv(postedMb) {} if {$::tk_strictMotif} { $mb configure -cursor $Priv(cursor) } if {[tk windowingsystem] ne "aqua"} { $mb configure -relief $Priv(relief) } else { $mb configure -state normal } } elseif {$Priv(popup) ne ""} { $Priv(popup) unpost set Priv(popup) {} } elseif {[$menu cget -type] ne "menubar" && [$menu cget -type] ne "tearoff"} { # We're in a cascaded sub-menu from a torn-off menu or popup. # Unpost all the menus up to the toplevel one (but not # including the top-level torn-off one) and deactivate the # top-level torn off menu if there is one. while {1} { set parent [winfo parent $menu] if {[winfo class $parent] ne "Menu" || ![winfo ismapped $parent]} { break } $parent activate {} $parent postcascade {} GenerateMenuSelect $parent set type [$parent cget -type] if {$type eq "menubar" || $type eq "tearoff"} { break } set menu $parent } |
︙ | ︙ | |||
471 472 473 474 475 476 477 | # x - The x position of the mouse. # y - The y position of the mouse. # state - Modifier state (tells whether buttons are down). proc ::tk::MenuMotion {menu x y state} { variable ::tk::Priv if {$menu eq $Priv(window)} { | | | | | | | | | | | | | > | | | > | | | | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | # x - The x position of the mouse. # y - The y position of the mouse. # state - Modifier state (tells whether buttons are down). proc ::tk::MenuMotion {menu x y state} { variable ::tk::Priv if {$menu eq $Priv(window)} { set activeindex [$menu index active] if {[$menu cget -type] eq "menubar"} { if {[info exists Priv(focus)] && $menu ne $Priv(focus)} { $menu activate @$x,$y GenerateMenuSelect $menu } } else { $menu activate @$x,$y GenerateMenuSelect $menu } set index [$menu index @$x,$y] if {[info exists Priv(menuActivated)] \ && $index >= 0 \ && $index ne $activeindex} { set mode [option get $menu clickToFocus ClickToFocus] if {[string is false $mode]} { set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}] if {[$menu type $index] eq "cascade"} { # Catch these postcascade commands since the menu could be # destroyed before they run. set Priv(menuActivatedTimer) \ [after $delay [list catch [list \ $menu postcascade active]]] } else { set Priv(menuDeactivatedTimer) \ [after $delay [list catch [list $menu postcascade {}]]] } } } } } # ::tk::MenuButtonDown -- # Handles button presses in menus. There are a couple of tricky things # here: # 1. Change the posted cascade entry (if any) to match the mouse position. |
︙ | ︙ | |||
521 522 523 524 525 526 527 | # Arguments: # menu - The menu window. proc ::tk::MenuButtonDown menu { variable ::tk::Priv if {![winfo viewable $menu]} { | | | | | | | | | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | # Arguments: # menu - The menu window. proc ::tk::MenuButtonDown menu { variable ::tk::Priv if {![winfo viewable $menu]} { return } if {[$menu index active] < 0} { if {[$menu cget -type] ne "menubar" } { set Priv(window) {} } return } $menu postcascade active if {$Priv(postedMb) ne "" && [winfo viewable $Priv(postedMb)]} { grab -global $Priv(postedMb) } else { while {[$menu cget -type] eq "normal" \ && [winfo class [winfo parent $menu]] eq "Menu" \ && [winfo ismapped [winfo parent $menu]]} { set menu [winfo parent $menu] } if {$Priv(menuBar) eq {}} { set Priv(menuBar) $menu if {$::tk_strictMotif} { set Priv(cursor) [$menu cget -cursor] $menu configure -cursor arrow } if {[$menu type active] eq "cascade"} { set Priv(menuActivated) 1 } } # Don't update grab information if the grab window isn't changing. # Otherwise, we'll get an error when we unpost the menus and # restore the grab, since the old grab window will not be viewable # anymore. if {$menu ne [grab current $menu]} { |
︙ | ︙ | |||
581 582 583 584 585 586 587 | # menu - The menu window. # rootx, rooty - Root coordinates of mouse. # state - Modifier state. proc ::tk::MenuLeave {menu rootx rooty state} { variable ::tk::Priv set Priv(window) {} | | | | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | # menu - The menu window. # rootx, rooty - Root coordinates of mouse. # state - Modifier state. proc ::tk::MenuLeave {menu rootx rooty state} { variable ::tk::Priv set Priv(window) {} if {[$menu index active] < 0} { return } if {[$menu type active] eq "cascade" \ && [winfo containing $rootx $rooty] eq \ [$menu entrycget active -menu]} { return } $menu activate {} GenerateMenuSelect $menu } # ::tk::MenuInvoke -- # This procedure is invoked when button 1 is released over a menu. # It invokes the appropriate menu action and unposts the menu if # it came from a menubutton. |
︙ | ︙ | |||
611 612 613 614 615 616 617 | variable ::tk::Priv if {$buttonRelease && $Priv(window) eq ""} { # Mouse was pressed over a menu without a menu button, then # dragged off the menu (possibly with a cascade posted) and # released. Unpost everything and quit. | | | | | | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | variable ::tk::Priv if {$buttonRelease && $Priv(window) eq ""} { # Mouse was pressed over a menu without a menu button, then # dragged off the menu (possibly with a cascade posted) and # released. Unpost everything and quit. $w postcascade {} $w activate {} event generate $w <<MenuSelect>> MenuUnpost $w return } if {[$w type active] eq "cascade"} { $w postcascade active set menu [$w entrycget active -menu] MenuFirstEntry $menu } elseif {[$w type active] eq "tearoff"} { ::tk::TearOffMenu $w MenuUnpost $w } elseif {[$w cget -type] eq "menubar"} { $w postcascade {} set active [$w index active] set isCascade [string equal [$w type $active] "cascade"] # Only de-activate the active item if it's a cascade; this prevents # the annoying "activation flicker" you otherwise get with # checkbuttons/commands/etc. on menubars if { $isCascade } { $w activate {} event generate $w <<MenuSelect>> } MenuUnpost $w # If the active item is not a cascade, invoke it. This enables # the use of checkbuttons/commands/etc. on menubars (which is legal, # but not recommended) if { !$isCascade } { uplevel #0 [list $w invoke $active] } } else { set active [$w index active] if {$Priv(popup) eq "" || $active >= 0} { MenuUnpost $w } uplevel #0 [list $w invoke active] } } # ::tk::MenuEscape -- |
︙ | ︙ | |||
753 754 755 756 757 758 759 | set parent [winfo parent $parent] } } } else { set count -1 set m2 [winfo parent $menu] if {[winfo class $m2] eq "Menu"} { | | | | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | set parent [winfo parent $parent] } } } else { set count -1 set m2 [winfo parent $menu] if {[winfo class $m2] eq "Menu"} { $menu activate {} GenerateMenuSelect $menu tk_menuSetFocus $m2 $m2 postcascade {} if {[$m2 cget -type] ne "menubar"} { return } } } |
︙ | ︙ | |||
793 794 795 796 797 798 799 | while {$i >= $length} { incr i -$length } set mb [lindex $buttons $i] if {[winfo class $mb] eq "Menubutton" \ && [$mb cget -state] ne "disabled" \ && [$mb cget -menu] ne "" \ | | | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | while {$i >= $length} { incr i -$length } set mb [lindex $buttons $i] if {[winfo class $mb] eq "Menubutton" \ && [$mb cget -state] ne "disabled" \ && [$mb cget -menu] ne "" \ && [[$mb cget -menu] index last] >= 0} { break } if {$mb eq $w} { return } incr i $count } |
︙ | ︙ | |||
815 816 817 818 819 820 821 | # # Arguments: # menu - Menu window that received the keystroke. # count - 1 means go to the next lower entry, # -1 means go to the next higher entry. proc ::tk::MenuNextEntry {menu count} { | | > | | 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 | # # Arguments: # menu - Menu window that received the keystroke. # count - 1 means go to the next lower entry, # -1 means go to the next higher entry. proc ::tk::MenuNextEntry {menu count} { set last [$menu index last] if {$last < 0} { return } set length [expr {[$menu index last]+1}] set quitAfter $length set active [$menu index active] if {$active < 0} { set i 0 } else { set i [expr {$active + $count}] } while {1} { if {$quitAfter <= 0} { # We've tried every entry in the menu. Either there are |
︙ | ︙ | |||
889 890 891 892 893 894 895 | proc ::tk::MenuFind {w char} { set char [string tolower $char] set windowlist [winfo child $w] foreach child $windowlist { # Don't descend into other toplevels. | | | 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | proc ::tk::MenuFind {w char} { set char [string tolower $char] set windowlist [winfo child $w] foreach child $windowlist { # Don't descend into other toplevels. if {[winfo toplevel $w] ne [winfo toplevel $child]} { continue } if {[winfo class $child] eq "Menu" && \ [$child cget -type] eq "menubar"} { if {$char eq ""} { return $child } |
︙ | ︙ | |||
915 916 917 918 919 920 921 | } } } } foreach child $windowlist { # Don't descend into other toplevels. | | | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | } } } } foreach child $windowlist { # Don't descend into other toplevels. if {[winfo toplevel $w] ne [winfo toplevel $child]} { continue } switch -- [winfo class $child] { Menubutton { set char2 [string index [$child cget -text] \ [$child cget -underline]] if {$char eq [string tolower $char2] || $char eq ""} { |
︙ | ︙ | |||
1022 1023 1024 1025 1026 1027 1028 | proc ::tk::TraverseWithinMenu {w char} { if {$char eq ""} { return } set char [string tolower $char] set last [$w index last] | < < < | 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | proc ::tk::TraverseWithinMenu {w char} { if {$char eq ""} { return } set char [string tolower $char] set last [$w index last] for {set i 0} {$i <= $last} {incr i} { if {[catch {set char2 [string index \ [$w entrycget $i -label] [$w entrycget $i -underline]]}]} { continue } if {$char eq [string tolower $char2]} { if {[$w type $i] eq "cascade"} { |
︙ | ︙ | |||
1064 1065 1066 1067 1068 1069 1070 | # menu - Name of the menu window (possibly empty). proc ::tk::MenuFirstEntry menu { if {$menu eq ""} { return } tk_menuSetFocus $menu | | < < < | 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | # menu - Name of the menu window (possibly empty). proc ::tk::MenuFirstEntry menu { if {$menu eq ""} { return } tk_menuSetFocus $menu if {[$menu index active] >= 0} { return } set last [$menu index last] for {set i 0} {$i <= $last} {incr i} { if {([catch {set state [$menu entrycget $i -state]}] == 0) \ && $state ne "disabled" && [$menu type $i] ne "tearoff"} { $menu activate $i GenerateMenuSelect $menu # Only post the cascade if the current menu is a menubar; # otherwise, if the first entry of the cascade is a cascade, |
︙ | ︙ | |||
1110 1111 1112 1113 1114 1115 1116 | proc ::tk::MenuFindName {menu s} { set i "" if {![regexp {^active$|^last$|^none$|^[0-9]|^@} $s]} { catch {set i [$menu index $s]} return $i } set last [$menu index last] | < < < | 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | proc ::tk::MenuFindName {menu s} { set i "" if {![regexp {^active$|^last$|^none$|^[0-9]|^@} $s]} { catch {set i [$menu index $s]} return $i } set last [$menu index last] for {set i 0} {$i <= $last} {incr i} { if {![catch {$menu entrycget $i -label} label]} { if {$label eq $s} { return $i } } } |
︙ | ︙ | |||
1134 1135 1136 1137 1138 1139 1140 | # menubutton, meaning that the indicator is on and the direction is # neither above nor below, then the menu is posted so that the current # entry is vertically aligned with the menubutton. On the Mac this # will expose a small amount of the blue indicator on the right hand # side. On other platforms the entry is centered over the button. if {[tk windowingsystem] eq "aqua"} { | | | 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 | # menubutton, meaning that the indicator is on and the direction is # neither above nor below, then the menu is posted so that the current # entry is vertically aligned with the menubutton. On the Mac this # will expose a small amount of the blue indicator on the right hand # side. On other platforms the entry is centered over the button. if {[tk windowingsystem] eq "aqua"} { proc ::tk::PostMenubuttonMenu {button menu cx cy} { set entry "" if {[$button cget -indicatoron]} { set entry [MenuFindName $menu [$button cget -text]] if {$entry eq ""} { set entry 0 } } |
︙ | ︙ | |||
1159 1160 1161 1162 1163 1164 1165 | } left { incr x [expr {-[winfo reqwidth $menu]}] } right { incr x [winfo width $button] } | | | | < < < < | | > > > > > | | > | | | | 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | } left { incr x [expr {-[winfo reqwidth $menu]}] } right { incr x [winfo width $button] } default { # flush incr x [expr {[winfo width $button] - [winfo reqwidth $menu] - 5}] } } PostOverPoint $menu $x $y $entry } } else { proc ::tk::PostMenubuttonMenu {button menu cx cy} { set entry "" if {[$button cget -indicatoron]} { set entry [MenuFindName $menu [$button cget -text]] if {$entry eq ""} { set entry 0 } } set x [winfo rootx $button] set y [winfo rooty $button] switch [$button cget -direction] { above { incr y [expr {-[winfo reqheight $menu]}] # if we go offscreen to the top, show as 'below' if {$y < [winfo vrooty $button]} { set y [expr {[winfo vrooty $button] + [winfo rooty $button]\ + [winfo reqheight $button]}] } set entry {} } below { incr y [winfo height $button] # if we go offscreen to the bottom, show as 'above' set mh [winfo reqheight $menu] if {($y + $mh) > ([winfo vrooty $button] + [winfo vrootheight $button])} { set y [expr {[winfo vrooty $button] + [winfo vrootheight $button] \ + [winfo rooty $button] - $mh}] } set entry {} } left { incr x [expr {- [winfo reqwidth $menu]}] } right { incr x [expr {[winfo width $button]}] } default { # flush if {[$button cget -indicatoron]} { if {$cx ne ""} { set x [expr {$cx - [winfo reqwidth $menu] / 2}] set l [font metrics [$menu cget -font] -linespace] set y [expr {$cy - $l/2 - 2}] } else { incr x [expr {([winfo width $button] - \ [winfo reqwidth $menu])/ 2}] } } else { incr y [winfo height $button] } } } PostOverPoint $menu $x $y $entry } } # ::tk::PostOverPoint -- |
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | # If omitted or specified as {}, then the menu's # upper-left corner goes at (x,y). if {[tk windowingsystem] ne "win32"} { proc ::tk::PostOverPoint {menu x y {entry {}}} { if {$entry ne ""} { $menu post $x $y $entry | > | | 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 | # If omitted or specified as {}, then the menu's # upper-left corner goes at (x,y). if {[tk windowingsystem] ne "win32"} { proc ::tk::PostOverPoint {menu x y {entry {}}} { if {$entry ne ""} { $menu post $x $y $entry if {[$menu type $entry] ni {separator tearoff} && [$menu entrycget $entry -state] ne "disabled"} { $menu activate $entry GenerateMenuSelect $menu } } else { $menu post $x $y } return |
︙ | ︙ | |||
1365 1366 1367 1368 1369 1370 1371 | proc ::tk_popup {menu x y {entry {}}} { variable ::tk::Priv if {$Priv(popup) ne "" || $Priv(postedMb) ne ""} { tk::MenuUnpost {} } tk::PostOverPoint $menu $x $y $entry if {[tk windowingsystem] eq "x11" && [winfo viewable $menu]} { | | | 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | proc ::tk_popup {menu x y {entry {}}} { variable ::tk::Priv if {$Priv(popup) ne "" || $Priv(postedMb) ne ""} { tk::MenuUnpost {} } tk::PostOverPoint $menu $x $y $entry if {[tk windowingsystem] eq "x11" && [winfo viewable $menu]} { tk::SaveGrabInfo $menu grab -global $menu set Priv(popup) $menu set Priv(window) $menu set Priv(menuActivated) 1 tk_menuSetFocus $menu } } |
Changes to library/msgs/cs.msg.
︙ | ︙ | |||
70 71 72 73 74 75 76 77 | ::msgcat::mcset cs "extensions" "pípony" ::msgcat::mcset cs "green" "zeleá" ::msgcat::mcset cs "ignore" "ignorovat" ::msgcat::mcset cs "ok" ::msgcat::mcset cs "red" "červeá" ::msgcat::mcset cs "retry" "znovu" ::msgcat::mcset cs "yes" "ano" } | > > > > > > > > > > > > > > > > > > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | ::msgcat::mcset cs "extensions" "pípony" ::msgcat::mcset cs "green" "zeleá" ::msgcat::mcset cs "ignore" "ignorovat" ::msgcat::mcset cs "ok" ::msgcat::mcset cs "red" "červeá" ::msgcat::mcset cs "retry" "znovu" ::msgcat::mcset cs "yes" "ano" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset cs "Print" "Tisknout" ::msgcat::mcset cs "Printer" "Tiskárna" ::msgcat::mcset cs "Letter " "Dopis " ::msgcat::mcset cs "Legal " "Legální " ::msgcat::mcset cs "A4" "A4" ::msgcat::mcset cs "Grayscale" "Stupně Šedi" ::msgcat::mcset cs "RGB" "RGB" ::msgcat::mcset cs "Options" "Možnosti" ::msgcat::mcset cs "Copies" "Kopie" ::msgcat::mcset cs "Paper" "Papír" ::msgcat::mcset cs "Scale" "Škála" ::msgcat::mcset cs "Orientation" "Orientace" ::msgcat::mcset cs "Portrait" "Portrét" ::msgcat::mcset cs "Landscape" "Krajina" ::msgcat::mcset cs "Output" "Výstup" } |
Changes to library/msgs/da.msg.
︙ | ︙ | |||
71 72 73 74 75 76 77 78 | ::msgcat::mcset da "extensions" ::msgcat::mcset da "green" "grøn" ::msgcat::mcset da "ignore" "ignorer" ::msgcat::mcset da "ok" ::msgcat::mcset da "red" "rød" ::msgcat::mcset da "retry" "gentag" ::msgcat::mcset da "yes" "ja" } | > > > > > > > > > > > > > > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | ::msgcat::mcset da "extensions" ::msgcat::mcset da "green" "grøn" ::msgcat::mcset da "ignore" "ignorer" ::msgcat::mcset da "ok" ::msgcat::mcset da "red" "rød" ::msgcat::mcset da "retry" "gentag" ::msgcat::mcset da "yes" "ja" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset da "Print" "Trykke" ::msgcat::mcset da "Printer" "Printer" ::msgcat::mcset da "Letter " "Brev" ::msgcat::mcset da "Legal " "Juridisk" ::msgcat::mcset da "A4" "A4" ::msgcat::mcset da "Grayscale" "Gråtoneskala" ::msgcat::mcset da "RGB" "Rgb" ::msgcat::mcset da "Options" "Indstillinger" ::msgcat::mcset da "Copies" "Kopier" ::msgcat::mcset da "Paper" "Papir" ::msgcat::mcset da "Scale" "Skalere" ::msgcat::mcset da "Orientation" "Orientering" ::msgcat::mcset da "Portrait" "Portræt" ::msgcat::mcset da "Landscape" "Landskab" ::msgcat::mcset da "Output" "Udskriv Publikation" } |
Changes to library/msgs/de.msg.
︙ | ︙ | |||
84 85 86 87 88 89 90 91 | ::msgcat::mcset de "extensions" "Erweiterungen" ::msgcat::mcset de "green" "grün" ::msgcat::mcset de "ignore" "ignorieren" ::msgcat::mcset de "ok" ::msgcat::mcset de "red" "rot" ::msgcat::mcset de "retry" "wiederholen" ::msgcat::mcset de "yes" "ja" } | > > > > > > > > > > > > > > > > > > | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | ::msgcat::mcset de "extensions" "Erweiterungen" ::msgcat::mcset de "green" "grün" ::msgcat::mcset de "ignore" "ignorieren" ::msgcat::mcset de "ok" ::msgcat::mcset de "red" "rot" ::msgcat::mcset de "retry" "wiederholen" ::msgcat::mcset de "yes" "ja" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset de "Print" "Drucken" ::msgcat::mcset de "Printer" "Drucker" ::msgcat::mcset de "Letter " "Brief" ::msgcat::mcset de "Legal " "Rechtlich" ::msgcat::mcset de "A4" "A4" ::msgcat::mcset de "Grayscale" "Graustufen" ::msgcat::mcset de "RGB" "Rgb" ::msgcat::mcset de "Options" "Optionen" ::msgcat::mcset de "Copies" "Kopien" ::msgcat::mcset de "Paper" "Papier" ::msgcat::mcset de "Scale" "Skala" ::msgcat::mcset de "Orientation" "Ausrichtung" ::msgcat::mcset de "Portrait" "Porträt" ::msgcat::mcset de "Landscape" "Landschaft" ::msgcat::mcset de "Output" "Ausgabe" } |
Changes to library/msgs/el.msg.
︙ | ︙ | |||
79 80 81 82 83 84 85 86 | ::msgcat::mcset el "extensions" "επεκτάσεις" ::msgcat::mcset el "green" "πράσινο" ::msgcat::mcset el "ignore" "αγνόηση" ::msgcat::mcset el "ok" "εντάξει" ::msgcat::mcset el "red" "κόκκινο" ::msgcat::mcset el "retry" "προσπάθησε ξανά" ::msgcat::mcset el "yes" "ναι" } | > > > > > > > > > > > > > > > > > > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | ::msgcat::mcset el "extensions" "επεκτάσεις" ::msgcat::mcset el "green" "πράσινο" ::msgcat::mcset el "ignore" "αγνόηση" ::msgcat::mcset el "ok" "εντάξει" ::msgcat::mcset el "red" "κόκκινο" ::msgcat::mcset el "retry" "προσπάθησε ξανά" ::msgcat::mcset el "yes" "ναι" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset el "Print" "Τυπώνω" ::msgcat::mcset el "Printer" "Εκτυπωτής" ::msgcat::mcset el "Letter " "Γράμμα" ::msgcat::mcset el "Legal " "Νομικός" ::msgcat::mcset el "A4" "Α4" ::msgcat::mcset el "Grayscale" "Κλίμακα Του Γκρι" ::msgcat::mcset el "RGB" "Rgb" ::msgcat::mcset el "Options" "Επιλογές" ::msgcat::mcset el "Copies" "Αντίγραφα" ::msgcat::mcset el "Paper" "Χαρτί" ::msgcat::mcset el "Scale" "Κλίμακα" ::msgcat::mcset el "Orientation" "Προσανατολισμός" ::msgcat::mcset el "Portrait" "Προσωπογραφία" ::msgcat::mcset el "Landscape" "Τοπίο" ::msgcat::mcset el "Output" "Έξοδος" } |
Changes to library/msgs/en.msg.
︙ | ︙ | |||
85 86 87 88 89 90 91 | ::msgcat::mcset en "green" ::msgcat::mcset en "ignore" ::msgcat::mcset en "ok" ::msgcat::mcset en "red" ::msgcat::mcset en "retry" ::msgcat::mcset en "yes" } | > > > > > > > > > > > > > > > > > > > | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | ::msgcat::mcset en "green" ::msgcat::mcset en "ignore" ::msgcat::mcset en "ok" ::msgcat::mcset en "red" ::msgcat::mcset en "retry" ::msgcat::mcset en "yes" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset en "Print" ::msgcat::mcset en "Printer" ::msgcat::mcset en "Letter " ::msgcat::mcset en "Legal " ::msgcat::mcset en "A4" ::msgcat::mcset en "Grayscale" ::msgcat::mcset en "RGB" ::msgcat::mcset en "Options" ::msgcat::mcset en "Copies" ::msgcat::mcset en "Paper" ::msgcat::mcset en "Scale" ::msgcat::mcset en "Orientation" ::msgcat::mcset en "Portrait" ::msgcat::mcset en "Landscape" ::msgcat::mcset en "Output" } |
Changes to library/msgs/eo.msg.
1 | namespace eval ::tk { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | namespace eval ::tk { ::msgcat::mcset eo "&Abort" "&Ĉesigu" ::msgcat::mcset eo "&About..." "Pri..." ::msgcat::mcset eo "All Files" "Ĉiuj dosieroj" ::msgcat::mcset eo "Application Error" "Aplikoeraro" ::msgcat::mcset eo "&Blue" "&Blua" ::msgcat::mcset eo "Cancel" "Rezignu" ::msgcat::mcset eo "&Cancel" "&Rezignu" ::msgcat::mcset eo "Cannot change to the directory \"%1\$s\".\nPermission denied." "Neeble ŝanĝi al dosierujo \"%1\$s\".\nVi ne rajtas tion." ::msgcat::mcset eo "Choose Directory" "Elektu Dosierujon" ::msgcat::mcset eo "Cl&ear" "&Vakigu" ::msgcat::mcset eo "&Clear Console" "&Vakigu konzolon" ::msgcat::mcset eo "Color" "Koloro" ::msgcat::mcset eo "Console" "Konzolo" ::msgcat::mcset eo "&Copy" "&Kopiu" ::msgcat::mcset eo "Cu&t" "&Eltondu" ::msgcat::mcset eo "&Delete" "&Forigu" ::msgcat::mcset eo "Details >>" "Detaloj >>" ::msgcat::mcset eo "Directory \"%1\$s\" does not exist." "La dosierujo \"%1\$s\" ne ekzistas." ::msgcat::mcset eo "&Directory:" "&Dosierujo:" ::msgcat::mcset eo "&Edit" "&Redaktu" ::msgcat::mcset eo "Error: %1\$s" "Eraro: %1\$s" ::msgcat::mcset eo "E&xit" "&Eliru" ::msgcat::mcset eo "&File" "&Dosiero" ::msgcat::mcset eo "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "La dosiero \"%1\$s\" jam ekzistas.\nĈu vi volas anstataŭigi la dosieron?" ::msgcat::mcset eo "File \"%1\$s\" already exists.\n\n" "La dosiero \"%1\$s\" jam ekzistas. \n\n" ::msgcat::mcset eo "File \"%1\$s\" does not exist." "La dosiero \"%1\$s\" ne ekzistas." ::msgcat::mcset eo "File &name:" "Dosiero&nomo:" ::msgcat::mcset eo "File &names:" "Dosiero&nomoj:" ::msgcat::mcset eo "Files of &type:" "Dosieroj de &Tipo:" ::msgcat::mcset eo "Fi&les:" "Do&sieroj:" ::msgcat::mcset eo "&Filter" "&Filtrilo" ::msgcat::mcset eo "Fil&ter:" "&Filtrilo:" ::msgcat::mcset eo "&Green" "&Verda" ::msgcat::mcset eo "&Help" "&Helpu" ::msgcat::mcset eo "Hi" "Saluton" ::msgcat::mcset eo "&Hide Console" "&Kaŝu konzolon" ::msgcat::mcset eo "&Ignore" "&Ignoru" ::msgcat::mcset eo "Invalid file name \"%1\$s\"." "Malvalida dosieronomo \"%1\$s\"." ::msgcat::mcset eo "Log Files" "Protokolaj dosieroj" ::msgcat::mcset eo "&No" "&Ne" ::msgcat::mcset eo "&OK" "&Bone" ::msgcat::mcset eo "OK" "Bone" ::msgcat::mcset eo "Ok" "Bone" ::msgcat::mcset eo "Open" "Malfermu" ::msgcat::mcset eo "&Open" "&Malfermu" ::msgcat::mcset eo "Open Multiple Files" "Malfermu plurajn dosierojn" ::msgcat::mcset eo "P&aste" "&Algluu" ::msgcat::mcset eo "&Quit" "&Forlasu" ::msgcat::mcset eo "&Red" "&Ruĝa" ::msgcat::mcset eo "Replace existing file?" "Ĉu anstataŭigi ekzistantan dosieron?" ::msgcat::mcset eo "&Retry" "&Reprovu" ::msgcat::mcset eo "&Save" "&Konservu" ::msgcat::mcset eo "Save As" "Konservu kiel" ::msgcat::mcset eo "Save To Log" "Konservu en protokolon" ::msgcat::mcset eo "Select Log File" "Elektu prokolodosieron" ::msgcat::mcset eo "Select a file to source" "Elektu dosieron por interpreti" ::msgcat::mcset eo "&Selection:" "&Elekto:" ::msgcat::mcset eo "Skip Messages" "transsaltu mesaĝojn" ::msgcat::mcset eo "&Source..." "&Fontoprogramo..." ::msgcat::mcset eo "Tcl Scripts" "Tcl-skriptoj" ::msgcat::mcset eo "Tcl for Windows" "Tcl por Vindozo" ::msgcat::mcset eo "Text Files" "Tekstodosieroj" ::msgcat::mcset eo "&Yes" "&Jes" ::msgcat::mcset eo "abort" "ĉesigu" ::msgcat::mcset eo "blue" "blua" ::msgcat::mcset eo "cancel" "rezignu" ::msgcat::mcset eo "extension" "kromprogramo" ::msgcat::mcset eo "extensions" "kromprogramoj" ::msgcat::mcset eo "green" "verda" ::msgcat::mcset eo "ignore" "ignoru" ::msgcat::mcset eo "red" "ruĝa" ::msgcat::mcset eo "retry" "reprovu" ::msgcat::mcset eo "yes" "jes" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset eo "Print" "Presi" ::msgcat::mcset eo "Printer" "Presilo" ::msgcat::mcset eo "Letter " "Letero" ::msgcat::mcset eo "Legal " "Laŭleĝa" ::msgcat::mcset eo "A4" "A4" ::msgcat::mcset eo "Grayscale" "Grizskalo" ::msgcat::mcset eo "RGB" "RGB" ::msgcat::mcset eo "Options" "Opcioj" ::msgcat::mcset eo "Copies" "Kopioj" ::msgcat::mcset eo "Paper" "Papero" ::msgcat::mcset eo "Scale" "Skalo" ::msgcat::mcset eo "Orientation" "Orientiĝo" ::msgcat::mcset eo "Portrait" "Portreto" ::msgcat::mcset eo "Landscape" "Pejzaĝo" ::msgcat::mcset eo "Output" "Eligo" } |
Changes to library/msgs/es.msg.
︙ | ︙ | |||
69 70 71 72 73 74 75 76 | ::msgcat::mcset es "extensions" "extensiones" ::msgcat::mcset es "green" "verde" ::msgcat::mcset es "ignore" "ignorar" ::msgcat::mcset es "ok" ::msgcat::mcset es "red" "rojo" ::msgcat::mcset es "retry" "reintentar" ::msgcat::mcset es "yes" "sí" } | > > > > > > > > > > > > > > > > > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | ::msgcat::mcset es "extensions" "extensiones" ::msgcat::mcset es "green" "verde" ::msgcat::mcset es "ignore" "ignorar" ::msgcat::mcset es "ok" ::msgcat::mcset es "red" "rojo" ::msgcat::mcset es "retry" "reintentar" ::msgcat::mcset es "yes" "sí" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset es "Print" "Imprimir" ::msgcat::mcset es "Printer" "Impresora" ::msgcat::mcset es "Letter" "Carta" ::msgcat::mcset es "Legal" "Legal" ::msgcat::mcset es "A4" "A4" ::msgcat::mcset es "Grayscale" "Escala De Grises" ::msgcat::mcset es "RGB" "Color" ::msgcat::mcset es "Options" "Opciones" ::msgcat::mcset es "Copies" "Copias" ::msgcat::mcset es "Paper" "Papel" ::msgcat::mcset es "Scale" "Escala" ::msgcat::mcset es "Orientation" "Orientación" ::msgcat::mcset es "Portrait" "Retrato" ::msgcat::mcset es "Landscape" "Paisaje" ::msgcat::mcset es "Output" "Salida" } |
Added library/msgs/fi.msg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | namespace eval ::tk { ::msgcat::mcset fi "AaBbYyZz01" "AaBbÄäÖö01" ::msgcat::mcset fi "&Abort" "&Keskeytä" ::msgcat::mcset fi "&About..." "&Tietoja..." ::msgcat::mcset fi "All Files" "Kaikki tiedostot" ::msgcat::mcset fi "&Apply" "Kä&ytä" ::msgcat::mcset fi "Application Error" "Ohjelmavirhe" ::msgcat::mcset fi "&Blue" "&Sininen" ::msgcat::mcset fi "Bold" "Lihavoitu" ::msgcat::mcset fi "Bold Italic" "Lihavoitu, kursivoitu" ::msgcat::mcset fi "Cancel" "Peruuta" ::msgcat::mcset fi "&Cancel" "&Peruuta" ::msgcat::mcset fi "Cannot change to the directory \"%1\$s\".\nPermission denied." "Ei voitu vaihtaa hakemistoon \"%1\$s\".\nLupa evätty." ::msgcat::mcset fi "Choose Directory" "Valitse hakemisto" ::msgcat::mcset fi "Cl&ear" "&Tyhjennä" ::msgcat::mcset fi "&Clear Console" "&Tyhjennä konsoli" ::msgcat::mcset fi "Color" "Väri" ::msgcat::mcset fi "Console" "Konsoli" ::msgcat::mcset fi "&Copy" "K&opioi" ::msgcat::mcset fi "Cu&t" "&Leikkaa" ::msgcat::mcset fi "&Decrease Font Size" "&Pienennä kirjasinkokoa" ::msgcat::mcset fi "&Delete" "&Poista" ::msgcat::mcset fi "Details >>" "Lisätiedot >>" ::msgcat::mcset fi "Directory \"%1\$s\" does not exist." "Hakemistoa \"%1\$s\" ei ole olemassa." ::msgcat::mcset fi "&Directory:" "&Hakemisto:" ::msgcat::mcset fi "&Edit" "&Muokkaa" ::msgcat::mcset fi "Effects" "Tehosteet" ::msgcat::mcset fi "Error: %1\$s" "Virhe: %1\$s" ::msgcat::mcset fi "E&xit" "&Lopeta" ::msgcat::mcset fi "&File" "&Tiedosto" ::msgcat::mcset fi "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Tiedosto \"%1\$s\" on jo olemassa.\nHaluatko korvata sen?" ::msgcat::mcset fi "File \"%1\$s\" already exists.\n\n" "Tiedosto \"%1\$s\" on jo olemassa.\n\n" ::msgcat::mcset fi "File \"%1\$s\" does not exist." "Tiedostoa \"%1\$s\" ei ole olemassa." ::msgcat::mcset fi "File &name:" "Tiedosto&nimi:" ::msgcat::mcset fi "File &names:" "Tiedosto&nimet:" ::msgcat::mcset fi "Files of &type:" "T&yyppi:" ::msgcat::mcset fi "Fi&les:" "Ti&edostot:" ::msgcat::mcset fi "&Filter" "&Suodata" ::msgcat::mcset fi "Fil&ter:" "Suo&data:" ::msgcat::mcset fi "Fit To Screen Width" "Sovita ruudun kokoon" ::msgcat::mcset fi "Font" "Kirjasin" ::msgcat::mcset fi "&Font..." "Kir&jasin..." ::msgcat::mcset fi "&Font:" "&Kirjasin:" ::msgcat::mcset fi "Font st&yle:" "Kirjasint&yyli:" ::msgcat::mcset fi "&Green" "&Vihreä" ::msgcat::mcset fi "Help" "Ohje" ::msgcat::mcset fi "&Help" "&Ohje" ::msgcat::mcset fi "Hi" "Hei" ::msgcat::mcset fi "&Hide Console" "P&iilota konsoli" ::msgcat::mcset fi "Hide Fonts" "Piilota kirjasimet" ::msgcat::mcset fi "&Ignore" "&Ohita" ::msgcat::mcset fi "&Increase Font Size" "&Suurenna kirjasinkokoa" ::msgcat::mcset fi "Invalid file name \"%1\$s\"." "Virheellinen tiedostonimi \"%1\$s\"." ::msgcat::mcset fi "Italic" "Kursivoitu" ::msgcat::mcset fi "Log Files" "Lokitiedostot" ::msgcat::mcset fi "&No" "&Ei" ::msgcat::mcset fi "&OK" ::msgcat::mcset fi "OK" ::msgcat::mcset fi "Ok" "OK" ::msgcat::mcset fi "Open" "Avaa" ::msgcat::mcset fi "&Open" "&Avaa" ::msgcat::mcset fi "Open Multiple Files" "Avaa monta tiedostoa" ::msgcat::mcset fi "P&aste" "L&iitä" ::msgcat::mcset fi "&Quit" "&Lopeta" ::msgcat::mcset fi "&Red" "&Punainen" ::msgcat::mcset fi "Regular" "Tavallinen" ::msgcat::mcset fi "Replace existing file?" "Korvataanko olemassaoleva tiedosto?" ::msgcat::mcset fi "&Retry" "&Yritä uudelleen" ::msgcat::mcset fi "Sample" "Malli" ::msgcat::mcset fi "&Save" "&Tallenna" ::msgcat::mcset fi "Save As" "Tallenna nimellä" ::msgcat::mcset fi "Save To Log" "Tallenna lokiin" ::msgcat::mcset fi "Select Log File" "Valitse lokitiedosto" ::msgcat::mcset fi "Select a file to source" "Valitse lähdetiedosto" ::msgcat::mcset fi "&Selection:" "&Valinta:" ::msgcat::mcset fi "Show Fonts" "Näytä kirjasimet" ::msgcat::mcset fi "Skip Messages" "Jätä viestit huomiotta" ::msgcat::mcset fi "&Size:" "K&oko:" ::msgcat::mcset fi "&Source..." "L&ähde..." ::msgcat::mcset fi "Stri&keout" "&Yliviivaa" ::msgcat::mcset fi "Tcl Scripts" "Tcl-skriptit" ::msgcat::mcset fi "Tcl for Windows" "Tcl Windowsille" ::msgcat::mcset fi "Text Files" "Tekstitiedostot" ::msgcat::mcset fi "&Underline" "&Alleviivaa" ::msgcat::mcset fi "Window" "Ikkuna" ::msgcat::mcset fi "&Yes" "&Kyllä" ::msgcat::mcset fi "abort" "keskeytä" ::msgcat::mcset fi "blue" "sininen" ::msgcat::mcset fi "cancel" "peruuta" ::msgcat::mcset fi "extension" "lisäosa" ::msgcat::mcset fi "extensions" "lisäosat" ::msgcat::mcset fi "green" "vihreä" ::msgcat::mcset fi "ignore" "ohita" ::msgcat::mcset fi "ok" ::msgcat::mcset fi "red" "punainen" ::msgcat::mcset fi "retry" "yritä uudelleen" ::msgcat::mcset fi "yes" "kyllä" ::msgcat::mcset fi "Print" "Tulosta" ::msgcat::mcset fi "Printer" "Tulostin" ::msgcat::mcset fi "Letter " "Letter" ::msgcat::mcset fi "Legal " "Legal" ::msgcat::mcset fi "A4" "A4" ::msgcat::mcset fi "Grayscale" "Harmaasävy" ::msgcat::mcset fi "RGB" "RGB" ::msgcat::mcset fi "Options" "Asetukset" ::msgcat::mcset fi "Copies" "Tulosteita" ::msgcat::mcset fi "Paper" "Paperikoko" ::msgcat::mcset fi "Scale" "Skaalaus" ::msgcat::mcset fi "Orientation" "Suunta" ::msgcat::mcset fi "Portrait" "Pysty" ::msgcat::mcset fi "Landscape" "Vaaka" ::msgcat::mcset fi "Output" "Tulos" } |
Changes to library/msgs/fr.msg.
︙ | ︙ | |||
65 66 67 68 69 70 71 72 | ::msgcat::mcset fr "extensions" ::msgcat::mcset fr "green" "vert" ::msgcat::mcset fr "ignore" "ignorer" ::msgcat::mcset fr "ok" ::msgcat::mcset fr "red" "rouge" ::msgcat::mcset fr "retry" "réessayer" ::msgcat::mcset fr "yes" "oui" } | > > > > > > > > > > > > > > > > > > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | ::msgcat::mcset fr "extensions" ::msgcat::mcset fr "green" "vert" ::msgcat::mcset fr "ignore" "ignorer" ::msgcat::mcset fr "ok" ::msgcat::mcset fr "red" "rouge" ::msgcat::mcset fr "retry" "réessayer" ::msgcat::mcset fr "yes" "oui" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset fr "Print" "Imprimer" ::msgcat::mcset fr "Printer" "Imprimante" ::msgcat::mcset fr "Letter " "Lettre" ::msgcat::mcset fr "Legal " "Légal" ::msgcat::mcset fr "A4" "A4" ::msgcat::mcset fr "Grayscale" "Niveaux de Gris" ::msgcat::mcset fr "RGB" "RVB" ::msgcat::mcset fr "Options" "Options" ::msgcat::mcset fr "Copies" "Nombre d'exemplaires" ::msgcat::mcset fr "Paper" "Papier" ::msgcat::mcset fr "Scale" "Échelle" ::msgcat::mcset fr "Orientation" "Orientation" ::msgcat::mcset fr "Portrait" "Portrait" ::msgcat::mcset fr "Landscape" "Paysage" ::msgcat::mcset fr "Output" "Sortie" } |
Changes to library/msgs/hu.msg.
︙ | ︙ | |||
71 72 73 74 75 76 77 78 | ::msgcat::mcset hu "extensions" "kiterjesztések" ::msgcat::mcset hu "green" "zöld" ::msgcat::mcset hu "ignore" "ignorer" ::msgcat::mcset hu "ok" ::msgcat::mcset hu "red" "vörös" ::msgcat::mcset hu "retry" "újra" ::msgcat::mcset hu "yes" "igen" } | > > > > > > > > > > > > > > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | ::msgcat::mcset hu "extensions" "kiterjesztések" ::msgcat::mcset hu "green" "zöld" ::msgcat::mcset hu "ignore" "ignorer" ::msgcat::mcset hu "ok" ::msgcat::mcset hu "red" "vörös" ::msgcat::mcset hu "retry" "újra" ::msgcat::mcset hu "yes" "igen" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset hu "Print" "Nyomtat" ::msgcat::mcset hu "Printer" "Nyomtató" ::msgcat::mcset hu "Letter " "Levél" ::msgcat::mcset hu "Legal " "Törvényes" ::msgcat::mcset hu "A4" "A4" ::msgcat::mcset hu "Grayscale" "Szürkeárnyalatos" ::msgcat::mcset hu "RGB" "Rgb" ::msgcat::mcset hu "Options" "Beállítások" ::msgcat::mcset hu "Copies" "Másolatok" ::msgcat::mcset hu "Paper" "Papír" ::msgcat::mcset hu "Scale" "Hangsor" ::msgcat::mcset hu "Orientation" "Tájékozódás" ::msgcat::mcset hu "Portrait" "Portré" ::msgcat::mcset hu "Landscape" "Táj" ::msgcat::mcset hu "Output" "Hozam" } |
Changes to library/msgs/it.msg.
︙ | ︙ | |||
66 67 68 69 70 71 72 73 | ::msgcat::mcset it "extensions" "estensioni" ::msgcat::mcset it "green" "verde" ::msgcat::mcset it "ignore" "ignora" ::msgcat::mcset it "ok" ::msgcat::mcset it "red" "rosso" ::msgcat::mcset it "retry" "riprova" ::msgcat::mcset it "yes" "sì" } | > > > > > > > > > > > > > > > > > > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | ::msgcat::mcset it "extensions" "estensioni" ::msgcat::mcset it "green" "verde" ::msgcat::mcset it "ignore" "ignora" ::msgcat::mcset it "ok" ::msgcat::mcset it "red" "rosso" ::msgcat::mcset it "retry" "riprova" ::msgcat::mcset it "yes" "sì" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset it "Print" "Stampare" ::msgcat::mcset it "Printer" "Stampante" ::msgcat::mcset it "Letter " "Lettera" ::msgcat::mcset it "Legal " "Legale" ::msgcat::mcset it "A4" "A4" ::msgcat::mcset it "Grayscale" "Scala Di Grigi" ::msgcat::mcset it "RGB" "Rgb" ::msgcat::mcset it "Options" "Opzioni" ::msgcat::mcset it "Copies" "Copie" ::msgcat::mcset it "Paper" "Carta" ::msgcat::mcset it "Scale" "Scala" ::msgcat::mcset it "Orientation" "Orientamento" ::msgcat::mcset it "Portrait" "Ritratto" ::msgcat::mcset it "Landscape" "Paesaggio" ::msgcat::mcset it "Output" "Prodotto" } |
Changes to library/msgs/nl.msg.
︙ | ︙ | |||
84 85 86 87 88 89 90 91 | ::msgcat::mcset nl "extensions" ::msgcat::mcset nl "green" "groen" ::msgcat::mcset nl "ignore" "negeren" ::msgcat::mcset nl "ok" ::msgcat::mcset nl "red" "rood" ::msgcat::mcset nl "retry" "opnieuw" ::msgcat::mcset nl "yes" "ja" } | > > > > > > > > > > > > > > > > > > | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | ::msgcat::mcset nl "extensions" ::msgcat::mcset nl "green" "groen" ::msgcat::mcset nl "ignore" "negeren" ::msgcat::mcset nl "ok" ::msgcat::mcset nl "red" "rood" ::msgcat::mcset nl "retry" "opnieuw" ::msgcat::mcset nl "yes" "ja" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset nl "Print" "Afdrukken" ::msgcat::mcset nl "Printer" "Printer" ::msgcat::mcset nl "Letter " "Brief" ::msgcat::mcset nl "Legal " "Legaal" ::msgcat::mcset nl "A4" "A4" ::msgcat::mcset nl "Grayscale" "Grijswaarden" ::msgcat::mcset nl "RGB" "Rgb" ::msgcat::mcset nl "Options" "Opties" ::msgcat::mcset nl "Copies" "Kopieën" ::msgcat::mcset nl "Paper" "Papier" ::msgcat::mcset nl "Scale" "Schub" ::msgcat::mcset nl "Orientation" "Oriëntatie" ::msgcat::mcset nl "Portrait" "Portret" ::msgcat::mcset nl "Landscape" "Landschap" ::msgcat::mcset nl "Output" "Uitvoer" } |
Changes to library/msgs/pl.msg.
︙ | ︙ | |||
84 85 86 87 88 89 90 91 | ::msgcat::mcset pl "extensions" "rozszerzenia" ::msgcat::mcset pl "green" "zielony" ::msgcat::mcset pl "ignore" "ignoruj" ::msgcat::mcset pl "ok" ::msgcat::mcset pl "red" "czerwony" ::msgcat::mcset pl "retry" "ponów" ::msgcat::mcset pl "yes" "tak" } | > > > > > > > > > > > > > > > > > > | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | ::msgcat::mcset pl "extensions" "rozszerzenia" ::msgcat::mcset pl "green" "zielony" ::msgcat::mcset pl "ignore" "ignoruj" ::msgcat::mcset pl "ok" ::msgcat::mcset pl "red" "czerwony" ::msgcat::mcset pl "retry" "ponów" ::msgcat::mcset pl "yes" "tak" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset pl "Print" "Drukować" ::msgcat::mcset pl "Printer" "Drukarka" ::msgcat::mcset pl "Letter " "Litera" ::msgcat::mcset pl "Legal " "Legalny" ::msgcat::mcset pl "A4" "A4" ::msgcat::mcset pl "Grayscale" "Skala Szarości" ::msgcat::mcset pl "RGB" "Rgb" ::msgcat::mcset pl "Options" "Opcje" ::msgcat::mcset pl "Copies" "Kopie" ::msgcat::mcset pl "Paper" "Papier" ::msgcat::mcset pl "Scale" "Skala" ::msgcat::mcset pl "Orientation" "Orientacja" ::msgcat::mcset pl "Portrait" "Portret" ::msgcat::mcset pl "Landscape" "Krajobraz" ::msgcat::mcset pl "Output" "Produkt Wyjściowy" } |
Changes to library/msgs/pt.msg.
︙ | ︙ | |||
67 68 69 70 71 72 73 74 | ::msgcat::mcset pt "extensions" "extensões" ::msgcat::mcset pt "green" "verde" ::msgcat::mcset pt "ignore" "ignorar" ::msgcat::mcset pt "ok" ::msgcat::mcset pt "red" "vermelho" ::msgcat::mcset pt "retry" "tentar novamente" ::msgcat::mcset pt "yes" "sim" } | > > > > > > > > > > > > > > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | ::msgcat::mcset pt "extensions" "extensões" ::msgcat::mcset pt "green" "verde" ::msgcat::mcset pt "ignore" "ignorar" ::msgcat::mcset pt "ok" ::msgcat::mcset pt "red" "vermelho" ::msgcat::mcset pt "retry" "tentar novamente" ::msgcat::mcset pt "yes" "sim" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset pt "Print" "Imprimir" ::msgcat::mcset pt "Printer" "Impressora" ::msgcat::mcset pt "Letter " "Letra" ::msgcat::mcset pt "Legal " "Legal" ::msgcat::mcset pt "A4" "A4" ::msgcat::mcset pt "Grayscale" "Escala De Cinza" ::msgcat::mcset pt "RGB" "Rgb" ::msgcat::mcset pt "Options" "Opções" ::msgcat::mcset pt "Copies" "Exemplares" ::msgcat::mcset pt "Paper" "Papel" ::msgcat::mcset pt "Scale" "Escala" ::msgcat::mcset pt "Orientation" "Orientação" ::msgcat::mcset pt "Portrait" "Retrato" ::msgcat::mcset pt "Landscape" "Paisagem" ::msgcat::mcset pt "Output" "Saída" } |
Changes to library/msgs/ru.msg.
1 2 3 4 5 6 | namespace eval ::tk { ::msgcat::mcset ru "&Abort" "&Отменить" ::msgcat::mcset ru "&About..." "Про..." ::msgcat::mcset ru "All Files" "Все файлы" ::msgcat::mcset ru "Application Error" "Ошибка в программе" ::msgcat::mcset ru "&Blue" " &Голубой" | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | namespace eval ::tk { ::msgcat::mcset ru "&Abort" "&Отменить" ::msgcat::mcset ru "&About..." "Про..." ::msgcat::mcset ru "All Files" "Все файлы" ::msgcat::mcset ru "Application Error" "Ошибка в программе" ::msgcat::mcset ru "&Apply" "&Применить" ::msgcat::mcset ru "Bold" "Bold" ::msgcat::mcset ru "Bold Italic" "Bold Italic" ::msgcat::mcset ru "&Blue" " &Голубой" ::msgcat::mcset ru "Cancel" "Отмена" ::msgcat::mcset ru "&Cancel" "От&мена" ::msgcat::mcset ru "Cannot change to the directory \"%1\$s\".\nPermission denied." \ "Не могу перейти в каталог \"%1\$s\".\nНедостаточно прав доступа" ::msgcat::mcset ru "Choose Directory" "Выберите каталог" ::msgcat::mcset ru "Cl&ear" "Очистить" ::msgcat::mcset ru "&Clear Console" "&Clear Console" ::msgcat::mcset ru "Color" "Цвет" ::msgcat::mcset ru "Console" "Консоль" ::msgcat::mcset ru "&Copy" "Копировать" ::msgcat::mcset ru "Cu&t" "Вырезать" ::msgcat::mcset ru "&Delete" "Удалить" ::msgcat::mcset ru "Details >>" "Подробнее >>" ::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "Каталога \"%1\$s\" не существует." ::msgcat::mcset ru "&Directory:" "&Каталог:" ::msgcat::mcset ru "&Edit" "&Edit" ::msgcat::mcset ru "Effects" "Эффекты" ::msgcat::mcset ru "Error: %1\$s" "Ошибка: %1\$s" ::msgcat::mcset ru "E&xit" "Выход" ::msgcat::mcset ru "&File" "&File" ::msgcat::mcset ru "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \ "Файл \"%1\$s\" уже существует.\nЗаменить его?" ::msgcat::mcset ru "File \"%1\$s\" already exists.\n\n" "Файл \"%1\$s\" уже существует.\n\n" ::msgcat::mcset ru "File \"%1\$s\" does not exist." "Файл \"%1\$s\" не найден." ::msgcat::mcset ru "File &name:" "&Имя файла:" ::msgcat::mcset ru "File &names:" "&Имена файлов:" ::msgcat::mcset ru "Files of &type:" "&Тип файлов:" ::msgcat::mcset ru "Fi&les:" "Фай&лы:" ::msgcat::mcset ru "&Filter" "&Фильтр" ::msgcat::mcset ru "Fil&ter:" "Филь&тр:" ::msgcat::mcset ru "Font" "Шрифт" ::msgcat::mcset ru "&Font:" "&Шрифт" ::msgcat::mcset ru "Font st&yle:" "&Стиль шрифта:" ::msgcat::mcset ru "&Green" " &Зеленый" ::msgcat::mcset ru "&Help" "&Help" ::msgcat::mcset ru "Hi" "Привет" ::msgcat::mcset ru "&Hide Console" "Спрятать консоль" ::msgcat::mcset ru "&Ignore" "&Игнорировать" ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "Неверное имя файла \"%1\$s\"." ::msgcat::mcset ru "Italic" "Italic" ::msgcat::mcset ru "Log Files" "Файлы журнала" ::msgcat::mcset ru "&No" "&Нет" ::msgcat::mcset ru "&OK" "&ОК" ::msgcat::mcset ru "OK" "ОК" ::msgcat::mcset ru "Ok" "Да" ::msgcat::mcset ru "Open" "Открыть" ::msgcat::mcset ru "&Open" "&Открыть" ::msgcat::mcset ru "Open Multiple Files" "Открыть несколько файлов" ::msgcat::mcset ru "P&aste" "Вставить" ::msgcat::mcset ru "&Quit" "Выход" ::msgcat::mcset ru "&Red" " &Красный" ::msgcat::mcset ru "Replace existing file?" "Заменить существующий файл?" ::msgcat::mcset ru "Regular" "Regular" ::msgcat::mcset ru "&Retry" "&Повторить" ::msgcat::mcset ru "Sample" "Пример" ::msgcat::mcset ru "&Save" "&Сохранить" ::msgcat::mcset ru "Save As" "Сохранить как" ::msgcat::mcset ru "Save To Log" "Сохранить в журнал" ::msgcat::mcset ru "Select Log File" "Выбрать журнал" ::msgcat::mcset ru "Select a file to source" "Выберите файл для интерпретации" ::msgcat::mcset ru "&Selection:" ::msgcat::mcset ru "&Size:" "&Размер:" ::msgcat::mcset ru "Show &Hidden Directories" "Show &Hidden Directories" ::msgcat::mcset ru "Show &Hidden Files and Directories" "Show &Hidden Files and Directories" ::msgcat::mcset ru "Skip Messages" "Пропустить сообщения" ::msgcat::mcset ru "&Source..." "Интерпретировать файл..." ::msgcat::mcset ru "Stri&keout" "П&еречёркнутый" ::msgcat::mcset ru "Tcl Scripts" "Программа на языке TCL" ::msgcat::mcset ru "Tcl for Windows" "TCL для Windows" ::msgcat::mcset ru "Text Files" "Текстовые файлы" ::msgcat::mcset ru "&Underline" "По&дчеркнутый" ::msgcat::mcset ru "&Yes" "&Да" ::msgcat::mcset ru "abort" "отмена" ::msgcat::mcset ru "blue" " голубой" ::msgcat::mcset ru "cancel" "отмена" ::msgcat::mcset ru "extension" "расширение" ::msgcat::mcset ru "extensions" "расширения" ::msgcat::mcset ru "green" " зеленый" ::msgcat::mcset ru "ignore" "пропустить" ::msgcat::mcset ru "ok" "ок" ::msgcat::mcset ru "red" " красный" ::msgcat::mcset ru "retry" "повторить" ::msgcat::mcset ru "yes" "да" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset ru "Print" "Печатать" ::msgcat::mcset ru "Printer" "Принтер" ::msgcat::mcset ru "Letter " "Письмо" ::msgcat::mcset ru "Legal " "Законный" ::msgcat::mcset ru "A4" "A4" ::msgcat::mcset ru "Grayscale" "Серый Масштаб" ::msgcat::mcset ru "RGB" "Ргб" ::msgcat::mcset ru "Options" "Параметры" ::msgcat::mcset ru "Copies" "Копии" ::msgcat::mcset ru "Paper" "Бумага" ::msgcat::mcset ru "Scale" "Шкала" ::msgcat::mcset ru "Orientation" "Ориентация" ::msgcat::mcset ru "Portrait" "Портрет" ::msgcat::mcset ru "Landscape" "Ландшафт" ::msgcat::mcset ru "Output" "Выпуск" } |
Changes to library/msgs/sv.msg.
︙ | ︙ | |||
69 70 71 72 73 74 75 76 | ::msgcat::mcset sv "extensions" "utvidgningar" ::msgcat::mcset sv "green" "grön" ::msgcat::mcset sv "ignore" "ignorera" ::msgcat::mcset sv "ok" ::msgcat::mcset sv "red" "röd" ::msgcat::mcset sv "retry" "försök igen" ::msgcat::mcset sv "yes" "ja" } | > > > > > > > > > > > > > > > > > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | ::msgcat::mcset sv "extensions" "utvidgningar" ::msgcat::mcset sv "green" "grön" ::msgcat::mcset sv "ignore" "ignorera" ::msgcat::mcset sv "ok" ::msgcat::mcset sv "red" "röd" ::msgcat::mcset sv "retry" "försök igen" ::msgcat::mcset sv "yes" "ja" } #localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset sv "Print" "Trycka" ::msgcat::mcset sv "Printer" "Skrivare" ::msgcat::mcset sv "Letter " "Brev" ::msgcat::mcset sv "Legal " "Laglig" ::msgcat::mcset sv "A4" "A4 (På 199" ::msgcat::mcset sv "Grayscale" "Gråskala" ::msgcat::mcset sv "RGB" "Rgb" ::msgcat::mcset sv "Options" "Alternativ" ::msgcat::mcset sv "Copies" "Kopior" ::msgcat::mcset sv "Paper" "Papper" ::msgcat::mcset sv "Scale" "Skala" ::msgcat::mcset sv "Orientation" "Orientering" ::msgcat::mcset sv "Portrait" "Porträtt" ::msgcat::mcset sv "Landscape" "Landskap" ::msgcat::mcset sv "Output" "Utdata" } |
Added library/msgs/zh_cn.msg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | namespace eval ::tk { ::msgcat::mcset zh_cn "&Abort" "&中止" ::msgcat::mcset zh_cn "&About..." "&关于……" ::msgcat::mcset zh_cn "All Files" "所有文件" ::msgcat::mcset zh_cn "Application Error" "应用程序错误" ::msgcat::mcset zh_cn "&Apply" "&添加" ::msgcat::mcset zh_cn "Bold" "粗体" ::msgcat::mcset zh_cn "Bold Italic" "加粗斜体" ::msgcat::mcset zh_cn "&Blue" "&蓝色" ::msgcat::mcset zh_cn "Cancel" "取消" ::msgcat::mcset zh_cn "&Cancel" "&取消" ::msgcat::mcset zh_cn "Cannot change to the directory \"%1\$s\".\nPermission denied." "无法更改目录 \"%1\$s\"。\n访问被拒绝。" ::msgcat::mcset zh_cn "Choose Directory" "选择文件夹" ::msgcat::mcset zh_cn "Cl&ear" "清&除" ::msgcat::mcset zh_cn "&Clear Console" "&清除终端" ::msgcat::mcset zh_cn "Color" "颜色" ::msgcat::mcset zh_cn "Console" "终端" ::msgcat::mcset zh_cn "&Copy" "&复制" ::msgcat::mcset zh_cn "Cu&t" "剪&切" ::msgcat::mcset zh_cn "&Delete" "&删除" ::msgcat::mcset zh_cn "Details >>" "详细信息 >>" ::msgcat::mcset zh_cn "Directory \"%1\$s\" does not exist." "目录 \"%1\$s\" 不存在。" ::msgcat::mcset zh_cn "&Directory:" "&目录:" ::msgcat::mcset zh_cn "&Edit" "&编辑" ::msgcat::mcset zh_cn "Effects" "效果" ::msgcat::mcset zh_cn "Error: %1\$s" "错误: %1\$s" ::msgcat::mcset zh_cn "E&xit" "退&出" ::msgcat::mcset zh_cn "&File" "&文件" ::msgcat::mcset zh_cn "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "文件 \"%1\$s\" 已经存在。\n您想要覆盖它吗?" ::msgcat::mcset zh_cn "File \"%1\$s\" already exists.\n\n" "文件 \"%1\$s\" 已经存在。\n\n" ::msgcat::mcset zh_cn "File \"%1\$s\" does not exist." "文件 \"%1\$s\" 不存在。" ::msgcat::mcset zh_cn "File &name:" "文件&名:" ::msgcat::mcset zh_cn "File &names:" "文件&名:" ::msgcat::mcset zh_cn "Files of &type:" "文件&类型:" ::msgcat::mcset zh_cn "Fi&les:" "文&件:" ::msgcat::mcset zh_cn "&Filter" "&过滤" ::msgcat::mcset zh_cn "Fil&ter:" "过&滤:" ::msgcat::mcset zh_cn "Font" "字体" ::msgcat::mcset zh_cn "&Font:" "&字体:" ::msgcat::mcset zh_cn "Font st&yle:" "字体&样式:" ::msgcat::mcset zh_cn "&Green" "&绿色" ::msgcat::mcset zh_cn "&Help" "&帮助" ::msgcat::mcset zh_cn "Hi" "你好" ::msgcat::mcset zh_cn "&Hide Console" "&隐藏终端" ::msgcat::mcset zh_cn "&Ignore" "&忽略" ::msgcat::mcset zh_cn "Invalid file name \"%1\$s\"." "无效的文件名 \"%1\$s\"。" ::msgcat::mcset zh_cn "Italic" "斜体" ::msgcat::mcset zh_cn "Log Files" "日志文件" ::msgcat::mcset zh_cn "&No" "&取消" ::msgcat::mcset zh_cn "&OK" "&确定" ::msgcat::mcset zh_cn "OK" "确定" ::msgcat::mcset zh_cn "Ok" "确定" ::msgcat::mcset zh_cn "Open" "打开" ::msgcat::mcset zh_cn "&Open" "&打开" ::msgcat::mcset zh_cn "Open Multiple Files" "打开多个文件" ::msgcat::mcset zh_cn "P&aste" "粘&贴" ::msgcat::mcset zh_cn "&Quit" "&退出" ::msgcat::mcset zh_cn "&Red" "红色" ::msgcat::mcset zh_cn "Regular" "规则" ::msgcat::mcset zh_cn "Replace existing file?" "替换已有文件?" ::msgcat::mcset zh_cn "&Retry" "&重试" ::msgcat::mcset zh_cn "Sample" "样式" ::msgcat::mcset zh_cn "&Save" "&保存" ::msgcat::mcset zh_cn "Save As" "另存为" ::msgcat::mcset zh_cn "Save To Log" "保存到日志" ::msgcat::mcset zh_cn "Select Log File" "选择日志文件" ::msgcat::mcset zh_cn "Select a file to source" "选择一个源文件" ::msgcat::mcset zh_cn "&Selection:" "&选择:" ::msgcat::mcset zh_cn "&Size:" "&大小:" ::msgcat::mcset zh_cn "Show &Hidden Directories" "显示&隐藏目录" ::msgcat::mcset zh_cn "Show &Hidden Files and Directories" "显示&隐藏文件和目录" ::msgcat::mcset zh_cn "Skip Messages" "跳过信息" ::msgcat::mcset zh_cn "&Source..." "&来源……" ::msgcat::mcset zh_cn "Stri&keout" "删&除线" ::msgcat::mcset zh_cn "Tcl Scripts" "Tcl脚本" ::msgcat::mcset zh_cn "Tcl for Windows" "适用于Windows的Tcl" ::msgcat::mcset zh_cn "Text Files" "文本文档" ::msgcat::mcset zh_cn "&Underline" "&下划线" ::msgcat::mcset zh_cn "&Yes" "&确定" ::msgcat::mcset zh_cn "abort" "中止" ::msgcat::mcset zh_cn "blue" "蓝色" ::msgcat::mcset zh_cn "cancel" "取消" ::msgcat::mcset zh_cn "extension" "拓展" ::msgcat::mcset zh_cn "extensions" "拓展" ::msgcat::mcset zh_cn "green" "绿色" ::msgcat::mcset zh_cn "ignore" "忽略" ::msgcat::mcset zh_cn "ok" "确定" ::msgcat::mcset zh_cn "red" "红色" ::msgcat::mcset zh_cn "retry" "重试" ::msgcat::mcset zh_cn "yes" "确认" } #Kevin Walzer通过微软翻译对打印内容进行本地化 localization of print terms by Kevin Walzer via Microsoft Translator namespace eval ::tk { ::msgcat::mcset zh_cn "Print" "输出" ::msgcat::mcset zh_cn "Printer" "输出器" ::msgcat::mcset zh_cn "Letter " "信 " ::msgcat::mcset zh_cn "Legal " "合法的 " ::msgcat::mcset zh_cn "A4" "A4" ::msgcat::mcset zh_cn "Grayscale" "灰度" ::msgcat::mcset zh_cn "RGB" "RGB" ::msgcat::mcset zh_cn "Options" "设置" ::msgcat::mcset zh_cn "Copies" "复制" ::msgcat::mcset zh_cn "Paper" "纸" ::msgcat::mcset zh_cn "Scale" "规模" ::msgcat::mcset zh_cn "Orientation" "方向" ::msgcat::mcset zh_cn "Portrait" "竖向" ::msgcat::mcset zh_cn "Landscape" "横向" ::msgcat::mcset zh_cn "Output" "输出" } |
Changes to library/optMenu.tcl.
︙ | ︙ | |||
33 34 35 36 37 38 39 | } menubutton $w -textvariable $varName -indicatoron 1 -menu $w.menu \ -relief raised -highlightthickness 1 -anchor c \ -direction flush menu $w.menu -tearoff 0 $w.menu add radiobutton -label $firstValue -variable $varName foreach i $args { | | | 33 34 35 36 37 38 39 40 41 42 43 | } menubutton $w -textvariable $varName -indicatoron 1 -menu $w.menu \ -relief raised -highlightthickness 1 -anchor c \ -direction flush menu $w.menu -tearoff 0 $w.menu add radiobutton -label $firstValue -variable $varName foreach i $args { $w.menu add radiobutton -label $i -variable $varName } return $w.menu } |
Added library/print.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | # print.tcl -- # This file defines the 'tk print' command for printing of the canvas # widget and text on X11, Windows, and macOS. It implements an abstraction # layer that presents a consistent API across the three platforms. # Copyright © 2009 Michael I. Schwartz. # Copyright © 2021 Kevin Walzer/WordTech Communications LLC. # Copyright © 2021 Harald Oehlmann, Elmicron GmbH # Copyright © 2022 Emiliano Gavilan # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. namespace eval ::tk::print { namespace import -force ::tk::msgcat::* # makeTempFile: # Create a temporary file and populate its contents # Arguments: # filename - base of the name of the file to create # contents - what to put in the file; defaults to empty # Returns: # Full filename for created file # proc makeTempFile {filename {contents ""}} { set f [file tempfile filename $filename] try { puts -nonewline $f $contents return $filename } finally { close $f } } if {[tk windowingsystem] eq "win32"} { variable printer_name variable copies variable dpi_x variable dpi_y variable paper_width variable paper_height variable margin_left variable margin_top variable printargs array set printargs {} # Multiple utility procedures for printing text based on the # C printer primitives. # _set_dc: # Select printer and set device context and other parameters # for print job. # proc _set_dc {} { variable printargs variable printer_name variable paper_width variable paper_height variable dpi_x variable dpi_y variable copies #First, we select the printer. _selectprinter #Next, set values. Some are taken from the printer, #some are sane defaults. if {[info exists printer_name] && $printer_name ne ""} { set printargs(hDC) $printer_name set printargs(pw) $paper_width set printargs(pl) $paper_height set printargs(lm) 1000 set printargs(tm) 1000 set printargs(rm) 1000 set printargs(bm) 1000 set printargs(resx) $dpi_x set printargs(resy) $dpi_y set printargs(copies) $copies set printargs(resolution) [list $dpi_x $dpi_y] } } # _print_data # This function prints multiple-page files, using a line-oriented # function, taking advantage of knowing the character widths. # Arguments: # data - Text data for printing # breaklines - If non-zero, keep newlines in the string as # newlines in the output. # font - Font for printing proc _print_data {data {breaklines 1} {font ""}} { variable printargs variable printer_name _set_dc if {![info exists printer_name]} { return } if {$font eq ""} { _gdi characters $printargs(hDC) -array printcharwid } else { _gdi characters $printargs(hDC) -font $font -array printcharwid } set pagewid [expr {($printargs(pw) - $printargs(rm) ) / 1000 * $printargs(resx)}] set pagehgt [expr {($printargs(pl) - $printargs(bm) ) / 1000 * $printargs(resy)}] set totallen [string length $data] set curlen 0 set curhgt [expr {$printargs(tm) * $printargs(resy) / 1000}] _opendoc _openpage while {$curlen < $totallen} { set linestring [string range $data $curlen end] if {$breaklines} { set endind [string first "\n" $linestring] if {$endind >= 0} { set linestring [string range $linestring 0 $endind] # handle blank lines.... if {$linestring eq ""} { set linestring " " } } } set result [_print_page_nextline $linestring \ printcharwid printargs $curhgt $font] incr curlen [lindex $result 0] incr curhgt [lindex $result 1] if {$curhgt + [lindex $result 1] > $pagehgt} { _closepage _openpage set curhgt [expr {$printargs(tm) * $printargs(resy) / 1000}] } } _closepage _closedoc } # _print_file # This function prints multiple-page files # It will either break lines or just let them run over the # margins (and thus truncate). # The font argument is JUST the font name, not any additional # arguments. # Arguments: # filename - File to open for printing # breaklines - 1 to break lines as done on input, 0 to ignore newlines # font - Optional arguments to supply to the text command proc _print_file {filename {breaklines 1} {font ""}} { set fn [open $filename r] set data [read $fn] close $fn _print_data $data $breaklines $font } # _print_page_nextline # Returns the pair "chars y" # where chars is the number of characters printed on the line # and y is the height of the line printed # Arguments: # string - Data to print # pdata - Array of values for printer characteristics # cdata - Array of values for character widths # y - Y value to begin printing at # font - if non-empty specifies a font to draw the line in proc _print_page_nextline {string carray parray y font} { upvar #0 $carray charwidths upvar #0 $parray printargs variable printargs set endindex 0 set totwidth 0 set maxwidth [expr { (($printargs(pw) - $printargs(rm)) / 1000) * $printargs(resx) }] set maxstring [string length $string] set lm [expr {$printargs(lm) * $printargs(resx) / 1000}] for {set i 0} {($i < $maxstring) && ($totwidth < $maxwidth)} {incr i} { incr totwidth $charwidths([string index $string $i]) # set width($i) $totwidth } set endindex $i set startindex $endindex if {$i < $maxstring} { # In this case, the whole data string is not used up, and we # wish to break on a word. Since we have all the partial # widths calculated, this should be easy. set endindex [expr {[string wordstart $string $endindex] - 1}] set startindex [expr {$endindex + 1}] # If the line is just too long (no word breaks), print as much # as you can.... if {$endindex <= 1} { set endindex $i set startindex $i } } set txt [string trim [string range $string 0 $endindex] "\r\n"] if {$font ne ""} { set result [_gdi text $printargs(hDC) $lm $y \ -anchor nw -justify left \ -text $txt -font $font] } else { set result [_gdi text $printargs(hDC) $lm $y \ -anchor nw -justify left -text $txt] } return "$startindex $result" } # These procedures read in the canvas widget, and write all of # its contents out to the Windows printer. variable option variable vtgPrint proc _init_print_canvas {} { variable option variable vtgPrint variable printargs set vtgPrint(printer.bg) white } proc _is_win {} { variable printargs return [info exist tk_patchLevel] } # _print_widget # Main procedure for printing a widget. Currently supports # canvas widgets. Handles opening and closing of printer. # Arguments: # wid - The widget to be printed. # printer - Flag whether to use the default printer. # name - App name to pass to printer. proc _print_widget {wid {printer default} {name "Tk Print Output"}} { variable printargs variable printer_name _set_dc if {![info exists printer_name]} { return } _opendoc _openpage # Here is where any scaling/gdi mapping should take place # For now, scale so the dimensions of the window are sized to the # width of the page. Scale evenly. # For normal windows, this may be fine--but for a canvas, one # wants the canvas dimensions, and not the WINDOW dimensions. if {[winfo class $wid] eq "Canvas"} { set sc [$wid cget -scrollregion] # if there is no scrollregion, use width and height. if {$sc eq ""} { set window_x [$wid cget -width] set window_y [$wid cget -height] } else { set window_x [lindex $sc 2] set window_y [lindex $sc 3] } } else { set window_x [winfo width $wid] set window_y [winfo height $wid] } set printer_x [expr { ( $printargs(pw) - $printargs(lm) - $printargs(rm) ) * $printargs(resx) / 1000.0 }] set printer_y [expr { ( $printargs(pl) - $printargs(tm) - $printargs(bm) ) * $printargs(resy) / 1000.0 }] set factor_x [expr {$window_x / $printer_x}] set factor_y [expr {$window_y / $printer_y}] if {$factor_x < $factor_y} { set lo $window_y set ph $printer_y } else { set lo $window_x set ph $printer_x } _gdi map $printargs(hDC) -logical $lo -physical $ph \ -offset $printargs(resolution) # Handling of canvas widgets. switch [winfo class $wid] { Canvas { _print_canvas $printargs(hDC) $wid } default { puts "Can't print items of type [winfo class $wid]. No handler registered" } } # End printing process. _closepage _closedoc } # _print_canvas # Main procedure for writing canvas widget items to printer. # Arguments: # hdc - The printer handle. # cw - The canvas widget. proc _print_canvas {hdc cw} { variable vtgPrint variable printargs # Get information about page being printed to # print_canvas.CalcSizing $cw set vtgPrint(canvas.bg) [string tolower [$cw cget -background]] # Re-write each widget from cw to printer foreach id [$cw find all] { set type [$cw type $id] if {[info commands _print_canvas.$type] eq "_print_canvas.$type"} { _print_canvas.[$cw type $id] $printargs(hDC) $cw $id } else { puts "Omitting canvas item of type $type since there is no handler registered for it" } } } # These procedures support the various canvas item types, reading the # information about the item on the real canvas and then writing a # similar item to the printer. # _print_canvas.line # Description: # Prints a line item. # Arguments: # hdc - The printer handle. # cw - The canvas widget. # id - The id of the canvas item. proc _print_canvas.line {hdc cw id} { variable vtgPrint variable printargs set color [_print_canvas.TransColor [$cw itemcget $id -fill]] if {[string match $vtgPrint(printer.bg) $color]} { return } set coords [$cw coords $id] set wdth [$cw itemcget $id -width] set arrow [$cw itemcget $id -arrow] set arwshp [$cw itemcget $id -arrowshape] set dash [$cw itemcget $id -dash] set smooth [$cw itemcget $id -smooth] set splinesteps [$cw itemcget $id -splinesteps] set cmdargs {} if {$wdth > 1} { lappend cmdargs -width $wdth } if {$dash ne ""} { lappend cmdargs -dash $dash } if {$smooth ne ""} { lappend cmdargs -smooth $smooth } if {$splinesteps ne ""} { lappend cmdargs -splinesteps $splinesteps } set result [_gdi line $hdc {*}$coords \ -fill $color -arrow $arrow -arrowshape $arwshp \ {*}$cmdargs] if {$result ne ""} { puts $result } } # _print_canvas.arc # Prints a arc item. # Args: # hdc - The printer handle. # cw - The canvas widget. # id - The id of the canvas item. proc _print_canvas.arc {hdc cw id} { variable vtgPrint variable printargs set color [_print_canvas.TransColor [$cw itemcget $id -outline]] if {[string match $vtgPrint(printer.bg) $color]} { return } set coords [$cw coords $id] set wdth [$cw itemcget $id -width] set style [$cw itemcget $id -style] set start [$cw itemcget $id -start] set extent [$cw itemcget $id -extent] set fill [$cw itemcget $id -fill] set cmdargs {} if {$wdth > 1} { lappend cmdargs -width $wdth } if {$fill ne ""} { lappend cmdargs -fill $fill } _gdi arc $hdc {*}$coords \ -outline $color -style $style -start $start -extent $extent \ {*}$cmdargs } # _print_canvas.polygon # Prints a polygon item. # Arguments: # hdc - The printer handle. # cw - The canvas widget. # id - The id of the canvas item. proc _print_canvas.polygon {hdc cw id} { variable vtgPrint variable printargs set fcolor [_print_canvas.TransColor [$cw itemcget $id -fill]] if {$fcolor eq ""} { set fcolor $vtgPrint(printer.bg) } set ocolor [_print_canvas.TransColor [$cw itemcget $id -outline]] if {$ocolor eq ""} { set ocolor $vtgPrint(printer.bg) } set coords [$cw coords $id] set wdth [$cw itemcget $id -width] set smooth [$cw itemcget $id -smooth] set splinesteps [$cw itemcget $id -splinesteps] set cmdargs {} if {$smooth ne ""} { lappend cmdargs -smooth $smooth } if {$splinesteps ne ""} { lappend cmdargs -splinesteps $splinesteps } _gdi polygon $hdc {*}$coords \ -width $wdth -fill $fcolor -outline $ocolor {*}$cmdargs } # _print_canvas.oval # Prints an oval item. # Arguments: # hdc - The printer handle. # cw - The canvas widget. # id - The id of the canvas item. proc _print_canvas.oval {hdc cw id} { variable vtgPrint set fcolor [_print_canvas.TransColor [$cw itemcget $id -fill]] if {$fcolor eq ""} { set fcolor $vtgPrint(printer.bg) } set ocolor [_print_canvas.TransColor [$cw itemcget $id -outline]] if {$ocolor eq ""} { set ocolor $vtgPrint(printer.bg) } set coords [$cw coords $id] set wdth [$cw itemcget $id -width] _gdi oval $hdc {*}$coords \ -width $wdth -fill $fcolor -outline $ocolor } # _print_canvas.rectangle # Prints a rectangle item. # Arguments: # hdc - The printer handle. # cw - The canvas widget. # id - The id of the canvas item. proc _print_canvas.rectangle {hdc cw id} { variable vtgPrint set fcolor [_print_canvas.TransColor [$cw itemcget $id -fill]] if {$fcolor eq ""} { set fcolor $vtgPrint(printer.bg) } set ocolor [_print_canvas.TransColor [$cw itemcget $id -outline]] if {$ocolor eq ""} { set ocolor $vtgPrint(printer.bg) } set coords [$cw coords $id] set wdth [$cw itemcget $id -width] _gdi rectangle $hdc {*}$coords \ -width $wdth -fill $fcolor -outline $ocolor } # _print_canvas.text # Prints a text item. # Arguments: # hdc - The printer handle. # cw - The canvas widget. # id - The id of the canvas item. proc _print_canvas.text {hdc cw id} { variable vtgPrint variable printargs set color [_print_canvas.TransColor [$cw itemcget $id -fill]] # if {"white" eq [string tolower $color]} {return} # set color black set txt [$cw itemcget $id -text] if {$txt eq ""} { return } set coords [$cw coords $id] set anchr [$cw itemcget $id -anchor] set bbox [$cw bbox $id] set wdth [expr {[lindex $bbox 2] - [lindex $bbox 0]}] set just [$cw itemcget $id -justify] # Get the real canvas font info and create a compatible font, # suitable for printer name extraction. set font [font create {*}[font actual [$cw itemcget $id -font]]] # Just get the name and family, or some of the _gdi commands will # fail. set font [list [font configure $font -family] \ -[font configure $font -size]] _gdi text $hdc {*}$coords \ -fill $color -text $txt -font $font \ -anchor $anchr -width $wdth -justify $just } # _print_canvas.image # Prints an image item. # Arguments: # hdc - The printer handle. # cw - The canvas widget. # id - The id of the canvas item. proc _print_canvas.image {hdc cw id} { # First, we have to get the image name. set imagename [$cw itemcget $id -image] # Now we get the size. set wid [image width $imagename] set hgt [image height $imagename] # Next, we get the location and anchor set anchor [$cw itemcget $id -anchor] set coords [$cw coords $id] _gdi photo $hdc -destination $coords -photo $imagename } # _print_canvas.bitmap # Prints a bitmap item. # Arguments: # hdc - The printer handle. # cw - The canvas widget. # id - The id of the canvas item. proc _print_canvas.bitmap {hdc cw id} { variable option variable vtgPrint # First, we have to get the bitmap name. set imagename [$cw itemcget $id -image] # Now we get the size. set wid [image width $imagename] set hgt [image height $imagename] #Next, we get the location and anchor. set anchor [$cw itemcget $id -anchor] set coords [$cw coords $id] # Since the GDI commands don't yet support images and bitmaps, # and since this represents a rendered bitmap, we CAN use # copybits IF we create a new temporary toplevel to hold the beast. # If this is too ugly, change the option! if {[info exist option(use_copybits)]} { set firstcase $option(use_copybits) } else { set firstcase 0 } if {$firstcase > 0} { set tl [toplevel .tmptop[expr {int( rand() * 65535 )}] \ -height $hgt -width $wid \ -background $vtgPrint(canvas.bg)] canvas $tl.canvas -width $wid -height $hgt $tl.canvas create image 0 0 -image $imagename -anchor nw pack $tl.canvas -side left -expand false -fill none tkwait visibility $tl.canvas update set srccoords [list 0 0 [expr {$wid - 1}] [expr {$hgt - 1}]] set dstcoords [list [lindex $coords 0] [lindex $coords 1] [expr {$wid - 1}] [expr {$hgt - 1}]] _gdi copybits $hdc -window $tl -client \ -source $srccoords -destination $dstcoords destroy $tl } else { _gdi bitmap $hdc {*}$coords \ -anchor $anchor -bitmap $imagename } } # These procedures transform attribute setting from the real # canvas to the appropriate setting for printing to paper. # _print_canvas.TransColor # Does the actual transformation of colors from the # canvas widget to paper. # Arguments: # color - The color value to be transformed. proc _print_canvas.TransColor {color} { variable vtgPrint variable printargs switch [string toupper $color] { $vtgPrint(canvas.bg) {return $vtgPrint(printer.bg)} } return $color } # Initialize all the variables once. _init_print_canvas } #end win32 procedures #begin X11 procedures # X11 procedures wrap standard Unix shell commands such as lp/lpr and # lpstat for printing. Some output configuration that on other platforms # is managed through the printer driver/dialog is configured through the # canvas postscript command. if {[tk windowingsystem] eq "x11"} { variable printcmd {} # print options variable optlist set optlist(printer) {} set optlist(paper) [list [mc "Letter"] [mc "Legal"] [mc "A4"]] set optlist(orient) [list [mc "Portrait"] [mc "Landscape"]] set optlist(color) [list [mc "Grayscale"] [mc "RGB"]] set optlist(zoom) {100 90 80 70 60 50 40 30 20 10} # selected options variable sel array set sel { printer {} copies {} paper {} orient {} color {} zoom {} } # default values for dialog widgets option add *Printdialog*TLabel.anchor e option add *Printdialog*TMenubutton.Menu.tearOff 0 option add *Printdialog*TMenubutton.width 12 option add *Printdialog*TSpinbox.width 12 # this is tempting to add, but it's better to leave it to user's taste # option add *Printdialog*Menu.background snow # returns the full qualified var name proc myvar {varname} { set fqvar [uplevel 1 [list namespace which -variable $varname]] # assert var existence if {$fqvar eq ""} { return -code error "Wrong varname \"$varname\"" } return $fqvar } # ttk version of [tk_optionMenu] # var should be a full qualified varname proc ttk_optionMenu {w var args} { ttk::menubutton $w \ -textvariable $var \ -menu $w.menu menu $w.menu foreach option $args { $w.menu add command \ -label $option \ -command [list set $var $option] } # return the same value as tk_optionMenu return $w.menu } # _setprintenv # Set the print environtment - print command, and list of printers. # Arguments: # none. proc _setprintenv {} { variable printcmd variable optlist #Test for existence of lpstat command to obtain list of printers. Return error #if not found. catch {exec lpstat -a} msg set notfound "command not found" if {[string first $notfound $msg] >= 0} { error "Unable to obtain list of printers. Please install the CUPS package \ for your system." return } set notfound "No destinations added" if {[string first $notfound $msg] != -1} { error "Please check or update your CUPS installation." return } # Select print command. We prefer lpr, but will fall back to lp if # necessary. if {[auto_execok lpr] ne ""} { set printcmd lpr } else { set printcmd lp } #Build list of printers set printers {} set printdata [exec lpstat -a] foreach item [split $printdata \n] { lappend printers [lindex [split $item] 0] } # filter out duplicates set optlist(printer) [lsort -unique $printers] } # _print # Main printer dialog. Select printer, set options, and # fire print command. # Arguments: # w - widget with contents to print. # proc _print {w} { # TODO: revise padding variable optlist variable sel # should this be called with every invocaton? _setprintenv if {$sel(printer) eq "" && [llength $optlist(printer)] > 0} { set sel(printer) [lindex $optlist(printer) 0] } set p ._print catch {destroy $p} # copy the current values to a dialog's temorary variable # this allow us to cancel the dialog discarding any changes # made to the options namespace eval dlg {variable sel} array set dlg::sel [array get sel] # The toplevel of our dialog toplevel $p -class Printdialog place [ttk::frame $p.background] -x 0 -y 0 -relwidth 1.0 -relheight 1.0 wm title $p [mc "Print"] wm resizable $p 0 0 wm attributes $p -type dialog # The printer to use set pf [ttk::frame $p.printerf] pack $pf -side top -fill x -expand no -padx 12 -pady 12 ttk::label $pf.printerl -text "[mc "Printer"] :" ttk::combobox $pf.printer \ -textvariable [myvar dlg::sel](printer) \ -state readonly \ -values $optlist(printer) pack $pf.printerl -side left -padx {0 6} pack $pf.printer -side left # Start of printing options set of [ttk::labelframe $p.optionsframe -text [mc "Options"]] pack $of -fill x -padx 12 -pady {0 12} -ipadx 3 -ipady 3 # COPIES ttk::label $of.copiesl -text "[mc "Copies"] :" ttk::spinbox $of.copies -from 1 -to 1000 \ -textvariable [myvar dlg::sel](copies) \ -width 5 grid $of.copiesl $of.copies -sticky ew -padx 3 -pady 3 # PAPER SIZE ttk::label $of.paperl -text "[mc "Paper"] :" ttk_optionMenu $of.paper [myvar dlg::sel](paper) {*}$optlist(paper) grid $of.paperl $of.paper -sticky ew -padx 3 -pady 3 # additional options for canvas output if {[winfo class $w] eq "Canvas"} { # SCALE ttk::label $of.percentl -text "[mc "Scale"] :" ttk_optionMenu $of.percent [myvar dlg::sel](zoom) {*}$optlist(zoom) grid $of.percentl $of.percent -sticky ew -padx 3 -pady 3 # ORIENT ttk::label $of.orientl -text "[mc "Orientation"] :" ttk_optionMenu $of.orient [myvar dlg::sel](orient) {*}$optlist(orient) grid $of.orientl $of.orient -sticky ew -padx 3 -pady 3 # COLOR ttk::label $of.colorl -text "[mc "Output"] :" ttk_optionMenu $of.color [myvar dlg::sel](color) {*}$optlist(color) grid $of.colorl $of.color -sticky ew -padx 3 -pady 3 } # The buttons frame. set bf [ttk::frame $p.buttonf] pack $bf -fill x -expand no -side bottom -padx 12 -pady {0 12} ttk::button $bf.print -text [mc "Print"] \ -command [namespace code [list _runprint $w $p]] ttk::button $bf.cancel -text [mc "Cancel"] \ -command [namespace code [list _cancel $p]] pack $bf.print -side right pack $bf.cancel -side right -padx {0 6} #Center the window as a dialog. ::tk::PlaceWindow $p } proc _cancel {p} { namespace delete dlg destroy $p } # _runprint - # Execute the print command--print the file. # Arguments: # w - widget with contents to print. # proc _runprint {w p} { variable printcmd variable sel # copy the values back from the dialog array set sel [array get dlg::sel] namespace delete dlg #First, generate print file. if {[winfo class $w] eq "Text"} { set file [makeTempFile tk_text.txt [$w get 1.0 end]] } if {[winfo class $w] eq "Canvas"} { if {$sel(color) eq [mc "RGB"]} { set colormode color } else { set colormode gray } if {$sel(orient) eq [mc "Landscape"]} { set willrotate "1" } else { set willrotate "0" } #Scale based on size of widget, not size of paper. set printwidth [expr {$sel(zoom) / 100.00 * [winfo width $w]}] set file [makeTempFile tk_canvas.ps] $w postscript -file $file -colormode $colormode \ -rotate $willrotate -pagewidth $printwidth } #Build list of args to pass to print command. set printargs {} if {$printcmd eq "lpr"} { lappend printargs -P $sel(printer) -# $sel(copies) } else { lappend printargs -d $sel(printer) -n $sel(copies) } # launch the job in the background after 0 [list exec $printcmd {*}$printargs -o PageSize=$sel(paper) $file] destroy $p } # Initialize with sane defaults. set sel(copies) 1 set sel(paper) [mc "A4"] set sel(orient) [mc "Portrait"] set sel(color) [mc "RGB"] set sel(zoom) 100 } #end X11 procedures #begin macOS Aqua procedures if {[tk windowingsystem] eq "aqua"} { # makePDF - # Convert a file to PDF # Arguments: # inFilename - file containing the data to convert; format is # autodetected. # outFilename - base for filename to write to; conventionally should # have .pdf as suffix # Returns: # The full pathname of the generated PDF. # proc makePDF {inFilename outFilename} { set out [::tk::print::makeTempFile $outFilename] try { exec /usr/sbin/cupsfilter $inFilename > $out } trap NONE {msg} { # cupsfilter produces a lot of debugging output, which we # don't want. regsub -all -line {^(?:DEBUG|INFO):.*$} $msg "" msg set msg [string trimleft [regsub -all {\n+} $msg "\n"] "\n"] if {$msg ne ""} { # Lines should be prefixed with WARN or ERROR now puts $msg } } return $out } } #end macOS Aqua procedures namespace export canvas text namespace ensemble create } # tk print -- # This procedure prints the canvas and text widgets using platform- # native API's. # Arguments: # w: Widget to print. proc ::tk::print {w} { switch [winfo class $w],[tk windowingsystem] { "Canvas,win32" { tailcall ::tk::print::_print_widget $w 0 "Tk Print Output" } "Canvas,x11" { tailcall ::tk::print::_print $w } "Canvas,aqua" { set psfile [::tk::print::makeTempFile tk_canvas.ps] try { $w postscript -file $psfile set printfile [::tk::print::makePDF $psfile tk_canvas.pdf] ::tk::print::_print $printfile } finally { file delete $psfile } } "Text,win32" { tailcall ::tk::print::_print_data [$w get 1.0 end] 1 {Arial 12} } "Text,x11" { tailcall ::tk::print::_print $w } "Text,aqua" { set txtfile [::tk::print::makeTempFile tk_text.txt [$w get 1.0 end]] try { set printfile [::tk::print::makePDF $txtfile tk_text.pdf] ::tk::print::_print $printfile } finally { file delete $txtfile } } default { return -code error -errorcode {TK PRINT CLASS_UNSUPPORTED} \ "widgets of class [winfo class $w] are not supported on\ this platform" } } } #Add this command to the tk command ensemble: tk print #Thanks to Christian Gollwitzer for the guidance here namespace ensemble configure tk -map \ [dict merge [namespace ensemble configure tk -map] \ {print ::tk::print}] return # Local Variables: # mode: tcl # fill-column: 78 # End: |
Changes to library/scale.tcl.
︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | # repeat - Whether and how to auto-repeat the action: "noRepeat" # means don't auto-repeat, "initial" means this is the # first action in an auto-repeat sequence, and "again" # means this is the second repetition or later. proc ::tk::ScaleIncrement {w dir big repeat} { variable ::tk::Priv if {![winfo exists $w]} return if {$big eq "big"} { set inc [$w cget -bigincrement] if {$inc == 0} { set inc [expr {abs([$w cget -to] - [$w cget -from])/10.0}] } if {$inc < [$w cget -resolution]} { set inc [$w cget -resolution] } } else { set inc [$w cget -resolution] } if {([$w cget -from] > [$w cget -to]) ^ ($dir eq "up")} { if {$inc > 0} { set inc [expr {-$inc}] } } else { if {$inc < 0} { set inc [expr {-$inc}] } } $w set [expr {[$w get] + $inc}] if {$repeat eq "again"} { set Priv(afterId) [after [$w cget -repeatinterval] \ [list tk::ScaleIncrement $w $dir $big again]] } elseif {$repeat eq "initial"} { set delay [$w cget -repeatdelay] if {$delay > 0} { set Priv(afterId) [after $delay \ [list tk::ScaleIncrement $w $dir $big again]] } } } # ::tk::ScaleControlPress -- | > > > > > > > > > > > > > > > > > | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | # repeat - Whether and how to auto-repeat the action: "noRepeat" # means don't auto-repeat, "initial" means this is the # first action in an auto-repeat sequence, and "again" # means this is the second repetition or later. proc ::tk::ScaleIncrement {w dir big repeat} { variable ::tk::Priv if {![winfo exists $w]} return # give the cancel callback a chance to be serviced if the execution time of # the -command script lasts longer than -repeatdelay set clockms [clock milliseconds] if {$repeat eq "again" && [expr {$clockms - $Priv(clockms)}] > [expr {[$w cget -repeatinterval] * 1.1}]} { set Priv(clockms) $clockms set Priv(afterId) [after [$w cget -repeatinterval] \ [list tk::ScaleIncrement $w $dir $big again]] return } if {$big eq "big"} { set inc [$w cget -bigincrement] if {$inc == 0} { set inc [expr {abs([$w cget -to] - [$w cget -from])/10.0}] } if {$inc < [$w cget -resolution]} { set inc [$w cget -resolution] } } else { set inc [$w cget -resolution] } if {([$w cget -from] > [$w cget -to]) ^ ($dir eq "up")} { if {$inc > 0} { set inc [expr {-$inc}] } } else { if {$inc < 0} { set inc [expr {-$inc}] } } # this will run the -command script (if any) during the redrawing # of the scale at idle time $w set [expr {[$w get] + $inc}] if {$repeat eq "again"} { set Priv(clockms) $clockms set Priv(afterId) [after [$w cget -repeatinterval] \ [list tk::ScaleIncrement $w $dir $big again]] } elseif {$repeat eq "initial"} { set delay [$w cget -repeatdelay] if {$delay > 0} { set Priv(clockms) $clockms set Priv(afterId) [after $delay \ [list tk::ScaleIncrement $w $dir $big again]] } } } # ::tk::ScaleControlPress -- |
︙ | ︙ |
Changes to library/scrlbar.tcl.
︙ | ︙ | |||
126 127 128 129 130 131 132 | } bind Scrollbar <<LineEnd>> { tk::ScrollToPos %W 1 } } bind Scrollbar <MouseWheel> { | | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | } bind Scrollbar <<LineEnd>> { tk::ScrollToPos %W 1 } } bind Scrollbar <MouseWheel> { tk::ScrollByUnits %W hv %D -40.0 } bind Scrollbar <Option-MouseWheel> { tk::ScrollByUnits %W hv %D -12.0 } # tk::ScrollButtonDown -- # This procedure is invoked when a button is pressed in a scrollbar. # It changes the way the scrollbar is displayed and takes actions # depending on where the mouse is. # |
︙ | ︙ |
Changes to library/spinbox.tcl.
︙ | ︙ | |||
125 126 127 128 129 130 131 | %W invoke buttonup } bind Spinbox <<NextLine>> { %W invoke buttondown } bind Spinbox <<PrevChar>> { | | | | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | %W invoke buttonup } bind Spinbox <<NextLine>> { %W invoke buttondown } bind Spinbox <<PrevChar>> { ::tk::EntrySetCursor %W [tk::EntryPreviousChar %W insert] } bind Spinbox <<NextChar>> { ::tk::EntrySetCursor %W [tk::EntryNextChar %W insert] } bind Spinbox <<SelectPrevChar>> { ::tk::EntryKeySelect %W [tk::EntryPreviousChar %W insert] ::tk::EntrySeeInsert %W } bind Spinbox <<SelectNextChar>> { ::tk::EntryKeySelect %W [tk::EntryNextChar %W insert] ::tk::EntrySeeInsert %W } bind Spinbox <<PrevWord>> { ::tk::EntrySetCursor %W [::tk::EntryPreviousWord %W insert] } bind Spinbox <<NextWord>> { ::tk::EntrySetCursor %W [::tk::EntryNextWord %W insert] |
︙ | ︙ | |||
171 172 173 174 175 176 177 | ::tk::EntrySeeInsert %W } bind Spinbox <Delete> { if {[%W selection present]} { %W delete sel.first sel.last } else { | | > | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | ::tk::EntrySeeInsert %W } bind Spinbox <Delete> { if {[%W selection present]} { %W delete sel.first sel.last } else { %W delete [tk::startOfCluster [%W get] [%W index insert]] \ [tk::endOfGlyphCluster [%W get] [%W index insert]] } } bind Spinbox <BackSpace> { ::tk::EntryBackspace %W } bind Spinbox <Control-space> { |
︙ | ︙ | |||
200 201 202 203 204 205 206 | bind Spinbox <<SelectNone>> { %W selection clear } bind Spinbox <Key> { ::tk::EntryInsert %W %A } | | < | < > | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | bind Spinbox <<SelectNone>> { %W selection clear } bind Spinbox <Key> { ::tk::EntryInsert %W %A } # Ignore all Alt, Meta, Control, Command, and Fn keypresses unless explicitly bound. # Otherwise, if a widget binding for one of these is defined, the # <Key> class binding will also fire and insert the character, # which is wrong. Ditto for Escape, Return, and Tab. bind Spinbox <Alt-Key> {# nothing} bind Spinbox <Meta-Key> {# nothing} bind Spinbox <Control-Key> {# nothing} bind Spinbox <Escape> {# nothing} bind Spinbox <Return> {# nothing} bind Spinbox <KP_Enter> {# nothing} bind Spinbox <Tab> {# nothing} bind Spinbox <Prior> {# nothing} bind Spinbox <Next> {# nothing} bind Spinbox <Command-Key> {# nothing} bind Spinbox <Fn-Key> {# nothing} # On Windows, paste is done using Shift-Insert. Shift-Insert already # generates the <<Paste>> event, so we don't need to do anything here. if {[tk windowingsystem] ne "win32"} { bind Spinbox <Insert> { catch {::tk::EntryInsert %W [::tk::GetSelection %W PRIMARY]} } |
︙ | ︙ | |||
465 466 467 468 469 470 471 | } else { $w selection clear } } } word { if {$cur < [$w index anchor]} { | | | | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | } else { $w selection clear } } } word { if {$cur < [$w index anchor]} { set before [tk::wordBreakBefore [$w get] $cur] set after [tk::wordBreakAfter [$w get] $anchor-1] } else { set before [tk::wordBreakBefore [$w get] $anchor] set after [tk::wordBreakAfter [$w get] $cur-1] } if {$before < 0} { set before 0 } if {$after < 0} { set after end } |
︙ | ︙ |
Added library/systray.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | # systray.tcl -- # This file defines the 'tk systray' command for icon display and manipulation # in the system tray on X11, Windows, and macOS, and the 'tk sysnotify' command # for system alerts on each platform. It implements an abstraction layer that # presents a consistent API across the three platforms. # Copyright © 2020 Kevin Walzer/WordTech Communications LLC. # Copyright © 2020 Eric Boudaillier. # Copyright © 2020 Francois Vogel. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # Pure-Tcl system tooltip window for use with system tray icon if native # implementation not available. namespace eval ::tk::systray { variable _created 0 variable _options {-image "" -text "" -button1 "" -button3 ""} variable _current {} variable _ico proc _balloon {w help} { bind $w <Any-Enter> "after 100 [list [namespace current]::_balloon_show %W [list $help] cursor]" bind $w <Any-Leave> "destroy %W._balloon" } proc _balloon_show {w msg i} { if {![winfo exists $w]} { return } # Use string match to allow that the help will be shown when # the pointer is in any child of the desired widget if {([winfo class $w] ne "Menu") && ![string match $w* [eval [list winfo containing] \ [winfo pointerxy $w]]]} { return } set top $w._balloon catch {destroy $top} toplevel $top -bg black -bd 1 wm overrideredirect $top 1 if {[tk windowingsystem] eq "aqua"} { ::tk::unsupported::MacWindowStyle style $top help none } pack [message $top._txt -aspect 10000 -text $msg] update idletasks set screenw [winfo screenwidth $w] set screenh [winfo screenheight $w] set reqw [winfo reqwidth $top] set reqh [winfo reqheight $top] # When adjusting for being on the screen boundary, check that we are # near the "edge" already, as Tk handles multiple monitors oddly if {$i eq "cursor"} { set y [expr {[winfo pointery $w]+20}] if {($y < $screenh) && ($y+$reqh) > $screenh} { set y [expr {[winfo pointery $w]-$reqh-5}] } } elseif {$i ne ""} { set y [expr {[winfo rooty $w]+[winfo vrooty $w]+[$w yposition $i]+25}] if {($y < $screenh) && ($y+$reqh) > $screenh} { # show above if we would be offscreen set y [expr {[winfo rooty $w]+[$w yposition $i]-$reqh-5}] } } else { set y [expr {[winfo rooty $w]+[winfo vrooty $w]+[winfo height $w]+5}] if {($y < $screenh) && ($y+$reqh) > $screenh} { # show above if we would be offscreen set y [expr {[winfo rooty $w]-$reqh-5}] } } if {$i eq "cursor"} { set x [winfo pointerx $w] } else { set x [expr {[winfo rootx $w]+[winfo vrootx $w]+ ([winfo width $w]-$reqw)/2}] } # only readjust when we would appear right on the screen edge if {$x<0 && ($x+$reqw)>0} { set x 0 } elseif {($x < $screenw) && ($x+$reqw) > $screenw} { set x [expr {$screenw-$reqw}] } if {[tk windowingsystem] eq "aqua"} { set focus [focus] } wm geometry $top +$x+$y wm deiconify $top raise $top if {[tk windowingsystem] eq "aqua" && $focus ne ""} { # Aqua's help window steals focus on display after idle [list focus -force $focus] } } proc _win_callback {msg} { variable _current # The API at the Tk level does not feature bindings to double clicks. Whatever # the speed the user clicks with, he expects the single click binding to fire. # Therefore we need to bind to both WM_*BUTTONDOWN and to WM_*BUTTONDBLCLK. switch -exact -- $msg { WM_LBUTTONDOWN - WM_LBUTTONDBLCLK { uplevel #0 [dict get $_current -button1] } WM_RBUTTONDOWN - WM_RBUTTONDBLCLK { uplevel #0 [dict get $_current -button3] } } } namespace export create configure destroy namespace ensemble create } # Pure-Tcl system notification window for use if native implementation not available. namespace eval ::tk::sysnotify:: { proc _notifywindow {title msg} { catch {destroy ._notify} set w [toplevel ._notify] if {[tk windowingsystem] eq "aqua"} { ::tk::unsupported::MacWindowStyle style $w utility {hud closeBox resizable} wm title $w "Alert" } if {[tk windowingsystem] eq "win32"} { wm attributes $w -toolwindow true wm title $w "Alert" } label $w.l -bg gray30 -fg white -image ::tk::icons::information pack $w.l -fill both -expand yes -side left message $w.message -aspect 150 -bg gray30 -fg white -aspect 150 -text $title\n\n$msg -width 280 pack $w.message -side right -fill both -expand yes if {[tk windowingsystem] eq "x11"} { wm overrideredirect $w true } wm attributes $w -alpha 0.0 set xpos [expr {[winfo screenwidth $w] - 325}] wm geometry $w +$xpos+30 ::tk::sysnotify::_fade_in $w after 3000 ::tk::sysnotify::_fade_out $w } #Fade and destroy window. proc _fade_out {w} { catch { set prev_degree [wm attributes $w -alpha] set new_degree [expr {$prev_degree - 0.05}] set current_degree [wm attributes $w -alpha $new_degree] if {$new_degree > 0.0 && $new_degree != $prev_degree} { after 10 [list ::tk::sysnotify::_fade_out $w] } else { destroy $w } } } #Fade the window into view. proc _fade_in {w} { catch { raise $w wm attributes $w -topmost 1 set prev_degree [wm attributes $w -alpha] set new_degree [expr {$prev_degree + 0.05}] set current_degree [wm attributes $w -alpha $new_degree] focus -force $w if {$new_degree < 0.9 && $new_degree != $prev_degree} { after 10 [list ::tk::sysnotify::_fade_in $w] } } } namespace export * } # tk systray -- # This procedure creates an icon display in the platform-specific system tray. # # Subcommands: # # create - create systray icon. # Arguments: # -image - Tk image to display. # -text - string to display in tooltip over image. # -button1 - Tcl proc to invoke on <Button-1> event. # -button3 - Tcl proc to invoke on <Button-3> event. # # configure - change one of the systray properties. # Arguments (Any or all can be called): # -image - Tk image to update. # -text - string to update. # -button1 - Tcl proc to change for <Button-1> event. # -button3 - Tcl proc to change for <Button-3> event. # # destroy - destroy systray icon. # Arguments: # none. proc ::tk::systray::create {args} { variable _created variable _options variable _current variable _ico if {$_created} { return -code error -errorcode {TK SYSTRAY CREATE} "only one system tray icon supported per interpeter" } _check_options $args 0 if {![dict exists $args -image]} { return -code error -errorcode {TK SYSTRAY CREATE} "missing required option \"-image\"" } set values [dict merge $_options $args] try { switch -- [tk windowingsystem] { "win32" { set _ico [_systray add -image [dict get $values -image] \ -text [dict get $values -text] \ -callback [list ::tk::systray::_win_callback %m]] } "x11" { _systray ._tray -image [dict get $values -image] -visible true _balloon ._tray [dict get $values -text] bind ._tray <Button-1> [dict get $values -button1] bind ._tray <Button-3> [dict get $values -button3] } "aqua" { _systray create [dict get $values -image] [dict get $values -text] \ [dict get $values -button1] [dict get $values -button3] } } } on ok {} { set _current $values set _created 1 return } on error {msg opts} { return -code error -errorcode [dict get $opts -errorcode] $msg } } # Modify the systray icon. proc ::tk::systray::configure {args} { variable _created variable _options variable _current variable _ico if {!$_created} { return -code error -errorcode {TK SYSTRAY CREATE} "systray not created" } _check_options $args 1 if {[llength $args] == 0} { return $_current } elseif {[llength $args] == 1} { return [dict get $_current [lindex $args 0]] } set values [dict merge $_current $args] try { switch -- [tk windowingsystem] { "win32" { if {[dict exists $args -image]} { _systray modify $_ico -image [dict get $args -image] } if {[dict exists $args -text]} { _systray modify $_ico -text [dict get $args -text] } } "x11" { if {[dict exists $args -image]} { ._tray configure -image [dict get $args -image] } if {[dict exists $args -text]} { _balloon ._tray [dict get $args -text] } if {[dict exists $args -button1]} { bind ._tray <Button-1> [dict get $args -button1] } if {[dict exists $args -button3]} { bind ._tray <Button-3> [dict get $args -button3] } } "aqua" { foreach {key opt} {image -image text \ -text b1_callback -button1 b3_callback -button3} { if {[dict exists $args $opt]} { _systray modify $key [dict get $args $opt] } } } } } on ok {} { set _current $values return } on error {msg opts} { return -code error -errorcode [dict get $opts -errorcode] $msg } } # Remove the systray icon. proc ::tk::systray::destroy {} { variable _created variable _current variable _ico if {!$_created} { return -code error -errorcode {TK SYSTRAY DESTROY} "systray not created" } switch -- [tk windowingsystem] { "win32" { _systray delete $_ico set _ico "" } "x11" { ::destroy ._tray } "aqua" { _systray destroy } } set _created 0 set _current {} return } # Check systray options proc ::tk::systray::_check_options {argsList singleOk} { variable _options set len [llength $argsList] while {[llength $argsList] > 0} { set opt [lindex $argsList 0] if {![dict exists $_options $opt]} { tailcall return -code error -errorcode {TK SYSTRAY OPTION} \ "unknown option \"$opt\": must be -image, -text, -button1 or -button3" } if {[llength $argsList] == 1 && !($len == 1 && $singleOk)} { tailcall return -code error -errorcode {TK SYSTRAY OPTION} \ "missing value for option \"$opt\"" } set argsList [lrange $argsList 2 end] } } # tk sysnotify -- # This procedure implements a platform-specific system notification alert. # # Arguments: # title - main text of alert. # message - body text of alert. proc ::tk::sysnotify::sysnotify {title message} { switch -- [tk windowingsystem] { "win32" { if {!$::tk::systray::_created} { error "must create a system tray icon with the \"tk systray\" command first" } _sysnotify notify $::tk::systray::_ico $title $message } "x11" { if {[info commands ::tk::sysnotify::_sysnotify] eq ""} { _notifywindow $title $message } else { _sysnotify $title $message } } "aqua" { _sysnotify $title $message } } return } #Add these commands to the tk command ensemble: tk systray, tk sysnotify #Thanks to Christian Gollwitzer for the guidance here namespace ensemble configure tk -map \ [dict merge [namespace ensemble configure tk -map] \ {systray ::tk::systray sysnotify ::tk::sysnotify::sysnotify}] |
Changes to library/tearoff.tcl.
︙ | ︙ | |||
27 28 29 30 31 32 33 | # the parent of the new menu. This guarantees that the torn off # menu will be on the same screen as the original menu. By making # it a child of the ancestor, rather than a child of the menu, it # can continue to live even if the menu is deleted; it will go # away when the toplevel goes away. if {$x == 0} { | | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # the parent of the new menu. This guarantees that the torn off # menu will be on the same screen as the original menu. By making # it a child of the ancestor, rather than a child of the menu, it # can continue to live even if the menu is deleted; it will go # away when the toplevel goes away. if {$x == 0} { set x [winfo rootx $w] } if {$y == 0} { set y [winfo rooty $w] if {[tk windowingsystem] eq "aqua"} { # Shift by height of tearoff entry minus height of window titlebar catch {incr y [expr {[$w yposition 1] - 16}]} # Avoid the native menu bar which sits on top of everything. if {$y < 22} {set y 22} } } |
︙ | ︙ | |||
62 63 64 65 66 67 68 | # Pick a title for the new menu by looking at the parent of the # original: if the parent is a menu, then use the text of the active # entry. If it's a menubutton then use its text. set parent [winfo parent $w] if {[$menu cget -title] ne ""} { | | | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # Pick a title for the new menu by looking at the parent of the # original: if the parent is a menu, then use the text of the active # entry. If it's a menubutton then use its text. set parent [winfo parent $w] if {[$menu cget -title] ne ""} { wm title $menu [$menu cget -title] } else { switch -- [winfo class $parent] { Menubutton { wm title $menu [$parent cget -text] } Menu { wm title $menu [$parent entrycget active -label] } } } if {[tk windowingsystem] eq "win32"} { # [Bug 3181181]: Find the toplevel window for the menu set parent [winfo toplevel $parent] |
︙ | ︙ | |||
131 132 133 134 135 136 137 | if {[lindex $option 0] eq "-type"} { continue } lappend cmd [lindex $option 0] [lindex $option 4] } eval $cmd set last [$src index last] | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | if {[lindex $option 0] eq "-type"} { continue } lappend cmd [lindex $option 0] [lindex $option 4] } eval $cmd set last [$src index last] if {$last < 0} { return } for {set i [$src cget -tearoff]} {$i <= $last} {incr i} { set cmd [list $dst add [$src type $i]] foreach option [$src entryconfigure $i] { lappend cmd [lindex $option 0] [lindex $option 4] } |
︙ | ︙ |
Changes to library/text.tcl.
1 2 3 4 5 6 7 | # text.tcl -- # # This file defines the default bindings for Tk text widgets and provides # procedures that help in implementing the bindings. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # text.tcl -- # # This file defines the default bindings for Tk text widgets and provides # procedures that help in implementing the bindings. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998 Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # #------------------------------------------------------------------------- # Elements of ::tk::Priv that are used in this file: |
︙ | ︙ | |||
95 96 97 98 99 100 101 | } } # stop an accidental double click triggering <Double-Button-1> bind Text <Double-Control-Button-1> { # nothing } # stop an accidental movement triggering <B1-Motion> bind Text <Control-B1-Motion> { # nothing } bind Text <<PrevChar>> { | | | | | | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | } } # stop an accidental double click triggering <Double-Button-1> bind Text <Double-Control-Button-1> { # nothing } # stop an accidental movement triggering <B1-Motion> bind Text <Control-B1-Motion> { # nothing } bind Text <<PrevChar>> { tk::TextSetCursor %W [tk::TextPrevPos %W insert tk::startOfCluster] } bind Text <<NextChar>> { tk::TextSetCursor %W [tk::TextNextPos %W insert tk::endOfCluster] } bind Text <<PrevLine>> { tk::TextSetCursor %W [tk::TextUpDownLine %W -1] } bind Text <<NextLine>> { tk::TextSetCursor %W [tk::TextUpDownLine %W 1] } bind Text <<SelectPrevChar>> { tk::TextKeySelect %W [tk::TextPrevPos %W insert tk::startOfCluster] } bind Text <<SelectNextChar>> { tk::TextKeySelect %W [tk::TextNextPos %W insert tk::endOfCluster] } bind Text <<SelectPrevLine>> { tk::TextKeySelect %W [tk::TextUpDownLine %W -1] } bind Text <<SelectNextLine>> { tk::TextKeySelect %W [tk::TextUpDownLine %W 1] } bind Text <<PrevWord>> { tk::TextSetCursor %W [tk::TextPrevPos %W insert tk::startOfPreviousWord] } bind Text <<NextWord>> { tk::TextSetCursor %W [tk::TextNextWord %W insert] } bind Text <<PrevPara>> { tk::TextSetCursor %W [tk::TextPrevPara %W insert] } bind Text <<NextPara>> { tk::TextSetCursor %W [tk::TextNextPara %W insert] } bind Text <<SelectPrevWord>> { tk::TextKeySelect %W [tk::TextPrevPos %W insert tk::startOfPreviousWord] } bind Text <<SelectNextWord>> { tk::TextKeySelect %W [tk::TextNextWord %W insert] } bind Text <<SelectPrevPara>> { tk::TextKeySelect %W [tk::TextPrevPara %W insert] } |
︙ | ︙ | |||
218 219 220 221 222 223 224 | } } bind Text <Delete> { if {[tk::TextCursorInSelection %W]} { %W delete sel.first sel.last } else { if {[%W compare end != insert+1c]} { | | > | > | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | } } bind Text <Delete> { if {[tk::TextCursorInSelection %W]} { %W delete sel.first sel.last } else { if {[%W compare end != insert+1c]} { %W delete [tk::TextPrevPos %W insert+1c tk::startOfCluster] \ [tk::TextNextPos %W insert tk::endOfCluster] } %W see insert } } bind Text <BackSpace> { if {[tk::TextCursorInSelection %W]} { %W delete sel.first sel.last } else { if {[%W compare insert != 1.0]} { %W delete [tk::TextPrevPos %W insert tk::startOfCluster] \ [tk::TextNextPos %W insert-1c tk::endOfCluster] } %W see insert } } bind Text <Control-space> { %W mark set [tk::TextAnchor %W] insert |
︙ | ︙ | |||
292 293 294 295 296 297 298 | bind Text <Insert> { catch {tk::TextInsert %W [::tk::GetSelection %W PRIMARY]} } bind Text <Key> { tk::TextInsert %W %A } | | < | < > | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | bind Text <Insert> { catch {tk::TextInsert %W [::tk::GetSelection %W PRIMARY]} } bind Text <Key> { tk::TextInsert %W %A } # Ignore all Alt, Meta, Control, Command, and Fn keypresses unless explicitly bound. # Otherwise, if a widget binding for one of these is defined, the # <Key> class binding will also fire and insert the character, # which is wrong. Ditto for <Escape>. bind Text <Alt-Key> {# nothing } bind Text <Meta-Key> {# nothing} bind Text <Control-Key> {# nothing} bind Text <Escape> {# nothing} bind Text <KP_Enter> {# nothing} bind Text <Command-Key> {# nothing} bind Text <Fn-Key> {# nothing} # Additional emacs-like bindings: bind Text <Control-d> { if {!$tk_strictMotif && [%W compare end != insert+1c]} { %W delete insert } |
︙ | ︙ | |||
353 354 355 356 357 358 359 | bind Text <<Redo>> { catch { %W edit redo } } bind Text <Meta-b> { if {!$tk_strictMotif} { | | | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | bind Text <<Redo>> { catch { %W edit redo } } bind Text <Meta-b> { if {!$tk_strictMotif} { tk::TextSetCursor %W [tk::TextPrevPos %W insert tk::startOfPreviousWord] } } bind Text <Meta-d> { if {!$tk_strictMotif && [%W compare end != insert+1c]} { %W delete insert [tk::TextNextWord %W insert] } } |
︙ | ︙ | |||
378 379 380 381 382 383 384 | bind Text <Meta-greater> { if {!$tk_strictMotif} { tk::TextSetCursor %W end-1c } } bind Text <Meta-BackSpace> { if {!$tk_strictMotif} { | | | < < < | < < > > > > > > > > > > > > > > > > > > > | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | bind Text <Meta-greater> { if {!$tk_strictMotif} { tk::TextSetCursor %W end-1c } } bind Text <Meta-BackSpace> { if {!$tk_strictMotif} { %W delete [tk::TextPrevPos %W insert tk::startOfPreviousWord] insert } } bind Text <Meta-Delete> { if {!$tk_strictMotif} { %W delete [tk::TextPrevPos %W insert tk::startOfPreviousWord] insert } } # Bindings for IME text input. bind Text <<TkStartIMEMarkedText>> { dict set ::tk::Priv(IMETextMark) "%W" [%W index insert] } bind Text <<TkEndIMEMarkedText>> { ::tk::TextEndIMEMarkedText %W } bind Text <<TkClearIMEMarkedText>> { %W delete IMEmarkedtext.first IMEmarkedtext.last } bind Text <<TkAccentBackspace>> { %W delete insert-1c } # ::tk::TextEndIMEMarkedText -- # # Handles input method text marking in a text widget. # # Arguments: # w - The text widget proc ::tk::TextEndIMEMarkedText {w} { variable Priv if {[catch { set mark [dict get $Priv(IMETextMark) $w] }]} { bell return } $w tag add IMEmarkedtext $mark insert $w tag configure IMEmarkedtext -underline on } # Macintosh only bindings: if {[tk windowingsystem] eq "aqua"} { bind Text <Control-v> { tk::TextScrollPages %W 1 } |
︙ | ︙ | |||
438 439 440 441 442 443 444 | if {!$tk_strictMotif} { tk::TextScanDrag %W %x %y } } set ::tk::Priv(prevPos) {} bind Text <MouseWheel> { | | | | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | if {!$tk_strictMotif} { tk::TextScanDrag %W %x %y } } set ::tk::Priv(prevPos) {} bind Text <MouseWheel> { tk::MouseWheel %W y %D -4.0 pixels } bind Text <Option-MouseWheel> { tk::MouseWheel %W y %D -1.2 pixels } bind Text <Shift-MouseWheel> { tk::MouseWheel %W x %D -4.0 pixels } bind Text <Shift-Option-MouseWheel> { tk::MouseWheel %W x %D -1.2 pixels } # ::tk::TextClosestGap -- # Given x and y coordinates, this procedure finds the closest boundary # between characters to the given coordinates and returns the index # of the character just after the boundary. # |
︙ | ︙ | |||
571 572 573 574 575 576 577 | if {[$w compare $cur < $first]} { set first $cur } elseif {[$w compare $cur > $last]} { set last $cur } # Now find word boundaries | | | | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | if {[$w compare $cur < $first]} { set first $cur } elseif {[$w compare $cur > $last]} { set last $cur } # Now find word boundaries set first [TextPrevPos $w "$first + 1c" tk::wordBreakBefore] set last [TextNextPos $w "$last - 1c" tk::wordBreakAfter] } line { # Set initial range based only on the anchor set first "$anchorname linestart" set last "$anchorname lineend" # Extend range (if necessary) based on the current point |
︙ | ︙ | |||
1065 1066 1067 1068 1069 1070 1071 | # # Arguments: # w - The text window in which the cursor is to move. # start - Position at which to start search. if {[tk windowingsystem] eq "win32"} { proc ::tk::TextNextWord {w start} { | | | | | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | # # Arguments: # w - The text window in which the cursor is to move. # start - Position at which to start search. if {[tk windowingsystem] eq "win32"} { proc ::tk::TextNextWord {w start} { TextNextPos $w [TextNextPos $w $start tk::endOfWord] \ tk::startOfNextWord } } else { proc ::tk::TextNextWord {w start} { TextNextPos $w $start tk::endOfWord } } # ::tk::TextNextPos -- # Returns the index of the next position after the given starting # position in the text as computed by a specified function. # |
︙ | ︙ |
Changes to library/tk.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # tk.tcl -- # # Initialization script normally executed in the interpreter for each Tk-based # application. Arranges class bindings for widgets. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-2000 Ajuba Solutions. # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # Verify that we have Tk binary and script components from the same release | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # tk.tcl -- # # Initialization script normally executed in the interpreter for each Tk-based # application. Arranges class bindings for widgets. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-2000 Ajuba Solutions. # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # Verify that we have Tk binary and script components from the same release package require -exact tk 8.7a6 # Create a ::tk namespace namespace eval ::tk { # Set up the msgcat commands namespace eval msgcat { namespace export mc mcmax if {[interp issafe] || [catch {package require msgcat}]} { |
︙ | ︙ | |||
375 376 377 378 379 380 381 | event add <<Copy>> <Control-c> <F16> <Control-Lock-C> event add <<Paste>> <Control-v> <F18> <Control-Lock-V> event add <<Undo>> <Control-z> <Control-Lock-Z> event add <<Redo>> <Control-Z> <Control-Lock-z> # On Darwin/Aqua, buttons from left to right are 1,3,2. On Darwin/X11 with recent # XQuartz as the X server, they are 1,2,3; other X servers may differ. | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | event add <<Copy>> <Control-c> <F16> <Control-Lock-C> event add <<Paste>> <Control-v> <F18> <Control-Lock-V> event add <<Undo>> <Control-z> <Control-Lock-Z> event add <<Redo>> <Control-Z> <Control-Lock-z> # On Darwin/Aqua, buttons from left to right are 1,3,2. On Darwin/X11 with recent # XQuartz as the X server, they are 1,2,3; other X servers may differ. event add <<SelectAll>> <Control-/> event add <<SelectNone>> <Control-backslash> event add <<NextChar>> <Right> event add <<SelectNextChar>> <Shift-Right> event add <<PrevChar>> <Left> event add <<SelectPrevChar>> <Shift-Left> event add <<NextWord>> <Control-Right> event add <<SelectNextWord>> <Control-Shift-Right> |
︙ | ︙ | |||
422 423 424 425 426 427 428 | "win32" { event add <<Cut>> <Control-x> <Shift-Delete> <Control-Lock-X> event add <<Copy>> <Control-c> <Control-Insert> <Control-Lock-C> event add <<Paste>> <Control-v> <Shift-Insert> <Control-Lock-V> event add <<Undo>> <Control-z> <Control-Lock-Z> event add <<Redo>> <Control-y> <Control-Lock-Y> | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | "win32" { event add <<Cut>> <Control-x> <Shift-Delete> <Control-Lock-X> event add <<Copy>> <Control-c> <Control-Insert> <Control-Lock-C> event add <<Paste>> <Control-v> <Shift-Insert> <Control-Lock-V> event add <<Undo>> <Control-z> <Control-Lock-Z> event add <<Redo>> <Control-y> <Control-Lock-Y> event add <<SelectAll>> <Control-/> <Control-a> <Control-Lock-A> event add <<SelectNone>> <Control-backslash> event add <<NextChar>> <Right> event add <<SelectNextChar>> <Shift-Right> event add <<PrevChar>> <Left> event add <<SelectPrevChar>> <Shift-Left> event add <<NextWord>> <Control-Right> event add <<SelectNextWord>> <Control-Shift-Right> |
︙ | ︙ | |||
453 454 455 456 457 458 459 | "aqua" { event add <<Cut>> <Command-x> <F2> <Command-Lock-X> event add <<Copy>> <Command-c> <F3> <Command-Lock-C> event add <<Paste>> <Command-v> <F4> <Command-Lock-V> event add <<Clear>> <Clear> # Official bindings | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | "aqua" { event add <<Cut>> <Command-x> <F2> <Command-Lock-X> event add <<Copy>> <Command-c> <F3> <Command-Lock-C> event add <<Paste>> <Command-v> <F4> <Command-Lock-V> event add <<Clear>> <Clear> # Official bindings # See https://support.apple.com/en-us/HT201236 event add <<SelectAll>> <Command-a> event add <<Undo>> <Command-Key-z> <Command-Lock-Key-Z> event add <<Redo>> <Shift-Command-Key-z> <Shift-Command-Lock-Key-z> event add <<NextChar>> <Right> <Control-Key-f> <Control-Lock-Key-F> event add <<SelectNextChar>> <Shift-Right> <Shift-Control-Key-F> <Shift-Control-Lock-Key-F> event add <<PrevChar>> <Left> <Control-Key-b> <Control-Lock-Key-B> event add <<SelectPrevChar>> <Shift-Left> <Shift-Control-Key-B> <Shift-Control-Lock-Key-B> |
︙ | ︙ | |||
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | if {$::tk_library ne ""} { proc ::tk::SourceLibFile {file} { namespace eval :: [list source -encoding utf-8 [file join $::tk_library $file.tcl]] } namespace eval ::tk { SourceLibFile icons SourceLibFile button SourceLibFile entry SourceLibFile listbox SourceLibFile menu SourceLibFile panedwindow SourceLibFile scale SourceLibFile scrlbar SourceLibFile spinbox SourceLibFile text } } # ---------------------------------------------------------------------- # Default bindings for keyboard traversal. # ---------------------------------------------------------------------- | > > > > > | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | if {$::tk_library ne ""} { proc ::tk::SourceLibFile {file} { namespace eval :: [list source -encoding utf-8 [file join $::tk_library $file.tcl]] } namespace eval ::tk { SourceLibFile icons SourceLibFile iconbadges SourceLibFile button SourceLibFile entry SourceLibFile listbox SourceLibFile menu SourceLibFile panedwindow SourceLibFile print SourceLibFile scale SourceLibFile scrlbar SourceLibFile spinbox if {![interp issafe]} { SourceLibFile systray } SourceLibFile text } } # ---------------------------------------------------------------------- # Default bindings for keyboard traversal. # ---------------------------------------------------------------------- |
︙ | ︙ | |||
675 676 677 678 679 680 681 | if {$length > $maxlen} { set maxlen $length } } return $maxlen } | < < < < < < < < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | if {$length > $maxlen} { set maxlen $length } } return $maxlen } if {[tk windowingsystem] eq "aqua"} { #stub procedures to respond to "do script" Apple Events proc ::tk::mac::DoScriptFile {file} { uplevel #0 $file source -encoding utf-8 $file } proc ::tk::mac::DoScriptText {script} { uplevel #0 $script eval $script } #This procedure is required to silence warnings generated #by inline AppleScript execution. proc ::tk::mac::GetDynamicSdef {} { puts "" } } if {[info commands ::tk::endOfWord] eq ""} { proc ::tk::endOfWord {str start {locale {}}} { if {$start < 0} { set start -1 } set start [tcl_endOfWord $str $start] if {$start < 0} { set start "" } return $start } } if {[info commands ::tk::startOfNextWord] eq ""} { proc ::tk::startOfNextWord {str start {locale {}}} { if {$start < 0} { set start -1 } elseif {[string match end-* $start]} { set start [expr {[string length $str]-1-[string range $start 4 end]}] } set start [tcl_startOfNextWord $str $start] if {$start < 0} { set start "" } return $start } } if {[info commands ::tk::startOfPreviousWord] eq ""} { proc ::tk::startOfPreviousWord {str start {locale {}}} { if {$start < 0} { set start -1 } elseif {[string match end-* $start]} { set start [expr {[string length $str]-1-[string range $start 4 end]}] } set start [tcl_startOfPreviousWord $str $start] if {$start < 0} { set start "" } return $start } } if {[info commands ::tk::wordBreakBefore] eq ""} { proc ::tk::wordBreakBefore {str start {locale {}}} { if {$start < 0} { set start -1 } elseif {[string match end-* $start]} { set start [expr {[string length $str]-1-[string range $start 4 end]}] } set start [tcl_wordBreakBefore $str $start] if {$start < 0} { set start "" } return $start } } if {[info commands ::tk::wordBreakAfter] eq ""} { proc ::tk::wordBreakAfter {str start {locale {}}} { if {$start < 0} { set start -1 } elseif {[string match end-* $start]} { set start [expr {[string length $str]-1-[string range $start 4 end]}] } set start [tcl_wordBreakAfter $str $start] if {$start < 0} { set start "" } return $start } } if {[info commands ::tk::endOfCluster] eq ""} { proc ::tk::endOfCluster {str start {locale {}}} { if {$start < 0} { set start -1 } elseif {$start eq "end"} { set start [expr {[string length $str]-1}] } elseif {[string match end-* $start]} { set start [expr {[string length $str]-1-[string range $start 4 end]}] } elseif {$start >= [string length $str]} { return "" } if {[string length [string index $str $start]] > 1} { incr start } incr start return $start } } if {[info commands ::tk::startOfCluster] eq ""} { proc ::tk::startOfCluster {str start {locale {}}} { if {$start < 0} { set start -1 } elseif {$start eq "end"} { set start [expr {[string length $str]-1}] } elseif {[string match end-* $start]} { set start [expr {[string length $str]-1-[string range $start 4 end]}] } elseif {$start >= [string length $str]} { return [string length $str] } if {[string length [string index $str $start]] < 1} { incr start -1 } if {$start < 0} { return "" } return $start } } # Create a dictionary to store the starting index of the IME marked # text in an Entry or Text widget. set ::tk::Priv(IMETextMark) [dict create] |
︙ | ︙ |
Changes to library/tkfbox.tcl.
︙ | ︙ | |||
577 578 579 580 581 582 583 | return } # Turn on the busy cursor. BUG?? We haven't disabled X events, though, # so the user may still click and cause havoc ... # set entCursor [$data(ent) cget -cursor] | | | | 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | return } # Turn on the busy cursor. BUG?? We haven't disabled X events, though, # so the user may still click and cause havoc ... # set entCursor [$data(ent) cget -cursor] set dlgCursor [$w cget -cursor] $data(ent) configure -cursor watch $w configure -cursor watch update idletasks $data(icons) deleteall set showHidden $showHiddenVar # Make the dir list. Note that using an explicit [pwd] (instead of '.') is |
︙ | ︙ | |||
629 630 631 632 633 634 635 | ::tk::SetAmpText $data(okBtn) [mc "&Save"] } } # turn off the busy cursor. # $data(ent) configure -cursor $entCursor | | | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | ::tk::SetAmpText $data(okBtn) [mc "&Save"] } } # turn off the busy cursor. # $data(ent) configure -cursor $entCursor $w configure -cursor $dlgCursor } # ::tk::dialog::file::SetPathSilently -- # # Sets data(selectPath) without invoking the trace procedure # proc ::tk::dialog::file::SetPathSilently {w path} { |
︙ | ︙ | |||
905 906 907 908 909 910 911 | } else { set data(selectFile) $file } Done $w } } PATH { | | | | | | 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | } else { set data(selectFile) $file } Done $w } } PATH { tk_messageBox -icon warning -type ok -parent $w -message \ [mc "Directory \"%1\$s\" does not exist." $path] $data(ent) selection range 0 end $data(ent) icursor end } CHDIR { tk_messageBox -type ok -parent $w -icon warning -message \ [mc "Cannot change to the directory\ \"%1\$s\".\nPermission denied." $path] $data(ent) selection range 0 end $data(ent) icursor end } ERROR { tk_messageBox -type ok -parent $w -icon warning -message \ [mc "Invalid file name \"%1\$s\"." $path] $data(ent) selection range 0 end |
︙ | ︙ | |||
1117 1118 1119 1120 1121 1122 1123 | if { [info exists data(-typevariable)] && $data(-typevariable) ne "" && [info exists data(-filetypes)] && [llength $data(-filetypes)] && [info exists data(filterType)] && $data(filterType) ne "" } then { upvar #0 $data(-typevariable) typeVariable set typeVariable [lindex $data(origfiletypes) \ | | < | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | if { [info exists data(-typevariable)] && $data(-typevariable) ne "" && [info exists data(-filetypes)] && [llength $data(-filetypes)] && [info exists data(filterType)] && $data(filterType) ne "" } then { upvar #0 $data(-typevariable) typeVariable set typeVariable [lindex $data(origfiletypes) \ [lsearch -exact $data(-filetypes) $data(filterType)] 0] } } bind $data(okBtn) <Destroy> {} set Priv(selectFilePath) $selectFilePath } # ::tk::dialog::file::GlobFiltered -- |
︙ | ︙ |
Changes to library/ttk/altTheme.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # # Ttk widget set: Alternate theme # namespace eval ttk::theme::alt { variable colors array set colors { -frame "#d9d9d9" -window "#ffffff" -darker "#c3c3c3" -border "#414141" -activebg "#ececec" -disabledfg "#a3a3a3" -selectbg "#4a6984" -selectfg "#ffffff" -altindicator "#aaaaaa" | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # # Ttk widget set: Alternate theme # namespace eval ttk::theme::alt { variable colors array set colors { -frame "#d9d9d9" -window "#ffffff" -alternate "#f0f0f0" -darker "#c3c3c3" -border "#414141" -activebg "#ececec" -disabledfg "#a3a3a3" -selectbg "#4a6984" -selectfg "#ffffff" -altindicator "#aaaaaa" |
︙ | ︙ | |||
89 90 91 92 93 94 95 | ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] \ -expand [list selected {2 2 1 0}] \ ; # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised | | > > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] \ -expand [list selected {2 2 1 0}] \ ; # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) \ -stripedbackground $colors(-alternate) ttk::style configure Treeview.Separator \ -background $colors(-alternate) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ selected $colors(-selectfg)] ttk::style configure TScale \ -groovewidth 4 -troughrelief sunken \ -sliderwidth raised -borderwidth 2 ttk::style configure TProgressbar \ -background $colors(-selectbg) -borderwidth 0 } } |
Changes to library/ttk/aquaTheme.tcl.
︙ | ︙ | |||
22 23 24 25 26 27 28 | background systemSelectedTextBackgroundColor !focus systemSelectedTextBackgroundColor} \ -selectforeground { background systemSelectedTextColor !focus systemSelectedTextColor} # Button | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > | > > > | > > | | < < < < < < < < < < < < < < | < < | < < < < < < < < | < < < < < < < < < > | | | > > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | background systemSelectedTextBackgroundColor !focus systemSelectedTextBackgroundColor} \ -selectforeground { background systemSelectedTextColor !focus systemSelectedTextColor} # Button ttk::style configure TButton -anchor center \ -foreground systemControlTextColor ttk::style map TButton \ -foreground { pressed white {alternate !pressed !background} white disabled systemDisabledControlTextColor} # Menubutton ttk::style configure TMenubutton -anchor center -padding {2 0 0 2} # Toolbutton ttk::style configure Toolbutton -anchor center # Inline Button ttk::style configure InlineButton -anchor center -font TkHeadingFont \ -foreground systemTextBackgroundColor ttk::style map InlineButton \ -foreground { disabled systemWindowBackgroundColor } # Image Button ttk::style configure ImageButton -anchor center -width 1 \ -compound top ttk::style map ImageButton \ -foreground { pressed systemLabelColor !pressed systemSecondaryLabelColor } # Recessed (radio) button font create RecessedFont -family EmphasizedSystem -size 11 -weight bold ttk::style configure RecessedButton \ -foreground systemControlTextColor ttk::style map RecessedButton \ -foreground { {disabled selected} systemWindowBackgroundColor3 {disabled !selected} systemDisabledControlTextColor selected systemTextBackgroundColor active white pressed white } \ -font { selected RecessedFont active RecessedFont pressed RecessedFont } # For Entry, Combobox and Spinbox widgets the selected text background # is the "Highlight color" selected in preferences when the widget # has focus. It is a gray color when the widget does not have focus or # the window does not have focus. (The background state implies !focus # so we only need to specify !focus.) # Entry ttk::style configure TEntry \ -foreground systemTextColor \ -background systemTextBackgroundColor ttk::style map TEntry \ -foreground { disabled systemDisabledControlTextColor } \ -selectbackground { !focus systemUnemphasizedSelectedTextBackgroundColor } # Combobox: ttk::style map TCombobox \ -foreground { disabled systemDisabledControlTextColor } \ -selectbackground { !focus systemUnemphasizedSelectedTextBackgroundColor } # Spinbox ttk::style configure TSpinbox \ -foreground systemTextColor \ -background systemTextBackgroundColor ttk::style map TSpinbox \ -foreground { disabled systemDisabledControlTextColor } \ -selectbackground { !focus systemUnemphasizedSelectedTextBackgroundColor } # Workaround for #1100117: # Actually, on Aqua we probably shouldn't stipple images in # disabled buttons even if it did work... ttk::style configure . -stipple {} # Notebook ttk::style configure TNotebook -tabmargins {10 0} -tabposition n ttk::style configure TNotebook -padding {18 8 18 17} ttk::style configure TNotebook.Tab -padding {12 3 12 2} ttk::style configure TNotebook.Tab -foreground systemControlTextColor ttk::style map TNotebook.Tab \ -foreground { {background !selected} systemControlTextColor {background selected} black {!background selected} systemSelectedTabTextColor disabled systemDisabledControlTextColor} # Treeview: ttk::style configure Heading \ -font TkHeadingFont \ -foreground systemTextColor \ -background systemWindowBackgroundColor ttk::style configure Treeview -rowheight 18 \ -background systemTextBackgroundColor \ -stripedbackground systemDisabledControlTextColor \ -foreground systemTextColor \ -fieldbackground systemTextBackgroundColor ttk::style map Treeview \ -background { selected systemSelectedTextBackgroundColor } # Enable animation for ttk::progressbar widget: ttk::style configure TProgressbar -period 100 -maxphase 120 # For Aqua, labelframe labels should appear outside the border, # with a 14 pixel inset and 4 pixels spacing between border and label # (ref: Apple Human Interface Guidelines / Controls / Grouping Controls) # ttk::style configure TLabelframe \ -labeloutside true \ -labelmargins {14 0 14 2} ttk::style configure TLabelframe.Label \ -font TkSmallCaptionFont # TODO: panedwindow sashes should be 9 pixels (HIG:Controls:Split Views) } } |
Changes to library/ttk/button.tcl.
︙ | ︙ | |||
38 39 40 41 42 43 44 | ttk::copyBindings TButton TRadiobutton # ...plus a few more: bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 } bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 } | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ttk::copyBindings TButton TRadiobutton # ...plus a few more: bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 } bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 } # bind TCheckbutton <+> { %W select } # bind TCheckbutton <minus> { %W deselect } # activate -- # Simulate a button press: temporarily set the state to 'pressed', # then invoke the button. # proc ttk::button::activate {w} { |
︙ | ︙ | |||
62 63 64 65 66 67 68 | # A radiobutton group consists of all the radiobuttons with # the same parent and -variable; this is a pretty good heuristic # that works most of the time. # proc ttk::button::RadioTraverse {w dir} { set group [list] foreach sibling [winfo children [winfo parent $w]] { | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # A radiobutton group consists of all the radiobuttons with # the same parent and -variable; this is a pretty good heuristic # that works most of the time. # proc ttk::button::RadioTraverse {w dir} { set group [list] foreach sibling [winfo children [winfo parent $w]] { if { [winfo class $sibling] eq "TRadiobutton" && [$sibling cget -variable] eq [$w cget -variable] && ![$sibling instate disabled] } { lappend group $sibling } } if {![llength $group]} { # Shouldn't happen, but can. return } set pos [expr {([lsearch -exact $group $w] + $dir) % [llength $group]}] tk::TabToWindow [lindex $group $pos] } |
Changes to library/ttk/clamTheme.tcl.
︙ | ︙ | |||
125 126 127 128 129 130 131 | -background [list selected $colors(-frame) {} $colors(-darker)] \ -lightcolor [list selected $colors(-lighter) {} $colors(-dark)] \ ; # Treeview: ttk::style configure Heading \ -font TkHeadingFont -relief raised -padding {3} | | > > > | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | -background [list selected $colors(-frame) {} $colors(-darker)] \ -lightcolor [list selected $colors(-lighter) {} $colors(-dark)] \ ; # Treeview: ttk::style configure Heading \ -font TkHeadingFont -relief raised -padding {3} ttk::style configure Treeview -background $colors(-window) \ -stripedbackground $colors(-lighter) ttk::style configure Treeview.Separator \ -background $colors(-lighter) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ selected $colors(-selectfg)] ttk::style configure TLabelframe \ -labeloutside true -labelmargins {0 0 0 4} \ -borderwidth 2 -relief raised ttk::style configure TProgressbar -background $colors(-frame) ttk::style configure Sash -sashthickness 6 -gripcount 10 } |
︙ | ︙ |
Changes to library/ttk/classicTheme.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # # "classic" Tk theme. # # Implements Tk's traditional Motif-like look and feel. # namespace eval ttk::theme::classic { variable colors; array set colors { -frame "#d9d9d9" -window "#ffffff" -activebg "#ececec" -troughbg "#c3c3c3" -selectbg "#c3c3c3" -selectfg "#000000" -disabledfg "#a3a3a3" -indicator "#b03060" -altindicator "#b05e5e" | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # # "classic" Tk theme. # # Implements Tk's traditional Motif-like look and feel. # namespace eval ttk::theme::classic { variable colors; array set colors { -frame "#d9d9d9" -window "#ffffff" -alternate "#f0f0f0" -activebg "#ececec" -troughbg "#c3c3c3" -selectbg "#c3c3c3" -selectfg "#000000" -disabledfg "#a3a3a3" -indicator "#b03060" -altindicator "#b05e5e" |
︙ | ︙ | |||
92 93 94 95 96 97 98 | ttk::style configure TNotebook.Tab \ -padding {3m 1m} \ -background $colors(-troughbg) ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised | | > > > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | ttk::style configure TNotebook.Tab \ -padding {3m 1m} \ -background $colors(-troughbg) ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) \ -stripedbackground $colors(-alternate) ttk::style configure Treeview.Separator \ -background $colors(-alternate) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ selected $colors(-selectfg)] # |
︙ | ︙ |
Changes to library/ttk/combobox.tcl.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # (Tk 8.4.8+) # # On X11: WM_TRANSIENT_FOR on override-redirect windows # may be used by compositing managers and by EWMH-aware # window managers (even though the older ICCCM spec says # it's meaningless). # | | | | | < < | > > | | < < | < < > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # (Tk 8.4.8+) # # On X11: WM_TRANSIENT_FOR on override-redirect windows # may be used by compositing managers and by EWMH-aware # window managers (even though the older ICCCM spec says # it's meaningless). # # On OSX: The native combobox uses a popup menu to display the # combobox choices. So this implementation does that as well, # rather than construc a Tk listbox. Since the window manager # takes care of scrolling and making sure that the menu can be # displayed even when the button is close to the bottom of the # screen, this actually simplifies the implementation. The Post # and PopupWindow procs have separate implementations for Aqua # and other systems. The configuration of the menu is handled # by a different proc than the one which configures the listbox # on other platforms -- ConfigureAquaMenu instead of # ConfigureListbox. # namespace eval ttk::combobox { variable Values ;# Values($cb) is -listvariable of listbox widget variable State set State(entryPress) 0 } |
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | switch -- [tk windowingsystem] { win32 { # Dismiss listbox when user switches to a different application. # NB: *only* do this on Windows (see #1814778) bind ComboboxListbox <FocusOut> { ttk::combobox::LBCancel %W } } } ### Combobox popdown window bindings. # bind ComboboxPopdown <Map> { ttk::combobox::MapPopdown %W } bind ComboboxPopdown <Unmap> { ttk::combobox::UnmapPopdown %W } bind ComboboxPopdown <Button> \ | > > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | switch -- [tk windowingsystem] { win32 { # Dismiss listbox when user switches to a different application. # NB: *only* do this on Windows (see #1814778) bind ComboboxListbox <FocusOut> { ttk::combobox::LBCancel %W } } aqua { bind TCombobox <Destroy> { ttk::combobox::AquaCleanup %W } } } ### Combobox popdown window bindings. # bind ComboboxPopdown <Map> { ttk::combobox::MapPopdown %W } bind ComboboxPopdown <Unmap> { ttk::combobox::UnmapPopdown %W } bind ComboboxPopdown <Button> \ |
︙ | ︙ | |||
94 95 96 97 98 99 100 | ## Platform-specific settings. # switch -- [tk windowingsystem] { x11 { option add *TCombobox*Listbox.background white widgetDefault } | < < < | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | ## Platform-specific settings. # switch -- [tk windowingsystem] { x11 { option add *TCombobox*Listbox.background white widgetDefault } } ### Binding procedures. # ## Press $mode $x $y -- Button binding for comboboxes. # Either post/unpost the listbox, or perform Entry widget binding, |
︙ | ︙ | |||
182 183 184 185 186 187 188 | ## Scroll -- Mousewheel binding # proc ttk::combobox::Scroll {cb dir {factor 1.0}} { $cb instate disabled { return } set max [llength [$cb cget -values]] set current [$cb current] | > > > | > | | < | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | ## Scroll -- Mousewheel binding # proc ttk::combobox::Scroll {cb dir {factor 1.0}} { $cb instate disabled { return } set max [llength [$cb cget -values]] set current [$cb current] if {$current < 0} { set index 0 } else { set d [expr {$dir/$factor}] set index [expr {$current + int($d > 0 ? ceil($d) : floor($d))}] if {$index >= $max} {set index [expr {$max - 1}]} if {$index < 0} {set index 0} } if {$max != 0 && $index != $current} { SelectEntry $cb $index } } ## LBSelected $lb -- Activation binding for listbox # Set the combobox value to the currently-selected listbox value # and unpost the listbox. # |
︙ | ︙ | |||
257 258 259 260 261 262 263 | ttk::releaseGrab $w } ## PopdownWindow -- # Returns the popdown widget associated with a combobox, # creating it if necessary. # | > > | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | ttk::releaseGrab $w } ## PopdownWindow -- # Returns the popdown widget associated with a combobox, # creating it if necessary. # if {[tk windowingsystem] ne "aqua"} { proc ttk::combobox::PopdownWindow {cb} { if {![winfo exists $cb.popdown]} { set poplevel [PopdownToplevel $cb.popdown] set popdown [ttk::frame $poplevel.f -style ComboboxPopdownFrame] ttk::scrollbar $popdown.sb \ -orient vertical -command [list $popdown.l yview] listbox $popdown.l \ -listvariable ttk::combobox::Values($cb) \ -yscrollcommand [list $popdown.sb set] \ -exportselection false \ -selectmode browse \ -activestyle none \ ; bindtags $popdown.l \ [list $popdown.l ComboboxListbox Listbox $popdown all] grid $popdown.l -row 0 -column 0 -padx {1 0} -pady 1 -sticky nsew grid $popdown.sb -row 0 -column 1 -padx {0 1} -pady 1 -sticky ns grid columnconfigure $popdown 0 -weight 1 grid rowconfigure $popdown 0 -weight 1 grid $popdown -sticky news -padx 0 -pady 0 grid rowconfigure $poplevel 0 -weight 1 grid columnconfigure $poplevel 0 -weight 1 } return $cb.popdown } } else { proc ttk::combobox::PopdownWindow {cb} { if {![winfo exists $cb.popdown]} { set poplevel [PopdownToplevel $cb.popdown] # The menu should be (at least) the same length as the button. # Since there is no direct way to control the width of a menu # in Tk, we fake it by using an invisible image in a disabled # menu item, adjusting the image size to make the menu be the # correct width. image create nsimage $cb.spacer -source NSStatusNone -as name \ -alpha 0 set menu [menu $cb.popdown.menu -tearoff 0] } return $cb.popdown } } ## PopdownToplevel -- Create toplevel window for the combobox popdown # # See also <<NOTE-WM-TRANSIENT>> # proc ttk::combobox::PopdownToplevel {w} { |
︙ | ︙ | |||
307 308 309 310 311 312 313 | } win32 { $w configure -relief flat -borderwidth 0 wm overrideredirect $w true wm attributes $w -topmost 1 } aqua { | < < | | | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | } win32 { $w configure -relief flat -borderwidth 0 wm overrideredirect $w true wm attributes $w -topmost 1 } aqua { wm overrideredirect $w true wm attributes $w -alpha 0 } } return $w } ## ConfigureListbox -- # Set listbox values, selection, height, and scrollbar visibility |
︙ | ︙ | |||
337 338 339 340 341 342 343 | $popdown.l selection clear 0 end $popdown.l selection set $current $popdown.l activate $current $popdown.l see $current set height [llength $values] if {$height > [$cb cget -height]} { set height [$cb cget -height] | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > | > | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | $popdown.l selection clear 0 end $popdown.l selection set $current $popdown.l activate $current $popdown.l see $current set height [llength $values] if {$height > [$cb cget -height]} { set height [$cb cget -height] grid $popdown.sb grid configure $popdown.l -padx {1 0} } else { grid remove $popdown.sb grid configure $popdown.l -padx 1 } $popdown.l configure -height $height } proc ttk::combobox::ConfigureAquaMenu {cb width} { set popdown [PopdownWindow $cb] set values [$cb cget -values] set current [$cb current] if {$current < 0} { set current 0 ;# no current entry, highlight first one } $cb.popdown.menu delete 0 end $cb.spacer configure -width [expr {$width - 40}] -height 1 set i 0 foreach item $values { if {$i == 0} { # Add spaces to the first item to make the menu as long as cb set menufont [$cb cget -font] set stretch $item while {[font measure $menufont $stretch] < [expr {$width - 32}]} { set stretch "$stretch " } $cb.popdown.menu add command -label "$stretch" \ -command "ttk::combobox::SelectEntry $cb $i" } else { $cb.popdown.menu add command -label "$item" \ -command "ttk::combobox::SelectEntry $cb $i" } incr i } if { $i == 0 } { # There are no items. To make an empty menu appear add a dummy item # containing a transparent image of the right width. $cb.popdown.menu add command -label {} -image $cb.spacer -state disabled } } ## PlacePopdown -- # Set popdown window geometry. # # @@@TODO: factor with menubutton::PostPosition # proc ttk::combobox::PlacePopdown {cb popdown} { set x [winfo rootx $cb] set y [winfo rooty $cb] set w [winfo width $cb] set h [winfo height $cb] set style [$cb cget -style] if { $style eq {} } { set style TCombobox } set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}] foreach var {x y w h} delta $postoffset { incr $var $delta } set H [winfo reqheight $popdown] if {$y + $h + $H > [winfo screenheight $popdown]} { set Y [expr {$y - $H}] } else { set Y [expr {$y + $h}] } wm geometry $popdown ${w}x${H}+${x}+${Y} } proc ttk::combobox::AquaPlacePopdown {cb popdown} { set x [winfo rootx $cb] set y [winfo rooty $cb] set w [winfo width $cb] set h [winfo height $cb] set style [$cb cget -style] set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}] foreach var {x y w h} delta $postoffset { incr $var $delta } wm geometry $popdown ${w}x${h}+${x}+${y} return [list $x $y $w $h] } ## Post $cb -- # Pop down the associated listbox or menu. # if {[tk windowingsystem] ne "aqua"} { proc ttk::combobox::Post {cb} { # Don't do anything if disabled: # $cb instate disabled { return } # ASSERT: ![$cb instate pressed] # Run -postcommand callback: # uplevel #0 [$cb cget -postcommand] set popdown [PopdownWindow $cb] ConfigureListbox $cb update idletasks ;# needed for geometry propagation. PlacePopdown $cb $popdown # See <<NOTE-WM-TRANSIENT>> switch -- [tk windowingsystem] { x11 - win32 { wm transient $popdown [winfo toplevel $cb] } } # Post the listbox: # wm attribute $popdown -topmost 1 wm deiconify $popdown raise $popdown } } else { proc ttk::combobox::Post {cb} { # Don't do anything if disabled: # $cb instate disabled { return } # ASSERT: ![$cb instate pressed] # Run -postcommand callback: # uplevel #0 [$cb cget -postcommand] set popdown [PopdownWindow $cb] # Configure the menu foreach {x y width height} [AquaPlacePopdown $cb $popdown] { break } ConfigureAquaMenu $cb [winfo width $cb] # Post the menu. It will have a disclosure indicator if it is too # close to the bottom of the screen, and it may be posted above the # button if necessary to be visible. $popdown.menu post [expr {$x + 2}] [expr {$y + $height + 2}] } } ## Unpost $cb -- # Unpost the listbox. # proc ttk::combobox::Unpost {cb} { if {[winfo exists $cb.popdown]} { |
︙ | ︙ | |||
444 445 446 447 448 449 450 451 452 | # because the widget command is already gone when this binding fires). # [winfo parent] still works, fortunately. # proc ttk::combobox::LBCleanup {lb} { variable Values unset Values([LBMain $lb]) } #*EOF* | > > > > | 534 535 536 537 538 539 540 541 542 543 544 545 546 | # because the widget command is already gone when this binding fires). # [winfo parent] still works, fortunately. # proc ttk::combobox::LBCleanup {lb} { variable Values unset Values([LBMain $lb]) } proc ttk::combobox::AquaCleanup {cb} { catch {image delete $cb.spacer} } #*EOF* |
Changes to library/ttk/defaults.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # # Settings for default theme. # namespace eval ttk::theme::default { variable colors array set colors { -frame "#d9d9d9" -foreground "#000000" -window "#ffffff" -text "#000000" -activebg "#ececec" -selectbg "#4a6984" -selectfg "#ffffff" -darker "#c3c3c3" -disabledfg "#a3a3a3" -indicator "#4a6984" | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # # Settings for default theme. # namespace eval ttk::theme::default { variable colors array set colors { -frame "#d9d9d9" -foreground "#000000" -window "#ffffff" -alternate "#e8e8e8" -text "#000000" -activebg "#ececec" -selectbg "#4a6984" -selectfg "#ffffff" -darker "#c3c3c3" -disabledfg "#a3a3a3" -indicator "#4a6984" |
︙ | ︙ | |||
103 104 105 106 107 108 109 | ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] # Treeview. # ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview \ | | > > > | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] # Treeview. # ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview \ -background $colors(-window) \ -stripedbackground $colors(-alternate) \ -foreground $colors(-text) ; ttk::style configure Treeview.Separator \ -background $colors(-alternate) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ selected $colors(-selectfg)] # Combobox popdown frame ttk::style layout ComboboxPopdownFrame { ComboboxPopdownFrame.border -sticky nswe } |
︙ | ︙ |
Changes to library/ttk/entry.tcl.
︙ | ︙ | |||
115 116 117 118 119 120 121 | ## Edit bindings: # bind TEntry <Key> { ttk::entry::Insert %W %A } bind TEntry <Delete> { ttk::entry::Delete %W } bind TEntry <BackSpace> { ttk::entry::Backspace %W } | | < < < < | > | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | ## Edit bindings: # bind TEntry <Key> { ttk::entry::Insert %W %A } bind TEntry <Delete> { ttk::entry::Delete %W } bind TEntry <BackSpace> { ttk::entry::Backspace %W } # Ignore all Alt, Meta, Control, Command, and Fn keypresses unless explicitly bound. # Otherwise, the <Key> class binding will fire and insert the character. # Ditto for Escape, Return, and Tab. # bind TEntry <Alt-Key> {# nothing} bind TEntry <Meta-Key> {# nothing} bind TEntry <Control-Key> {# nothing} bind TEntry <Escape> {# nothing} bind TEntry <Return> {# nothing} bind TEntry <KP_Enter> {# nothing} bind TEntry <Tab> {# nothing} bind TEntry <Command-Key> {# nothing} bind TEntry <Fn-Key> {# nothing} # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] bind TEntry <<PrevLine>> {# nothing} bind TEntry <<NextLine>> {# nothing} ## Additional emacs-like bindings: # bind TEntry <Control-d> { ttk::entry::Delete %W } |
︙ | ︙ | |||
160 161 162 163 164 165 166 167 168 169 170 171 172 173 | } bind TEntry <<TkClearIMEMarkedText>> { %W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert] } bind TEntry <<TkAccentBackspace>> { ttk::entry::Backspace %W } ### Clipboard procedures. # ## EntrySelection -- Return the selected text of the entry. # Raises an error if there is no selection. # | > > > > > > > > > > > > > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | } bind TEntry <<TkClearIMEMarkedText>> { %W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert] } bind TEntry <<TkAccentBackspace>> { ttk::entry::Backspace %W } ## EndIMEMarkedText -- Handle the end of input method selection. # proc ::ttk::entry::EndIMEMarkedText {w} { variable ::tk::Priv if {[catch { set mark [dict get $Priv(IMETextMark) $w] }]} { bell return } $w selection range $mark insert } ### Clipboard procedures. # ## EntrySelection -- Return the selected text of the entry. # Raises an error if there is no selection. # |
︙ | ︙ | |||
244 245 246 247 248 249 250 | # position following the next end-of-word position. # set ::ttk::entry::State(startNext) \ [string equal [tk windowingsystem] "win32"] proc ttk::entry::NextWord {w start} { variable State | | | | > > > > > > > > > > > > > > > > > > > > > | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | # position following the next end-of-word position. # set ::ttk::entry::State(startNext) \ [string equal [tk windowingsystem] "win32"] proc ttk::entry::NextWord {w start} { variable State set pos [tk::endOfWord [$w get] [$w index $start]] if {$pos >= 0 && $State(startNext)} { set pos [tk::startOfNextWord [$w get] $pos] } if {$pos < 0} { return end } return $pos } ## PrevWord -- Find the previous word position. # proc ttk::entry::PrevWord {w start} { set pos [tk::startOfPreviousWord [$w get] [$w index $start]] if {$pos < 0} { return 0 } return $pos } ## NextChar -- Find the next char position. # proc ttk::entry::NextChar {w start} { variable State set pos [tk::endOfCluster [$w get] [$w index $start]] if {$pos < 0} { return end } return $pos } ## PrevChar -- Find the previous char position. # proc ttk::entry::PrevChar {w start} { set pos [tk::startOfCluster [$w get] [expr {[$w index $start]-1}]] if {$pos < 0} { return 0 } return $pos } ## RelIndex -- Compute character/word/line-relative index. # proc ttk::entry::RelIndex {w where {index insert}} { switch -- $where { prevchar { PrevChar $w $index } nextchar { NextChar $w $index } prevword { PrevWord $w $index } nextword { NextWord $w $index } home { return 0 } end { $w index end } default { error "Bad relative index $index" } } } |
︙ | ︙ | |||
310 311 312 313 314 315 316 | # proc ttk::entry::ExtendTo {w index} { set index [$w index $index] set insert [$w index insert] # Figure out selection anchor: if {![$w selection present]} { | | | | | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | # proc ttk::entry::ExtendTo {w index} { set index [$w index $index] set insert [$w index insert] # Figure out selection anchor: if {![$w selection present]} { set anchor $insert } else { set selfirst [$w index sel.first] set sellast [$w index sel.last] if { ($index < $selfirst) || ($insert == $selfirst && $index <= $sellast) } { set anchor $sellast } else { set anchor $selfirst } } # Extend selection: if {$anchor < $index} { $w selection range $anchor $index } else { $w selection range $index $anchor } $w icursor $index return $anchor } ## Extend -- Extend the selection to a relative position, show insert cursor |
︙ | ︙ | |||
388 389 390 391 392 393 394 | # and sets the selection mode for subsequent drag operations. # proc ttk::entry::Select {w x mode} { variable State set cur [ClosestGap $w $x] switch -- $mode { | | | | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | # and sets the selection mode for subsequent drag operations. # proc ttk::entry::Select {w x mode} { variable State set cur [ClosestGap $w $x] switch -- $mode { word { WordSelect $w $cur $cur } line { LineSelect $w $cur $cur } char { # no-op } } set State(anchor) $cur set State(selectMode) $mode } |
︙ | ︙ | |||
495 496 497 498 499 500 501 | } $w selection range $first $last } ## WordBack, WordForward -- helper routines for WordSelect. # proc ttk::entry::WordBack {text index} { | | | | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | } $w selection range $first $last } ## WordBack, WordForward -- helper routines for WordSelect. # proc ttk::entry::WordBack {text index} { if {[set pos [tk::wordBreakBefore $text $index]] < 0} { return 0 } return $pos } proc ttk::entry::WordForward {text index} { if {[set pos [tk::wordBreakAfter $text $index]] < 0} { return end } return $pos } ## LineSelect -- Select the entire line. # proc ttk::entry::LineSelect {w _ _} { variable State |
︙ | ︙ | |||
537 538 539 540 541 542 543 | if {abs($dx) > $State(deadband)} { set State(scanMoved) 1 } set left [expr {$State(scanIndex) + ($dx*$State(scanNum))/$State(scanDen)}] $w xview $left if {$left != [set newLeft [$w index @0]]} { | | | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | if {abs($dx) > $State(deadband)} { set State(scanMoved) 1 } set left [expr {$State(scanIndex) + ($dx*$State(scanNum))/$State(scanDen)}] $w xview $left if {$left != [set newLeft [$w index @0]]} { # We've scanned past one end of the entry; # reset the mark so that the text will start dragging again # as soon as the mouse reverses direction. # set State(scanX) $x set State(scanIndex) $newLeft } } |
︙ | ︙ | |||
594 595 596 597 598 599 600 | ## Backspace -- Backspace over the character just before the insert cursor. # If there is a selection, delete that instead. # If the new insert position is offscreen to the left, # scroll to place the cursor at about the middle of the window. # proc ttk::entry::Backspace {w} { if {[PendingDelete $w]} { | | | | > | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | ## Backspace -- Backspace over the character just before the insert cursor. # If there is a selection, delete that instead. # If the new insert position is offscreen to the left, # scroll to place the cursor at about the middle of the window. # proc ttk::entry::Backspace {w} { if {[PendingDelete $w]} { See $w return } set x [expr {[$w index insert] - 1}] if {$x < 0} { return } $w delete [tk::startOfCluster [$w get] $x] [tk::endOfCluster [$w get] $x] if {[$w index @0] >= [$w index insert]} { set range [$w xview] set left [lindex $range 0] set right [lindex $range 1] $w xview moveto [expr {$left - ($right - $left)/2.0}] } } ## Delete -- Delete the character after the insert cursor. # If there is a selection, delete that instead. # proc ttk::entry::Delete {w} { if {![PendingDelete $w]} { $w delete [tk::startOfCluster [$w get] [$w index insert]] \ [tk::endOfCluster [$w get] [$w index insert]] } } #*EOF* |
Changes to library/ttk/fonts.tcl.
︙ | ︙ | |||
62 63 64 65 66 67 68 | catch {font create TkCaptionFont} catch {font create TkTooltipFont} catch {font create TkFixedFont} catch {font create TkIconFont} catch {font create TkMenuFont} catch {font create TkSmallCaptionFont} | | | | | | | | | | | | < | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | < | < | | | | | < | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | catch {font create TkCaptionFont} catch {font create TkTooltipFont} catch {font create TkFixedFont} catch {font create TkIconFont} catch {font create TkMenuFont} catch {font create TkSmallCaptionFont} if {!$tip145} {apply {{} { global tcl_platform switch -- [tk windowingsystem] { win32 { # In safe interps there is no osVersion element. if {[info exists tcl_platform(osVersion)]} { if {$tcl_platform(osVersion) >= 5.0} { set family "Tahoma" } else { set family "MS Sans Serif" } } else { if {[lsearch -exact [font families] Tahoma] >= 0} { set family "Tahoma" } else { set family "MS Sans Serif" } } set size 8 font configure TkDefaultFont -family $family -size $size font configure TkTextFont -family $family -size $size font configure TkHeadingFont -family $family -size $size font configure TkCaptionFont -family $family -size $size -weight bold font configure TkTooltipFont -family $family -size $size font configure TkFixedFont -family Courier -size 10 font configure TkIconFont -family $family -size $size font configure TkMenuFont -family $family -size $size font configure TkSmallCaptionFont -family $family -size $size } aqua { set family "Lucida Grande" set fixed "Monaco" set menusize 14 set size 13 set viewsize 12 set smallsize 11 set labelsize 10 set fixedsize 11 font configure TkDefaultFont -family $family -size $size font configure TkTextFont -family $family -size $size font configure TkHeadingFont -family $family -size $smallsize font configure TkCaptionFont -family $family -size $size -weight bold font configure TkTooltipFont -family $family -size $smallsize font configure TkFixedFont -family $fixed -size $fixedsize font configure TkIconFont -family $family -size $size font configure TkMenuFont -family $family -size $menusize font configure TkSmallCaptionFont -family $family -size $labelsize } default - x11 { if {![catch {tk::pkgconfig get fontsystem} fs] && $fs eq "xft"} { set family "sans-serif" set fixed "monospace" } else { set family "Helvetica" set fixed "courier" } set size 10 set ttsize 9 set capsize 12 set fixedsize 10 font configure TkDefaultFont -family $family -size $size font configure TkTextFont -family $family -size $size font configure TkHeadingFont -family $family -size $size -weight bold font configure TkCaptionFont -family $family -size $capsize -weight bold font configure TkTooltipFont -family $family -size $ttsize font configure TkFixedFont -family $fixed -size $fixedsize font configure TkIconFont -family $family -size $size font configure TkMenuFont -family $family -size $size font configure TkSmallCaptionFont -family $family -size $ttsize } } } ::ttk}} } #*EOF* |
Changes to library/ttk/menubutton.tcl.
︙ | ︙ | |||
53 54 55 56 57 58 59 | bind TMenubutton <Button-1> { ttk::menubutton::Pulldown %W } bind TMenubutton <ButtonRelease-1> { ttk::menubutton::TransferGrab %W } bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W } } else { bind TMenubutton <Button-1> \ { %W state pressed ; ttk::menubutton::Popdown %W } bind TMenubutton <ButtonRelease-1> \ | | > < < | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | bind TMenubutton <Button-1> { ttk::menubutton::Pulldown %W } bind TMenubutton <ButtonRelease-1> { ttk::menubutton::TransferGrab %W } bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W } } else { bind TMenubutton <Button-1> \ { %W state pressed ; ttk::menubutton::Popdown %W } bind TMenubutton <ButtonRelease-1> \ { if {[winfo exists %W]} { %W state {!pressed}} } } # PostPosition -- # Returns x and y coordinates and a menu item index. # If the index is not an empty string the menu should # be posted so that the upper left corner of the indexed # menu item is located at the point (x, y). Otherwise # the top left corner of the menu itself should be located # at that point. # # TODO: adjust menu width to be at least as wide as the button # for -direction above, below. # if {[tk windowingsystem] eq "aqua"} { proc ::ttk::menubutton::PostPosition {mb menu} { set menuPad 5 set buttonPad 1 set bevelPad 4 set flushPad 4 set mh [winfo reqheight $menu] set bh [expr {[winfo height $mb]} + $buttonPad] set bbh [expr {[winfo height $mb]} + $bevelPad] set mw [winfo reqwidth $menu] set bw [winfo width $mb] set entry [::tk::MenuFindName $menu [$mb cget -text]] if {$entry < 0} { set entry 0 } set x [winfo rootx $mb] set y [winfo rooty $mb] switch [$mb cget -direction] { above { set entry "" |
︙ | ︙ | |||
103 104 105 106 107 108 109 110 | incr y $menuPad incr x -$mw } right { incr y $menuPad incr x $bw } default { | > > > > < < < | | | | < | < < < < | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | incr y $menuPad incr x -$mw } right { incr y $menuPad incr x $bw } flush { incr y $flushPad incr x -$flushPad } default { } } return [list $x $y $entry] } } else { proc ::ttk::menubutton::PostPosition {mb menu} { set mh [expr {[winfo reqheight $menu]}] set bh [expr {[winfo height $mb]}] set mw [expr {[winfo reqwidth $menu]}] set bw [expr {[winfo width $mb]}] if {[tk windowingsystem] eq "win32"} { incr mh 6 incr mw 16 } set entry [::tk::MenuFindName $menu [$mb cget -text]] if {$entry < 0} { set entry 0 } set x [winfo rootx $mb] set y [winfo rooty $mb] switch [$mb cget -direction] { above { set entry "" incr y -$mh # if we go offscreen to the top, show as 'below' if {$y < [winfo vrooty $mb]} { set y [expr {[winfo vrooty $mb] + [winfo rooty $mb]\ + [winfo reqheight $mb]}] } } below { set entry "" incr y $bh # if we go offscreen to the bottom, show as 'above' if {($y + $mh) > ([winfo vrooty $mb] + [winfo vrootheight $mb])} { set y [expr {[winfo vrooty $mb] + [winfo vrootheight $mb] \ + [winfo rooty $mb] - $mh}] } } left { incr x -$mw } right { incr x $bw } default { # flush incr x [expr {([winfo width $mb] - [winfo reqwidth $menu])/ 2}] } } return [list $x $y $entry] } } # Popdown -- |
︙ | ︙ | |||
192 193 194 195 196 197 198 | } set State(pulldown) 1 set State(oldcursor) [$mb cget -cursor] $mb state pressed $mb configure -cursor [$menu cget -cursor] foreach {x y entry} [PostPosition $mb $menu] { break } | | | | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | } set State(pulldown) 1 set State(oldcursor) [$mb cget -cursor] $mb state pressed $mb configure -cursor [$menu cget -cursor] foreach {x y entry} [PostPosition $mb $menu] { break } if {$entry >= 0} { $menu post $x $y $entry } else { $menu post $x $y } tk_menuSetFocus $menu } # TransferGrab (X11 only) -- # Switch from pulldown mode (menubutton has an implicit grab) # to popdown mode (menu has an explicit grab). # proc ttk::menubutton::TransferGrab {mb} { variable State if {$State(pulldown)} { $mb configure -cursor $State(oldcursor) $mb state {!pressed !active} set State(pulldown) 0 set menu [$mb cget -menu] foreach {x y entry} [PostPosition $mb $menu] { break } tk_popup $menu [winfo rootx $menu] [winfo rooty $menu] } } # FindMenuEntry -- # Hack to support tk_optionMenus. # Returns the index of the menu entry with a matching -label, # "" if not found. # proc ttk::menubutton::FindMenuEntry {menu s} { set last [$menu index last] if {$last < 0} { return "" } for {set i 0} {$i <= $last} {incr i} { if {![catch {$menu entrycget $i -label} label] && ($label eq $s)} { return $i } } return "" } #*EOF* |
Changes to library/ttk/notebook.tcl.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | bind TNotebook <Control-Tab> { ttk::notebook::CycleTab %W 1; break } bind TNotebook <Control-Shift-Tab> { ttk::notebook::CycleTab %W -1; break } catch { bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break } } bind TNotebook <Destroy> { ttk::notebook::Cleanup %W } # ActivateTab $nb $tab -- # Select the specified tab and set focus. # # Desired behavior: # + take focus when reselecting the currently-selected tab; # + keep focus if the notebook already has it; # + otherwise set focus to the first traversable widget | > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | bind TNotebook <Control-Tab> { ttk::notebook::CycleTab %W 1; break } bind TNotebook <Control-Shift-Tab> { ttk::notebook::CycleTab %W -1; break } catch { bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break } } bind TNotebook <Destroy> { ttk::notebook::Cleanup %W } ttk::bindMouseWheel TNotebook [list ttk::notebook::CycleTab %W] # ActivateTab $nb $tab -- # Select the specified tab and set focus. # # Desired behavior: # + take focus when reselecting the currently-selected tab; # + keep focus if the notebook already has it; # + otherwise set focus to the first traversable widget |
︙ | ︙ | |||
52 53 54 55 56 57 58 | ActivateTab $w $index } } # CycleTab -- # Select the next/previous tab in the list. # | | < | > > > > | > | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | ActivateTab $w $index } } # CycleTab -- # Select the next/previous tab in the list. # proc ttk::notebook::CycleTab {w dir {factor 1.0}} { set current [$w index current] if {$current >= 0} { set tabCount [$w index end] set d [expr {$dir/$factor}] set d [expr {int($d > 0 ? ceil($d) : floor($d))}] set select [expr {($current + $d) % $tabCount}] set step [expr {$d > 0 ? 1 : -1}] while {[$w tab $select -state] ne "normal" && ($select != $current)} { set select [expr {($select + $step) % $tabCount}] } if {$select != $current} { ActivateTab $w $select } } } |
︙ | ︙ | |||
108 109 110 111 112 113 114 | bind $top <Control-Next> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Prior> {+ttk::notebook::TLCycleTab %W -1} bind $top <Control-Tab> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Shift-Tab> {+ttk::notebook::TLCycleTab %W -1} catch { bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1} } | < | | < < < < | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | bind $top <Control-Next> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Prior> {+ttk::notebook::TLCycleTab %W -1} bind $top <Control-Tab> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Shift-Tab> {+ttk::notebook::TLCycleTab %W -1} catch { bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1} } bind $top <Option-Key> \ +[list ttk::notebook::MnemonicActivation $top %K] bind $top <Destroy> {+ttk::notebook::TLCleanup %W} } lappend TLNotebooks($top) $nb } # TLCleanup -- <Destroy> binding for traversal-enabled toplevels |
︙ | ︙ |
Changes to library/ttk/panedwindow.tcl.
1 2 3 4 5 6 7 8 | # # Bindings for ttk::panedwindow widget. # namespace eval ttk::panedwindow { variable State array set State { pressed 0 | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # # Bindings for ttk::panedwindow widget. # namespace eval ttk::panedwindow { variable State array set State { pressed 0 pressX - pressY - sash - sashPos - } } ## Bindings: |
︙ | ︙ | |||
28 29 30 31 32 33 34 | ## Sash movement: # proc ttk::panedwindow::Press {w x y} { variable State set sash [$w identify $x $y] if {$sash eq ""} { | | | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ## Sash movement: # proc ttk::panedwindow::Press {w x y} { variable State set sash [$w identify $x $y] if {$sash eq ""} { set State(pressed) 0 return } set State(pressed) 1 set State(pressX) $x set State(pressY) $y set State(sash) $sash set State(sashPos) [$w sashpos $sash] } proc ttk::panedwindow::Drag {w x y} { variable State if {!$State(pressed)} { return } switch -- [$w cget -orient] { horizontal { set delta [expr {$x - $State(pressX)}] } vertical { set delta [expr {$y - $State(pressY)}] } } $w sashpos $State(sash) [expr {$State(sashPos) + $delta}] } proc ttk::panedwindow::Release {w x y} { variable State set State(pressed) 0 |
︙ | ︙ | |||
75 76 77 78 79 80 81 | variable State ttk::saveCursor $w State(userConfCursor) \ [list [ttk::cursor hresize] [ttk::cursor vresize]] set cursor $State(userConfCursor) if {[llength [$w identify $x $y]]} { | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | variable State ttk::saveCursor $w State(userConfCursor) \ [list [ttk::cursor hresize] [ttk::cursor vresize]] set cursor $State(userConfCursor) if {[llength [$w identify $x $y]]} { # Assume we're over a sash. switch -- [$w cget -orient] { horizontal { set cursor hresize } vertical { set cursor vresize } } } ttk::setCursor $w $cursor } #*EOF* |
Changes to library/ttk/progress.tcl.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # Autoincrement -- # Periodic callback procedure for autoincrement mode # proc ttk::progressbar::Autoincrement {pb steptime stepsize} { variable Timers if {![winfo exists $pb]} { | | | > > > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | # Autoincrement -- # Periodic callback procedure for autoincrement mode # proc ttk::progressbar::Autoincrement {pb steptime stepsize} { variable Timers if {![winfo exists $pb]} { # widget has been destroyed -- cancel timer unset -nocomplain Timers($pb) return } set Timers($pb) [after $steptime \ [list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ] $pb step $stepsize } # ttk::progressbar::start -- # Start autoincrement mode. Invoked by [$pb start] widget code. # proc ttk::progressbar::start {pb {steptime 50} {stepsize 1}} { variable Timers if {![info exists Timers($pb)]} { Autoincrement $pb $steptime $stepsize } if {[tk windowingsystem] eq "aqua"} { $pb state selected } } # ttk::progressbar::stop -- # Cancel autoincrement mode. Invoked by [$pb stop] widget code. # proc ttk::progressbar::stop {pb} { variable Timers if {[info exists Timers($pb)]} { after cancel $Timers($pb) unset Timers($pb) } $pb configure -value 0 if {[tk windowingsystem] eq "aqua"} { $pb state !selected } } |
Changes to library/ttk/scale.tcl.
|
| | | 1 2 3 4 5 6 7 8 | # scale.tcl - Copyright © 2004 Pat Thoyts <[email protected]> # # Bindings for the TScale widget namespace eval ttk::scale { variable State array set State { dragging 0 |
︙ | ︙ |
Changes to library/ttk/scrollbar.tcl.
︙ | ︙ | |||
70 71 72 73 74 75 76 | } } } proc ttk::scrollbar::Drag {w x y} { variable State if {![info exists State(first)]} { | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | } } } proc ttk::scrollbar::Drag {w x y} { variable State if {![info exists State(first)]} { # Initial buttonpress was not on the thumb, # or something screwy has happened. In either case, ignore: return; } set xDelta [expr {$x - $State(xPress)}] set yDelta [expr {$y - $State(yPress)}] Moveto $w [expr {$State(first) + [$w delta $xDelta $yDelta]}] } |
︙ | ︙ |
Changes to library/ttk/sizegrip.tcl.
︙ | ︙ | |||
8 9 10 11 12 13 14 | switch -- [tk windowingsystem] { x11 - win32 { option add *TSizegrip.cursor [ttk::cursor seresize] widgetDefault } aqua { | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | switch -- [tk windowingsystem] { x11 - win32 { option add *TSizegrip.cursor [ttk::cursor seresize] widgetDefault } aqua { # Aqua sizegrips use default Arrow cursor. } } namespace eval ttk::sizegrip { variable State array set State { pressed 0 |
︙ | ︙ |
Changes to library/ttk/spinbox.tcl.
︙ | ︙ | |||
19 20 21 22 23 24 25 | bind TSpinbox <Up> { event generate %W <<Increment>> } bind TSpinbox <Down> { event generate %W <<Decrement>> } bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 } bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 } | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | bind TSpinbox <Up> { event generate %W <<Increment>> } bind TSpinbox <Down> { event generate %W <<Decrement>> } bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 } bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 } ttk::bindMouseWheel TSpinbox [list ttk::spinbox::Spin %W] ## Motion -- # Sets cursor. # proc ttk::spinbox::Motion {w x y} { variable State ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] |
︙ | ︙ | |||
76 77 78 79 80 81 82 | proc ttk::spinbox::Release {w} { ttk::CancelRepeat } ## MouseWheel -- # Mousewheel callback. Turn these into <<Increment>> (-1, up) | | | | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | proc ttk::spinbox::Release {w} { ttk::CancelRepeat } ## MouseWheel -- # Mousewheel callback. Turn these into <<Increment>> (-1, up) # or <<Decrement> (+1, down) events. Not used any more. # proc ttk::spinbox::MouseWheel {w dir {factor 1.0}} { if {[$w instate disabled]} { return } if {($dir < 0) ^ ($factor < 0)} { event generate $w <<Increment>> } elseif {$dir != 0} { event generate $w <<Decrement>> } } ## SelectAll -- # Select widget contents. # |
︙ | ︙ | |||
130 131 132 133 134 135 136 | ## Spin -- # Handle <<Increment>> and <<Decrement>> events. # If -values is specified, cycle through the list. # Otherwise cycle through numeric range based on # -from, -to, and -increment. # | | > > | | | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | ## Spin -- # Handle <<Increment>> and <<Decrement>> events. # If -values is specified, cycle through the list. # Otherwise cycle through numeric range based on # -from, -to, and -increment. # proc ttk::spinbox::Spin {w dir {factor -1.0}} { variable State if {[$w instate disabled]} { return } if {![info exists State($w,values.length)]} { set State($w,values.index) -1 set State($w,values.last) {} } set State($w,values) [$w cget -values] set State($w,values.length) [llength $State($w,values)] set d [expr {-($dir/$factor)}] set d [expr {int($d > 0 ? ceil($d) : floor($d))}] if {$State($w,values.length) > 0} { set value [$w get] set current $State($w,values.index) if {$value ne $State($w,values.last)} { set current [lsearch -exact $State($w,values) $value] if {$current < 0} {set current -1} } set State($w,values.index) [Adjust $w [expr {$current + $d}] 0 \ [expr {$State($w,values.length) - 1}]] set State($w,values.last) [lindex $State($w,values) $State($w,values.index)] $w set $State($w,values.last) } else { if {[catch { set v [expr {[scan [$w get] %f] + $d * [$w cget -increment]}] }]} { set v [$w cget -from] } $w set [FormatValue $w [Adjust $w $v [$w cget -from] [$w cget -to]]] } SelectAll $w uplevel #0 [$w cget -command] |
︙ | ︙ |
Changes to library/ttk/treeview.tcl.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | set State(pressX) 0 # For pressMode == "resize" set State(resizeColumn) #0 # For pressmode == "heading" set State(heading) {} } ### Widget bindings. # bind Treeview <Motion> { ttk::treeview::Motion %W %x %y } bind Treeview <B1-Leave> { #nothing } | > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | set State(pressX) 0 # For pressMode == "resize" set State(resizeColumn) #0 # For pressmode == "heading" set State(heading) {} set State(cellAnchor) {} set State(cellAnchorOp) "set" } ### Widget bindings. # bind Treeview <Motion> { ttk::treeview::Motion %W %x %y } bind Treeview <B1-Leave> { #nothing } |
︙ | ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # ## Keynav -- Keyboard navigation # # @@@ TODO: verify/rewrite up and down code. # proc ttk::treeview::Keynav {w dir} { set focus [$w focus] if {$focus eq ""} { return } switch -- $dir { up { if {[set up [$w prev $focus]] eq ""} { set focus [$w parent $focus] } else { while {[$w item $up -open] && [llength [$w children $up]]} { | > > > > > > > > > > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | # ## Keynav -- Keyboard navigation # # @@@ TODO: verify/rewrite up and down code. # proc ttk::treeview::Keynav {w dir} { variable State set focus [$w focus] if {$focus eq ""} { return } set cells [expr {[$w cget -selecttype] eq "cell"}] if {$cells} { lassign $State(cellAnchor) _ colAnchor # Just in case, give it a valid value if {$colAnchor eq ""} { set colAnchor "#1" } } switch -- $dir { up { if {[set up [$w prev $focus]] eq ""} { set focus [$w parent $focus] } else { while {[$w item $up -open] && [llength [$w children $up]]} { |
︙ | ︙ | |||
78 79 80 81 82 83 84 | while {$up ne "" && [set down [$w next $up]] eq ""} { set up [$w parent $up] } set focus $down } } left { | > > > > > > > > | | | > > > > > > > > > > > > > | > > > | > > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | while {$up ne "" && [set down [$w next $up]] eq ""} { set up [$w parent $up] } set focus $down } } left { if {$cells} { # This assumes that colAnchor is of the "#N" format. set colNo [string range $colAnchor 1 end] set firstCol [expr {"tree" ni [$w cget -show]}] if {$colNo > $firstCol} { incr colNo -1 set colAnchor "#$colNo" } } elseif {[$w item $focus -open] && [llength [$w children $focus]]} { CloseItem $w $focus } else { set focus [$w parent $focus] } } right { if {$cells} { set colNo [string range $colAnchor 1 end] set dispCol [$w cget -displaycolumns] if {$dispCol eq "#all"} { set lastCol [llength [$w cget -columns]] } else { set lastCol [llength $dispCol] } if {$colNo < ($lastCol - 1)} { incr colNo set colAnchor "#$colNo" } } else { OpenItem $w $focus } } } if {$focus != {}} { if {$cells} { set cell [list $focus $colAnchor] SelectOp $w $focus $cell choose } else { SelectOp $w $focus "" choose } } } ## Motion -- pointer motion binding. # Sets cursor, active element ... # proc ttk::treeview::Motion {w x y} { |
︙ | ︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | if {$heading != {}} { $w heading $heading state active } set State(activeHeading) $heading set State(activeWidget) $w } } ## Select $w $x $y $selectop # Binding procedure for selection operations. # See "Selection modes", below. # proc ttk::treeview::Select {w x y op} { if {[set item [$w identify row $x $y]] ne "" } { | > > > > > > > > > > > > > > | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | if {$heading != {}} { $w heading $heading state active } set State(activeHeading) $heading set State(activeWidget) $w } } ## IndentifyCell -- Locate the cell at coordinate # Only active when -selecttype is "cell", and leaves cell empty otherwise. # Down the call chain it is enough to check cell to know the selecttype. proc ttk::treeview::IdentifyCell {w x y} { set cell {} if {[$w cget -selecttype] eq "cell"} { # Later handling assumes that the column in the cell ID is of the # format #N, which is always the case from "identify cell" set cell [$w identify cell $x $y] } return $cell } ## Select $w $x $y $selectop # Binding procedure for selection operations. # See "Selection modes", below. # proc ttk::treeview::Select {w x y op} { if {[set item [$w identify row $x $y]] ne "" } { set cell [IdentifyCell $w $x $y] SelectOp $w $item $cell $op } } ## DoubleClick -- Double-Button-1 binding. # proc ttk::treeview::DoubleClick {w x y} { if {[set row [$w identify row $x $y]] ne ""} { |
︙ | ︙ | |||
172 173 174 175 176 177 178 | switch -- [$w identify region $x $y] { nothing { } heading { heading.press $w $x $y } separator { resize.press $w $x $y } tree - cell { set item [$w identify item $x $y] | > > | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | switch -- [$w identify region $x $y] { nothing { } heading { heading.press $w $x $y } separator { resize.press $w $x $y } tree - cell { set item [$w identify item $x $y] set cell [IdentifyCell $w $x $y] SelectOp $w $item $cell choose switch -glob -- [$w identify element $x $y] { *indicator - *disclosure { Toggle $w $item } } } } } |
︙ | ︙ | |||
234 235 236 237 238 239 240 | } proc ttk::treeview::heading.drag {w x y} { variable State if { [$w identify region $x $y] eq "heading" && [$w identify column $x $y] eq $State(heading) } { | | | | | | | | | | | | | | > > > > > > | | > | > > > > > > > > | | | | > | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | } proc ttk::treeview::heading.drag {w x y} { variable State if { [$w identify region $x $y] eq "heading" && [$w identify column $x $y] eq $State(heading) } { $w heading $State(heading) state pressed } else { $w heading $State(heading) state !pressed } } proc ttk::treeview::heading.release {w} { variable State if {[lsearch -exact [$w heading $State(heading) state] pressed] >= 0} { after 0 [$w heading $State(heading) -command] } $w heading $State(heading) state !pressed } ### Selection modes. # ## SelectOp $w $item [ choose | extend | toggle ] -- # Dispatch to appropriate selection operation # depending on current value of -selectmode. # proc ttk::treeview::SelectOp {w item cell op} { select.$op.[$w cget -selectmode] $w $item $cell } ## -selectmode none: # proc ttk::treeview::select.choose.none {w item cell} { $w focus $item; $w see $item } proc ttk::treeview::select.toggle.none {w item cell} { $w focus $item; $w see $item } proc ttk::treeview::select.extend.none {w item cell} { $w focus $item; $w see $item } ## -selectmode browse: # proc ttk::treeview::select.choose.browse {w item cell} { BrowseTo $w $item $cell } proc ttk::treeview::select.toggle.browse {w item cell} { BrowseTo $w $item $cell } proc ttk::treeview::select.extend.browse {w item cell} { BrowseTo $w $item $cell } ## -selectmode multiple: # proc ttk::treeview::select.choose.extended {w item cell} { BrowseTo $w $item $cell } proc ttk::treeview::select.toggle.extended {w item cell} { variable State if {$cell ne ""} { $w cellselection toggle [list $cell] set State(cellAnchor) $cell set State(cellAnchorOp) add } else { $w selection toggle [list $item] } } proc ttk::treeview::select.extend.extended {w item cell} { variable State if {$cell ne ""} { if {$State(cellAnchor) ne ""} { $w cellselection $State(cellAnchorOp) $State(cellAnchor) $cell } else { BrowseTo $w $item $cell } } else { if {[set anchor [$w focus]] ne ""} { $w selection set [between $w $anchor $item] } else { BrowseTo $w $item $cell } } } ### Tree structure utilities. # ## between $tv $item1 $item2 -- |
︙ | ︙ | |||
315 316 317 318 319 320 321 | # Recursive worker routine for ttk::treeview::between # proc ttk::treeview::ScanBetween {tv item1 item2 item} { variable between variable selectingBetween if {$item eq $item1 || $item eq $item2} { | | | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | # Recursive worker routine for ttk::treeview::between # proc ttk::treeview::ScanBetween {tv item1 item2 item} { variable between variable selectingBetween if {$item eq $item1 || $item eq $item2} { lappend between $item set selectingBetween [expr {!$selectingBetween}] } elseif {$selectingBetween} { lappend between $item } foreach child [$tv children $item] { ScanBetween $tv $item1 $item2 $child } } ### User interaction utilities. |
︙ | ︙ | |||
364 365 366 367 368 369 370 | } ## ToggleFocus -- toggle opened/closed state of focus item # proc ttk::treeview::ToggleFocus {w} { set item [$w focus] if {$item ne ""} { | | | > > > > > > > | > | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | } ## ToggleFocus -- toggle opened/closed state of focus item # proc ttk::treeview::ToggleFocus {w} { set item [$w focus] if {$item ne ""} { Toggle $w $item } } ## BrowseTo -- navigate to specified item; set focus and selection # proc ttk::treeview::BrowseTo {w item cell} { variable State $w see $item $w focus $item set State(cellAnchor) $cell set State(cellAnchorOp) set if {$cell ne ""} { $w cellselection set [list $cell] } else { $w selection set [list $item] } } #*EOF* |
Changes to library/ttk/utils.tcl.
︙ | ︙ | |||
69 70 71 72 73 74 75 | # Test if the widget can take keyboard focus. # # See the description of the -takefocus option in options(n) # for details. # proc ttk::takesFocus {w} { if {![winfo viewable $w]} { | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # Test if the widget can take keyboard focus. # # See the description of the -takefocus option in options(n) # for details. # proc ttk::takesFocus {w} { if {![winfo viewable $w]} { return 0 } elseif {[catch {$w cget -takefocus} takefocus]} { return [GuessTakeFocus $w] } else { switch -- $takefocus { "" { return [GuessTakeFocus $w] } 0 { return 0 } 1 { return 1 } |
︙ | ︙ | |||
140 141 142 143 144 145 146 | return } set restoreGrab [set restoreFocus ""] set grabbed [grab current $w] if {[winfo exists $grabbed]} { | | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | return } set restoreGrab [set restoreFocus ""] set grabbed [grab current $w] if {[winfo exists $grabbed]} { switch [grab status $grabbed] { global { set restoreGrab [list grab -global $grabbed] } local { set restoreGrab [list grab $grabbed] } none { ;# grab window is really in a different interp } } } set focus [focus] if {$focus ne ""} { set restoreFocus [list focus -force $focus] } set Grab($w) [list $restoreGrab $restoreFocus] } ## RestoreGrab -- # Restore previous grab and focus windows. |
︙ | ︙ | |||
232 233 234 235 236 237 238 | # Begin auto-repeat. # proc ttk::Repeatedly {args} { variable Repeat after cancel $Repeat(timer) set script [uplevel 1 [list namespace code $args]] set Repeat(script) $script | < > < > | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | # Begin auto-repeat. # proc ttk::Repeatedly {args} { variable Repeat after cancel $Repeat(timer) set script [uplevel 1 [list namespace code $args]] set Repeat(script) $script set Repeat(timer) [after $Repeat(delay) ttk::Repeat] uplevel #0 $script } ## Repeat -- # Continue auto-repeat # proc ttk::Repeat {} { variable Repeat set Repeat(timer) [after $Repeat(interval) ttk::Repeat] uplevel #0 $Repeat(script) } ## ttk::CancelRepeat -- # Halt auto-repeat. # proc ttk::CancelRepeat {} { variable Repeat |
︙ | ︙ | |||
276 277 278 279 280 281 282 | # MouseWheel scrolling is accelerated on X11, which is conventional # for Tk and appears to be conventional for other toolkits (although # Gtk+ and Qt do not appear to use as large a factor). # ## ttk::bindMouseWheel $bindtag $command... # Adds basic mousewheel support to $bindtag. | | | | | < | < < < < | | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | # MouseWheel scrolling is accelerated on X11, which is conventional # for Tk and appears to be conventional for other toolkits (although # Gtk+ and Qt do not appear to use as large a factor). # ## ttk::bindMouseWheel $bindtag $command... # Adds basic mousewheel support to $bindtag. # $command will be passed two additional arguments # specifying the mousewheel change and a factor. # proc ttk::bindMouseWheel {bindtag callback} { bind $bindtag <MouseWheel> "$callback %D -120.0" bind $bindtag <Option-MouseWheel> "$callback %D -12.0" } ## Mousewheel bindings for standard scrollable widgets. # bind TtkScrollable <MouseWheel> \ { tk::MouseWheel %W y %D -40.0 } bind TtkScrollable <Option-MouseWheel> \ { tk::MouseWheel %W y %D -12.0 } bind TtkScrollable <Shift-MouseWheel> \ { tk::MouseWheel %W x %D -40.0 } bind TtkScrollable <Shift-Option-MouseWheel> \ { tk::MouseWheel %W x %D -12.0 } #*EOF* |
Changes to library/ttk/vistaTheme.tcl.
︙ | ︙ | |||
41 42 43 44 45 46 47 | ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style map TNotebook.Tab \ -expand [list selected {2 2 2 2}] # Treeview: ttk::style configure Heading -font TkHeadingFont | | > > > | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style map TNotebook.Tab \ -expand [list selected {2 2 2 2}] # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Treeview -background SystemWindow \ -stripedbackground System3dLight ttk::style configure Treeview.Separator \ -background System3dLight ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText] # Label and Toolbutton ttk::style configure TLabelframe.Label -foreground SystemButtonText ttk::style configure Toolbutton -padding {4 4} |
︙ | ︙ | |||
87 88 89 90 91 92 93 | } } ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ -foreground [list \ disabled SystemGrayText \ | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | } } ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ -foreground [list \ disabled SystemGrayText \ {readonly focus} SystemHighlightText \ ] \ -focusfill [list {readonly focus} SystemHighlight] \ ; # Entry ttk::style configure TEntry -padding {1 1 1 1} ;# Needs lookup ttk::style element create Entry.field vsapi \ |
︙ | ︙ |
Changes to library/ttk/winTheme.tcl.
︙ | ︙ | |||
28 29 30 31 32 33 34 | ttk::style map TButton -relief {{!disabled pressed} sunken} ttk::style configure TEntry \ -padding 2 -selectborderwidth 0 -insertwidth 1 ttk::style map TEntry \ -fieldbackground \ | | | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ttk::style map TButton -relief {{!disabled pressed} sunken} ttk::style configure TEntry \ -padding 2 -selectborderwidth 0 -insertwidth 1 ttk::style map TEntry \ -fieldbackground \ [list readonly SystemButtonFace disabled SystemButtonFace] \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; ttk::style configure TCombobox -padding 2 ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ -fieldbackground [list \ readonly SystemButtonFace \ disabled SystemButtonFace] \ -foreground [list \ disabled SystemGrayText \ {readonly focus} SystemHighlightText \ ] \ -focusfill [list {readonly focus} SystemHighlight] \ ; ttk::style element create ComboboxPopdownFrame.border from default ttk::style configure ComboboxPopdownFrame \ -borderwidth 1 -relief solid |
︙ | ︙ | |||
67 68 69 70 71 72 73 | ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style configure TNotebook.Tab -padding {3 1} -borderwidth 1 ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised | | > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style configure TNotebook.Tab -padding {3 1} -borderwidth 1 ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow \ -stripedbackground System3dLight ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText] ttk::style configure TProgressbar \ -background SystemHighlight -borderwidth 0 ; } } |
Changes to library/ttk/xpTheme.tcl.
︙ | ︙ | |||
38 39 40 41 42 43 44 | ; ttk::style configure TCombobox -padding 2 ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ -foreground [list \ disabled SystemGrayText \ | | | > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | ; ttk::style configure TCombobox -padding 2 ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ -foreground [list \ disabled SystemGrayText \ {readonly focus} SystemHighlightText \ ] \ -focusfill [list {readonly focus} SystemHighlight] \ ; ttk::style configure TSpinbox -padding {2 0 14 0} ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; ttk::style configure Toolbutton -padding {4 4} # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow \ -stripedbackground System3dLight ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText]; } } |
Changes to library/xmfbox.tcl.
︙ | ︙ | |||
79 80 81 82 83 84 85 | proc ::tk::MotifFDialog_Create {dataName type argList} { upvar ::tk::dialog::file::$dataName data MotifFDialog_Config $dataName $type $argList if {$data(-parent) eq "."} { | | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | proc ::tk::MotifFDialog_Create {dataName type argList} { upvar ::tk::dialog::file::$dataName data MotifFDialog_Config $dataName $type $argList if {$data(-parent) eq "."} { set w .$dataName } else { set w $data(-parent).$dataName } # (re)create the dialog box if necessary # if {![winfo exists $w]} { MotifFDialog_BuildUI $w } elseif {[winfo class $w] ne "TkMotifFDialog"} { |
︙ | ︙ | |||
544 545 546 547 548 549 550 | # None. proc ::tk::MotifFDialog_Update {w} { upvar ::tk::dialog::file::[winfo name $w] data $data(fEnt) delete 0 end $data(fEnt) insert 0 \ | | | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | # None. proc ::tk::MotifFDialog_Update {w} { upvar ::tk::dialog::file::[winfo name $w] data $data(fEnt) delete 0 end $data(fEnt) insert 0 \ [::tk::dialog::file::JoinFile $data(selectPath) $data(filter)] $data(sEnt) delete 0 end $data(sEnt) insert 0 [::tk::dialog::file::JoinFile $data(selectPath) \ $data(selectFile)] MotifFDialog_LoadFiles $w } |
︙ | ︙ | |||
592 593 594 595 596 597 598 | set top 0 set dlist "" set flist "" foreach f [glob -nocomplain .* *] { if {[file isdir ./$f]} { lappend dlist $f } else { | | | | | | 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | set top 0 set dlist "" set flist "" foreach f [glob -nocomplain .* *] { if {[file isdir ./$f]} { lappend dlist $f } else { foreach pat $data(filter) { if {[string match $pat $f]} { if {[string match .* $f]} { incr top } lappend flist $f break } } } } eval [list $data(dList) insert end] [lsort -dictionary $dlist] eval [list $data(fList) insert end] [lsort -dictionary $flist] # The user probably doesn't want to see the . files. We adjust the view # so that the listbox displays all the non-dot files |
︙ | ︙ |
Added macosx/Credits.html.in.
> > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <!doctype htmL> <html> <head> </head> <body style="font-size:120%;font-family:Arial,sans-serif;"> <p> Tcl and Tk are distributed under a modified BSD license:<br> <a href="https://www.tcl-lang.org/software/tcltk/license.html"> https://www.tcl-lang.org/software/tcltk/license.html </a> </p> <ul style="list-style-type:none;"> <li>© 1987-@TK_YEAR@ Tcl Core Team and Contributers.</li> <li>© 2011-@TK_YEAR@ Kevin Walzer/WordTech Communications LLC.</li> <li>© 2014-@TK_YEAR@ Marc Culler.</li> <li>© 2002-2012 Daniel A. Steffen.</li> <li>© 2001-2009 Apple Inc.</li> <li>© 2001-2002 Jim Ingham & Ian Reid.</li> <li>© 1998-2000 Jim Ingham & Ray Johnson.</li> <li>© 1998-2000 Scriptics Inc.</li> <li>© 1996-1997 Sun Microsystems Inc.</li> </ul> </body> </html> |
Changes to macosx/GNUmakefile.
︙ | ︙ | |||
42 43 44 45 46 47 48 | INSTALL_MANPAGES ?= # set to non-empty value to build TkX11 instead of TkAqua: TK_X11 ?= # Checks and overrides for subframework builds ifeq (${SUBFRAMEWORK}_${TK_X11},1_) | < < < < < < | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | INSTALL_MANPAGES ?= # set to non-empty value to build TkX11 instead of TkAqua: TK_X11 ?= # Checks and overrides for subframework builds ifeq (${SUBFRAMEWORK}_${TK_X11},1_) override BUILD_DIR = ${DESTDIR}/build override INSTALL_PATH = /Frameworks endif #------------------------------------------------------------------------------------------------------- # meta targets |
︙ | ︙ | |||
141 142 143 144 145 146 147 | else override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-xft VERSION := ${VERSION}-X11 wish := ${wish}-X11 override EMBEDDED_BUILD := endif | | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | else override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-xft VERSION := ${VERSION}-X11 wish := ${wish}-X11 override EMBEDDED_BUILD := endif INSTALL_TARGETS = install-binaries install-libraries install-headers ifeq (${EMBEDDED_BUILD},) INSTALL_TARGETS += install-private-headers install-demos endif ifeq (${INSTALL_BUILD}_${EMBEDDED_BUILD}_${BUILD_STYLE},1__Deployment) INSTALL_TARGETS += html-tk ifneq (${INSTALL_MANPAGES},) INSTALL_TARGETS += install-doc endif endif |
︙ | ︙ | |||
189 190 191 192 193 194 195 | ${MAKE} install-${PROJECT} INSTALL_ROOT="${OBJ_DIR}/" ${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \ ${UNIX_DIR}/tkConfig.sh.in Tk-Info.plist.in Wish-Info.plist.in mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \ if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \ --prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \ | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | ${MAKE} install-${PROJECT} INSTALL_ROOT="${OBJ_DIR}/" ${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \ ${UNIX_DIR}/tkConfig.sh.in Tk-Info.plist.in Wish-Info.plist.in mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \ if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \ --prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \ --mandir="${MANDIR}" --enable-framework --disable-zipfs \ --with-tcl="${TCL_DIR}" \ ${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}; else ./config.status; fi ifneq (${VERSION},${TCL_VERSION}) @cd "${OBJ_DIR}" && sed -e 's#/Versions/${TCL_VERSION}#/Versions/${VERSION}#' \ tkConfig.sh > tkConfig.sh.1 && mv -f tkConfig.sh.1 tkConfig.sh endif |
︙ | ︙ |
Changes to macosx/README.
︙ | ︙ | |||
323 324 325 326 327 328 329 | other unix platform (indeed, the GNUmakefiles are just wrappers around the unix buildsystem). The macOS specific configure flags are --enable-aqua, --enable-framework and --disable-corefoundation (which disables CF and notably reverts to the standard select based notifier). Note that --enable-aqua is incompatible with --disable-corefoundation (for both Tcl and Tk configure). | | < < < < < | | | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | other unix platform (indeed, the GNUmakefiles are just wrappers around the unix buildsystem). The macOS specific configure flags are --enable-aqua, --enable-framework and --disable-corefoundation (which disables CF and notably reverts to the standard select based notifier). Note that --enable-aqua is incompatible with --disable-corefoundation (for both Tcl and Tk configure). - It was once possible to build with the Xcode IDE via the project in tk/macosx, but this has not been tested recently. Take care to use the project matching your DevTools and OS version: Tk.xcodeproj: for Xcode 3.2 on 10.6 These have the following targets: Tk: calls through to tk/macosx/GNUMakefile, requires a corresponding build of the Tcl target of tcl/macosx/Tcl.xcode. tktest: static build of TkAqua tktest for debugging. tktest-X11: static build of TkX11 tktest for debugging. The following build configurations are available: Debug: debug build for the active architecture, with Fix & Continue enabled. Debug clang: use clang compiler. Debug llvm-gcc: use llvm-gcc compiler. Debug gcc40: use gcc 4.0 compiler. DebugNoGC: disable Objective-C garbage collection. DebugNoFixAndContinue: disable Fix & Continue. DebugNoCF: disable corefoundation (X11 only). DebugMemCompile: enable memory and bytecode debugging. DebugLeaks: define PURIFY. DebugGCov: enable generation of gcov data files. Release: release build for the active architecture. ReleaseUniversal: 32/64-bit universal build. ReleaseUniversal clang: use clang compiler. ReleaseUniversal llvm-gcc: use llvm-gcc compiler. ReleaseUniversal gcc40: use gcc 4.0 compiler. ReleaseUniversal10.5SDK: build against the 10.5 SDK (with 10.5 deployment target). Note that the non-SDK configurations have their deployment target set to 10.6 (Tk.xcodeproj). The Xcode projects refer to the toplevel tcl and tk source directories via the the TCL_SRCROOT and TK_SRCROOT user build settings, by default these are set to the project-relative paths '../../tcl' and '../../tk', if your source directories are named differently, e.g. '../../tcl8.7' and '../../tk8.7', you need to manually change the TCL_SRCROOT and TK_SRCROOT settings by editing your ${USER}.pbxuser file (located inside the Tk.xcodeproj bundle directory) with a text editor. - To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable to the minimal OS version the binaries should be able to run on, e.g: export MACOSX_DEPLOYMENT_TARGET=10.6 |
︙ | ︙ | |||
387 388 389 390 391 392 393 | [ create the following symbolic link for the build to work as setup by default ] [ ln -fs /path_to_tcl/build /path_to_tk/build ] [ (where /path_to_{tcl,tk} is the directory containing the tcl resp. tk tree) ] [ or you can pass an argument of BUILD_DIR=/somewhere to the tcl and tk make. ] - The following instructions assume the Tcl and Tk source trees are named "tcl${ver}" and "tk${ver}" (where ${ver} is a shell variable containing the | | | < < | | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | [ create the following symbolic link for the build to work as setup by default ] [ ln -fs /path_to_tcl/build /path_to_tk/build ] [ (where /path_to_{tcl,tk} is the directory containing the tcl resp. tk tree) ] [ or you can pass an argument of BUILD_DIR=/somewhere to the tcl and tk make. ] - The following instructions assume the Tcl and Tk source trees are named "tcl${ver}" and "tk${ver}" (where ${ver} is a shell variable containing the Tcl/Tk version number, e.g. '8.7'). Setup this shell variable as follows: ver="8.7" - Setup environment variables as desired, e.g. for a universal build on 10.5: CFLAGS="-arch x86_64 -arch arm64e -mmacosx-version-min=10.5" export CFLAGS - Change to the directory containing the Tcl and Tk source trees and build: make -C tcl${ver}/macosx make -C tk${ver}/macosx - Install Tcl and Tk onto the root volume (admin password required): |
︙ | ︙ | |||
462 463 464 465 466 467 468 | - To build a Tcl.framework and Tk.framework for use as subframeworks in another framework, use the install-embedded target and set SUBFRAMEWORK=1. Set the DYLIB_INSTALL_DIR variable to the path which should be the install_name path of the shared library and set the DESTDIR variable to the pathname of a staging directory where the frameworks will be written. The Tcl framework must be built first. For example, running the commands: | | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | - To build a Tcl.framework and Tk.framework for use as subframeworks in another framework, use the install-embedded target and set SUBFRAMEWORK=1. Set the DYLIB_INSTALL_DIR variable to the path which should be the install_name path of the shared library and set the DESTDIR variable to the pathname of a staging directory where the frameworks will be written. The Tcl framework must be built first. For example, running the commands: make -C ../tcl8.7/macosx install-embedded SUBFRAMEWORK=1 DESTDIR=/tmp/tcltk \ DYLIB_INSTALL_DIR=/Library/Frameworks/Some.framework/Versions/X.Y/Frameworks/Tcl.framework make -C macosx install-embedded SUBFRAMEWORK=1 DESTDIR=/tmp/tcltk \ DYLIB_INSTALL_DIR=/Library/Frameworks/Some.framework/Versions/X.Y/Frameworks/Tk.framework will produce a Tcl.framework and a Tk.framework usable as subframeworks of Some.framework. The frameworks will be found in /tmp/tcltk/Frameworks/ 5. Details regarding the macOS port of Tk. |
︙ | ︙ | |||
548 549 550 551 552 553 554 | starting the event loop. Since the CheckProc function gets called for every Tk event, it is an appropriate place to drain the main NSAutoreleasePool and replace it with a new pool. This is done by calling the method [NSApp _resetAutoreleasePool], where _resetAutoreleasePool is a method which we define for the subclass. Unfortunately, by itself this is not | | | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | starting the event loop. Since the CheckProc function gets called for every Tk event, it is an appropriate place to drain the main NSAutoreleasePool and replace it with a new pool. This is done by calling the method [NSApp _resetAutoreleasePool], where _resetAutoreleasePool is a method which we define for the subclass. Unfortunately, by itself this is not sufficient for safe memory management because, as was made painfully evident with the release of OS X 10.13, it is possible for calls to TclDoOneEvent, and hence to CheckProc, to be nested. Draining the autorelease pool in a nested call leads to crashes as objects in use by the outer call can get freed by the inner call and then reused later. One particular situation where this happens is when a modal dialogue gets posted by a Tk Application. To address this, the NSApp object also implements a semaphore to prevent draining the autorelease pool |
︙ | ︙ | |||
681 682 683 684 685 686 687 | conditional code which is only used for macOS. 6.0 Virtual events on macOS 10.14 and later ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The 10.14 release added support for system appearance changes, including a "Dark Mode" that renders all window frames and menus in | | | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | conditional code which is only used for macOS. 6.0 Virtual events on macOS 10.14 and later ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The 10.14 release added support for system appearance changes, including a "Dark Mode" that renders all window frames and menus in dark colors. Tk 8.7 provides three virtual events <<LightAqua>>, <<DarkAqua>> and <<AppearanceChanged>>, to allow you to update your Tk app's appearance when the system appearance changes. These events are generated in [NSView effectiveAppearanceChanged], which is called by the Apple window manager when the General Preferences is changed either by switching between Light Mode and Dark Mode or by changing the Accent Color or Highlight Color. |
︙ | ︙ |
Changes to macosx/Tk-Common.xcconfig.
︙ | ︙ | |||
29 30 31 32 33 34 35 | BINDIR = $(PREFIX)/bin CFLAGS = $(CFLAGS) CPPFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) $(CPPFLAGS) FRAMEWORK_INSTALL_PATH = /Library/Frameworks INCLUDEDIR = $(PREFIX)/include LIBDIR = $(PREFIX)/lib MANDIR = $(PREFIX)/man | < | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | BINDIR = $(PREFIX)/bin CFLAGS = $(CFLAGS) CPPFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) $(CPPFLAGS) FRAMEWORK_INSTALL_PATH = /Library/Frameworks INCLUDEDIR = $(PREFIX)/include LIBDIR = $(PREFIX)/lib MANDIR = $(PREFIX)/man PREFIX = /usr/local TCL_BUILD_DIR = $(OBJROOT)/../tcl/Tcl.build/$(CONFIGURATION)/Tcl.build/Objects TCL_CONFIGURE_ARGS = --enable-dtrace TCL_FRAMEWORK_DIR = $(SYMROOT)/../tcl/$(CONFIGURATION) TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION) TCL_PACKAGE_PATH = "$(LIBDIR)" TCL_DEFS = HAVE_TCL_CONFIG_H TK_LIBRARY = $(LIBDIR)/tk$(VERSION) TK_DEFS = HAVE_TK_CONFIG_H VERSION = 8.7 |
Changes to macosx/Tk-Release.xcconfig.
︙ | ︙ | |||
9 10 11 12 13 14 15 | // See the file "license.terms" for information on usage and redistribution // of this file, and for a DISCLAIMER OF ALL WARRANTIES. #include "Tk-Common.xcconfig" DEBUG_INFORMATION_FORMAT = dwarf-with-dsym // DEPLOYMENT_POSTPROCESSING = YES | | | 9 10 11 12 13 14 15 16 17 18 19 | // See the file "license.terms" for information on usage and redistribution // of this file, and for a DISCLAIMER OF ALL WARRANTIES. #include "Tk-Common.xcconfig" DEBUG_INFORMATION_FORMAT = dwarf-with-dsym // DEPLOYMENT_POSTPROCESSING = YES GCC_OPTIMIZATION_LEVEL = 2 GCC_PREPROCESSOR_DEFINITIONS = NDEBUG $(TCL_DEFS) $(TK_DEFS) $(GCC_PREPROCESSOR_DEFINITIONS) CONFIGURE_ARGS = --disable-symbols $(TCL_CONFIGURE_ARGS) $(CONFIGURE_ARGS) MAKE_TARGET = deploy |
Deleted macosx/Tk.xcode/default.pbxuser.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted macosx/Tk.xcode/project.pbxproj.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to macosx/Tk.xcodeproj/project.pbxproj.
︙ | ︙ | |||
4745 4746 4747 4748 4749 4750 4751 | }; name = ReleaseUniversal; }; F91BCC51093152310042A6BF /* ReleaseUniversal */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { | | | | 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 | }; name = ReleaseUniversal; }; F91BCC51093152310042A6BF /* ReleaseUniversal */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_INPUT_FILETYPE = sourcecode.c.objc; MACOSX_DEPLOYMENT_TARGET = 10.6; PREBINDING = NO; }; |
︙ | ︙ | |||
5057 5058 5059 5060 5061 5062 5063 | PRODUCT_NAME = "tktest-X11"; }; name = DebugNoFixAndContinue; }; F97258AC0A86873D00096C78 /* ReleaseUniversal */ = { isa = XCBuildConfiguration; buildSettings = { | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 | PRODUCT_NAME = "tktest-X11"; }; name = DebugNoFixAndContinue; }; F97258AC0A86873D00096C78 /* ReleaseUniversal */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, /usr/X11R6/include/freetype2, "$(HEADER_SEARCH_PATHS)", ); LIBRARY_SEARCH_PATHS = ( /usr/X11R6/lib, "$(LIBRARY_SEARCH_PATHS)", ); PRODUCT_NAME = "tktest-X11"; }; name = ReleaseUniversal; }; F987512F0DE7B57E00B1C9EC /* DebugNoCF */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Tk-Debug.xcconfig */; buildSettings = { ARCHS = ( "$(NATIVE_ARCH_64_BIT)", "$(NATIVE_ARCH_32_BIT)", |
︙ | ︙ | |||
5183 5184 5185 5186 5187 5188 5189 | /usr/X11R6/lib, "$(LIBRARY_SEARCH_PATHS)", ); PRODUCT_NAME = "tktest-X11"; }; name = DebugNoCF; }; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 | /usr/X11R6/lib, "$(LIBRARY_SEARCH_PATHS)", ); PRODUCT_NAME = "tktest-X11"; }; name = DebugNoCF; }; F9988AB10D814C6500B6B03B /* Debug gcc40 */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Tk-Debug.xcconfig */; buildSettings = { ARCHS = ( "$(NATIVE_ARCH_64_BIT)", "$(NATIVE_ARCH_32_BIT)", |
︙ | ︙ | |||
5390 5391 5392 5393 5394 5395 5396 | }; name = "Debug llvm-gcc"; }; F9988BB10D81586D00B6B03B /* ReleaseUniversal gcc40 */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { | | | | 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 | }; name = "Debug llvm-gcc"; }; F9988BB10D81586D00B6B03B /* ReleaseUniversal gcc40 */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_INPUT_FILETYPE = sourcecode.c.objc; GCC_VERSION = 4.0; MACOSX_DEPLOYMENT_TARGET = 10.6; PREBINDING = NO; |
︙ | ︙ | |||
5424 5425 5426 5427 5428 5429 5430 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal gcc40"; }; F9988BB40D81586D00B6B03B /* ReleaseUniversal gcc40 */ = { isa = XCBuildConfiguration; buildSettings = { | | | | | | 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal gcc40"; }; F9988BB40D81586D00B6B03B /* ReleaseUniversal gcc40 */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, /usr/X11R6/include/freetype2, "$(HEADER_SEARCH_PATHS)", ); LIBRARY_SEARCH_PATHS = ( /usr/X11R6/lib, "$(LIBRARY_SEARCH_PATHS)", ); PRODUCT_NAME = "tktest-X11"; }; name = "ReleaseUniversal gcc40"; }; F9988BB50D81587400B6B03B /* ReleaseUniversal llvm-gcc */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; DEBUG_INFORMATION_FORMAT = dwarf; GCC = "llvm-gcc"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_INPUT_FILETYPE = sourcecode.c.objc; GCC_OPTIMIZATION_LEVEL = 4; |
︙ | ︙ | |||
5482 5483 5484 5485 5486 5487 5488 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal llvm-gcc"; }; F9988BB80D81587400B6B03B /* ReleaseUniversal llvm-gcc */ = { isa = XCBuildConfiguration; buildSettings = { | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal llvm-gcc"; }; F9988BB80D81587400B6B03B /* ReleaseUniversal llvm-gcc */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, /usr/X11R6/include/freetype2, "$(HEADER_SEARCH_PATHS)", ); LIBRARY_SEARCH_PATHS = ( /usr/X11R6/lib, "$(LIBRARY_SEARCH_PATHS)", ); PRODUCT_NAME = "tktest-X11"; }; name = "ReleaseUniversal llvm-gcc"; }; F99EE73C0BE835310060D4AF /* DebugLeaks */ = { isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = Wish; SKIP_INSTALL = NO; }; name = DebugLeaks; }; F99EE73E0BE835310060D4AF /* DebugLeaks */ = { isa = XCBuildConfiguration; buildSettings = { OTHER_LDFLAGS = ( "$(OTHER_LDFLAGS_AQUA)", "$(OTHER_LDFLAGS)", ); PRODUCT_NAME = tktest; }; name = DebugLeaks; }; F99EE7400BE835310060D4AF /* DebugLeaks */ = { isa = XCBuildConfiguration; buildSettings = { GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, /usr/X11R6/include/freetype2, "$(HEADER_SEARCH_PATHS)", ); LIBRARY_SEARCH_PATHS = ( /usr/X11R6/lib, "$(LIBRARY_SEARCH_PATHS)", ); PRODUCT_NAME = "tktest-X11"; }; name = DebugLeaks; }; F99EE7420BE835310060D4AF /* DebugLeaks */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Tk-Debug.xcconfig */; buildSettings = { ARCHS = ( "$(NATIVE_ARCH_64_BIT)", ); CPPFLAGS = "-arch $(CURRENT_ARCH) $(CPPFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = unsupported; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_INPUT_FILETYPE = sourcecode.c.objc; GCC_PREPROCESSOR_DEFINITIONS = ( |
︙ | ︙ | |||
5692 5693 5694 5695 5696 5697 5698 | }; F9A9D1F30FC77799002A2BE3 /* ReleaseUniversal clang */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { ARCHS = ( "$(NATIVE_ARCH_64_BIT)", | < | | 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 | }; F9A9D1F30FC77799002A2BE3 /* ReleaseUniversal clang */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { ARCHS = ( "$(NATIVE_ARCH_64_BIT)", ); CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; DEBUG_INFORMATION_FORMAT = dwarf; GCC = clang; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_INPUT_FILETYPE = sourcecode.c.objc; GCC_OPTIMIZATION_LEVEL = 4; |
︙ | ︙ | |||
5730 5731 5732 5733 5734 5735 5736 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal clang"; }; F9A9D1F60FC77799002A2BE3 /* ReleaseUniversal clang */ = { isa = XCBuildConfiguration; buildSettings = { | | | | 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal clang"; }; F9A9D1F60FC77799002A2BE3 /* ReleaseUniversal clang */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, /usr/X11R6/include/freetype2, "$(HEADER_SEARCH_PATHS)", ); LIBRARY_SEARCH_PATHS = ( /usr/X11R6/lib, |
︙ | ︙ | |||
5767 5768 5769 5770 5771 5772 5773 | PRODUCT_NAME = tktest; }; name = ReleaseUniversal10.5SDK; }; F9EEED980C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = { isa = XCBuildConfiguration; buildSettings = { | | | | | | 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 | PRODUCT_NAME = tktest; }; name = ReleaseUniversal10.5SDK; }; F9EEED980C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, /usr/X11R6/include/freetype2, "$(HEADER_SEARCH_PATHS)", ); LIBRARY_SEARCH_PATHS = ( /usr/X11R6/lib, "$(LIBRARY_SEARCH_PATHS)", ); PRODUCT_NAME = "tktest-X11"; }; name = ReleaseUniversal10.5SDK; }; F9EEED990C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; CPPFLAGS = "-isysroot $(SDKROOT) $(CPPFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_INPUT_FILETYPE = sourcecode.c.objc; MACOSX_DEPLOYMENT_TARGET = 10.5; PREBINDING = NO; |
︙ | ︙ | |||
5812 5813 5814 5815 5816 5817 5818 | buildConfigurations = ( F95CC8AC09158F3100EA5ACE /* Debug */, F9A9D1F00FC77787002A2BE3 /* Debug clang */, F9988AB60D814C7500B6B03B /* Debug llvm-gcc */, F9988AB20D814C6500B6B03B /* Debug gcc40 */, F90E36D60F3B5C8400810A10 /* DebugNoGC */, F95CC8AE09158F3100EA5ACE /* DebugNoFixAndContinue */, | < < < < < < < < < < < < | 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 | buildConfigurations = ( F95CC8AC09158F3100EA5ACE /* Debug */, F9A9D1F00FC77787002A2BE3 /* Debug clang */, F9988AB60D814C7500B6B03B /* Debug llvm-gcc */, F9988AB20D814C6500B6B03B /* Debug gcc40 */, F90E36D60F3B5C8400810A10 /* DebugNoGC */, F95CC8AE09158F3100EA5ACE /* DebugNoFixAndContinue */, F98751300DE7B57E00B1C9EC /* DebugNoCF */, F93084370BB93D2800CD0B9E /* DebugMemCompile */, F99EE73C0BE835310060D4AF /* DebugLeaks */, F9359B260DF212DA00E04F67 /* DebugGCov */, F95CC8AD09158F3100EA5ACE /* Release */, F91BCC4F093152310042A6BF /* ReleaseUniversal */, F9A9D1F40FC77799002A2BE3 /* ReleaseUniversal clang */, F9988BB60D81587400B6B03B /* ReleaseUniversal llvm-gcc */, F9988BB20D81586D00B6B03B /* ReleaseUniversal gcc40 */, F9EEED960C2FEFD300396116 /* ReleaseUniversal10.5SDK */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; F95CC8B009158F3100EA5ACE /* Build configuration list for PBXNativeTarget "tktest" */ = { isa = XCConfigurationList; buildConfigurations = ( F95CC8B109158F3100EA5ACE /* Debug */, F9A9D1F10FC77787002A2BE3 /* Debug clang */, F9988AB70D814C7500B6B03B /* Debug llvm-gcc */, F9988AB30D814C6500B6B03B /* Debug gcc40 */, F90E36D70F3B5C8400810A10 /* DebugNoGC */, F95CC8B309158F3100EA5ACE /* DebugNoFixAndContinue */, F98751310DE7B57E00B1C9EC /* DebugNoCF */, F93084380BB93D2800CD0B9E /* DebugMemCompile */, F99EE73E0BE835310060D4AF /* DebugLeaks */, F9359B270DF212DA00E04F67 /* DebugGCov */, F95CC8B209158F3100EA5ACE /* Release */, F91BCC50093152310042A6BF /* ReleaseUniversal */, F9A9D1F50FC77799002A2BE3 /* ReleaseUniversal clang */, F9988BB70D81587400B6B03B /* ReleaseUniversal llvm-gcc */, F9988BB30D81586D00B6B03B /* ReleaseUniversal gcc40 */, F9EEED970C2FEFD300396116 /* ReleaseUniversal10.5SDK */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; F95CC8B509158F3100EA5ACE /* Build configuration list for PBXProject "Tk" */ = { isa = XCConfigurationList; buildConfigurations = ( F95CC8B609158F3100EA5ACE /* Debug */, F9A9D1EF0FC77787002A2BE3 /* Debug clang */, F9988AB50D814C7500B6B03B /* Debug llvm-gcc */, F9988AB10D814C6500B6B03B /* Debug gcc40 */, F90E36D50F3B5C8400810A10 /* DebugNoGC */, F95CC8B809158F3100EA5ACE /* DebugNoFixAndContinue */, F987512F0DE7B57E00B1C9EC /* DebugNoCF */, F930843A0BB93D2800CD0B9E /* DebugMemCompile */, F99EE7420BE835310060D4AF /* DebugLeaks */, F9359B250DF212DA00E04F67 /* DebugGCov */, F95CC8B709158F3100EA5ACE /* Release */, F91BCC51093152310042A6BF /* ReleaseUniversal */, F9A9D1F30FC77799002A2BE3 /* ReleaseUniversal clang */, F9988BB50D81587400B6B03B /* ReleaseUniversal llvm-gcc */, F9988BB10D81586D00B6B03B /* ReleaseUniversal gcc40 */, F9EEED990C2FEFD300396116 /* ReleaseUniversal10.5SDK */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; F97258A80A86873D00096C78 /* Build configuration list for PBXNativeTarget "tktest-X11" */ = { isa = XCConfigurationList; buildConfigurations = ( F97258A90A86873D00096C78 /* Debug */, F9A9D1F20FC77787002A2BE3 /* Debug clang */, F9988AB80D814C7500B6B03B /* Debug llvm-gcc */, F9988AB40D814C6500B6B03B /* Debug gcc40 */, F90E36D80F3B5C8400810A10 /* DebugNoGC */, F97258AB0A86873D00096C78 /* DebugNoFixAndContinue */, F98751320DE7B57E00B1C9EC /* DebugNoCF */, F93084390BB93D2800CD0B9E /* DebugMemCompile */, F99EE7400BE835310060D4AF /* DebugLeaks */, F9359B280DF212DA00E04F67 /* DebugGCov */, F97258AA0A86873D00096C78 /* Release */, F97258AC0A86873D00096C78 /* ReleaseUniversal */, F9A9D1F60FC77799002A2BE3 /* ReleaseUniversal clang */, F9988BB80D81587400B6B03B /* ReleaseUniversal llvm-gcc */, F9988BB40D81586D00B6B03B /* ReleaseUniversal gcc40 */, F9EEED980C2FEFD300396116 /* ReleaseUniversal10.5SDK */, ); |
︙ | ︙ |
Changes to macosx/tkMacOSXBitmap.c.
1 2 3 4 5 | /* * tkMacOSXBitmap.c -- * * This file handles the implementation of native bitmaps. * | | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /* * tkMacOSXBitmap.c -- * * This file handles the implementation of native bitmaps. * * Copyright © 1996-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXConstants.h" /* * This structure holds information about native bitmaps. */ typedef struct { const char *name; /* Name of icon. */ OSType iconType; /* OSType of icon. */ |
︙ | ︙ | |||
45 46 47 48 49 50 51 | {"note", kAlertNoteIcon}, {"caution", kAlertCautionIcon}, {NULL, 0} }; #define builtInIconSize 32 | | | | | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | {"note", kAlertNoteIcon}, {"caution", kAlertCautionIcon}, {NULL, 0} }; #define builtInIconSize 32 #define OSTYPE_TO_UTI(x) ((NSString *)UTTypeCreatePreferredIdentifierForTag( \ kUTTagClassOSType, UTCreateStringForOSType(x), nil)) static Tcl_HashTable iconBitmapTable = {}; typedef struct { int kind, width, height; char *value; } IconBitmap; static const char *const iconBitmapOptionStrings[] = { "-file", "-fileType", "-imageFile", "-namedImage", "-osType", "-systemType", NULL }; enum iconBitmapOptions { ICON_FILE, ICON_FILETYPE, ICON_IMAGEFILE, ICON_NAMEDIMAGE, ICON_OSTYPE, ICON_SYSTEMTYPE }; /* *---------------------------------------------------------------------- * * TkpDefineNativeBitmaps -- |
︙ | ︙ | |||
170 171 172 173 174 175 176 | */ Pixmap TkpCreateNativeBitmap( Display *display, const void *source) /* Info about the icon to build. */ { | | | < | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | */ Pixmap TkpCreateNativeBitmap( Display *display, const void *source) /* Info about the icon to build. */ { NSString *filetype = [NSString stringWithUTF8String:(char *)source]; NSImage *iconImage = TkMacOSXIconForFileType(filetype); CGSize size = CGSizeMake(builtInIconSize, builtInIconSize); Pixmap pixmap = PixmapFromImage(display, iconImage, size); return pixmap; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
201 202 203 204 205 206 207 | static int OSTypeFromString(const char *s, OSType *t) { int result = TCL_ERROR; Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | static int OSTypeFromString(const char *s, OSType *t) { int result = TCL_ERROR; Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); (void)Tcl_UtfToExternalDStringEx(encoding, s, -1, TCL_ENCODING_NOCOMPLAIN, &ds); if (Tcl_DStringLength(&ds) <= 4) { char string[4] = {}; memcpy(string, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); *t = (OSType) string[0] << 24 | (OSType) string[1] << 16 | (OSType) string[2] << 8 | (OSType) string[3]; result = TCL_OK; } |
︙ | ︙ | |||
249 250 251 252 253 254 255 | int *height) { Tcl_HashEntry *hPtr; Pixmap pixmap = None; NSString *string; NSImage *image = nil; NSSize size = { .width = builtInIconSize, .height = builtInIconSize }; | < | | | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | int *height) { Tcl_HashEntry *hPtr; Pixmap pixmap = None; NSString *string; NSImage *image = nil; NSSize size = { .width = builtInIconSize, .height = builtInIconSize }; if (iconBitmapTable.buckets && (hPtr = Tcl_FindHashEntry(&iconBitmapTable, name))) { OSType type; IconBitmap *iconBitmap = (IconBitmap *)Tcl_GetHashValue(hPtr); name = NULL; size = NSMakeSize(iconBitmap->width, iconBitmap->height); switch (iconBitmap->kind) { case ICON_FILE: string = [[NSString stringWithUTF8String:iconBitmap->value] stringByExpandingTildeInPath]; image = [[NSWorkspace sharedWorkspace] iconForFile:string]; break; case ICON_FILETYPE: string = [NSString stringWithUTF8String:iconBitmap->value]; image = TkMacOSXIconForFileType(string); break; case ICON_OSTYPE: if (OSTypeFromString(iconBitmap->value, &type) == TCL_OK) { string = [NSString stringWithUTF8String:iconBitmap->value]; image = TkMacOSXIconForFileType(string); } break; case ICON_SYSTEMTYPE: name = iconBitmap->value; break; case ICON_NAMEDIMAGE: string = [NSString stringWithUTF8String:iconBitmap->value]; |
︙ | ︙ | |||
308 309 310 311 312 313 314 315 316 | } } if (image) { *width = size.width; *height = size.height; pixmap = PixmapFromImage(display, image, NSSizeToCGSize(size)); } else if (name) { OSType iconType; if (OSTypeFromString(name, &iconType) == TCL_OK) { | > > > > > | | < | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | } } if (image) { *width = size.width; *height = size.height; pixmap = PixmapFromImage(display, image, NSSizeToCGSize(size)); } else if (name) { /* * As a last resort, try to interpret the name as an OSType. * It would probably be better to just return None at this * point. */ OSType iconType; if (OSTypeFromString(name, &iconType) == TCL_OK) { NSString *iconUTI = TkMacOSXOSTypeToUTI(iconType); NSImage *iconImage = TkMacOSXIconForFileType(iconUTI); pixmap = PixmapFromImage(display, iconImage, NSSizeToCGSize(size)); } } return pixmap; } /* |
︙ | ︙ | |||
380 381 382 383 384 385 386 | goto end; } #if 0 if ((kind == ICON_TYPE || kind == ICON_SYSTEM)) { Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); | | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | goto end; } #if 0 if ((kind == ICON_TYPE || kind == ICON_SYSTEM)) { Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); (void)Tcl_UtfToExternalDStringEx(encoding, value, -1, TCL_ENCODING_NOCOMPLAIN, &ds); len = Tcl_DStringLength(&ds); Tcl_DStringFree(&ds); Tcl_FreeEncoding(encoding); if (len > 4) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid bitmap value", -1)); Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "INVALID", NULL); goto end; } } #endif ib.value = (char *)ckalloc(len + 1); strcpy(ib.value, value); if (!iconBitmapTable.buckets) { Tcl_InitHashTable(&iconBitmapTable, TCL_STRING_KEYS); } hPtr = Tcl_CreateHashEntry(&iconBitmapTable, name, &isNew); if (!isNew) { iconBitmap = (IconBitmap *)Tcl_GetHashValue(hPtr); ckfree(iconBitmap->value); } else { iconBitmap = (IconBitmap *)ckalloc(sizeof(IconBitmap)); Tcl_SetHashValue(hPtr, iconBitmap); } *iconBitmap = ib; result = TCL_OK; |
︙ | ︙ |
Changes to macosx/tkMacOSXButton.c.
1 2 3 4 5 6 | /* * tkMacOSXButton.c -- * * This file implements the Macintosh specific portion of the button * widgets. * | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tkMacOSXButton.c -- * * This file implements the Macintosh specific portion of the button * widgets. * * Copyright © 1996-1997 Sun Microsystems, Inc. * Copyright © 2001 Apple Computer, Inc. * Copyright © 2006-2007 Daniel A. Steffen <[email protected]> * Copyright © 2007 Revar Desmera. * Copyright © 2015 Kevin Walzer/WordTech Communications LLC. * Copyright © 2015 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * */ #include "tkMacOSXPrivate.h" |
︙ | ︙ | |||
177 178 179 180 181 182 183 | *---------------------------------------------------------------------- */ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { | | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | *---------------------------------------------------------------------- */ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { MacButton *macButtonPtr = (MacButton *)clientData; TkButton *butPtr = (TkButton *)clientData; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; DrawParams* dpPtr = &macButtonPtr->drawParams; int needhighlight = 0; butPtr->flags &= ~REDRAW_PENDING; if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { |
︙ | ︙ | |||
761 762 763 764 765 766 767 | /* * To avoid buttons with white text on a white background, we set the * state to inactive in Dark Mode unless the button is pressed or is a * -default active button. This isn't perfect but it is mostly usable. * Using a ttk::button would be a much better choice, however. */ | > | | | | > | 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | /* * To avoid buttons with white text on a white background, we set the * state to inactive in Dark Mode unless the button is pressed or is a * -default active button. This isn't perfect but it is mostly usable. * Using a ttk::button would be a much better choice, however. */ if ([NSApp macOSVersion] < 101500) { if (TkMacOSXInDarkMode(butPtr->tkwin) && mbPtr->drawinfo.state != kThemeStatePressed && !(mbPtr->drawinfo.adornment & kThemeAdornmentDefault)) { hiinfo.state = kThemeStateInactive; } } HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, kHIThemeOrientationNormal, &contHIRec); TkMacOSXRestoreDrawingContext(&dc); ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo, (MacButton *) mbPtr, 32, true); |
︙ | ︙ | |||
897 898 899 900 901 902 903 | */ static void ButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { | | | | 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | */ static void ButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkButton *buttonPtr = (TkButton *)clientData; MacButton *mbPtr = (MacButton *)clientData; if (eventPtr->type == ActivateNotify || eventPtr->type == DeactivateNotify) { if ((buttonPtr->tkwin == NULL) || (!Tk_IsMapped(buttonPtr->tkwin))) { return; } if (eventPtr->type == ActivateNotify) { |
︙ | ︙ | |||
953 954 955 956 957 958 959 | *btnkind = kThemeBevelButton; } else if (butPtr->borderWidth == 4) { *btnkind = kThemeRoundedBevelButton; } else { *btnkind = kThemePushButton; } | | | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | *btnkind = kThemeBevelButton; } else if (butPtr->borderWidth == 4) { *btnkind = kThemeRoundedBevelButton; } else { *btnkind = kThemePushButton; } if ((butPtr->image == NULL) && (butPtr->bitmap == None)) { switch (butPtr->type) { case TYPE_BUTTON: *btnkind = kThemePushButton; break; case TYPE_RADIO_BUTTON: if (butPtr->borderWidth <= 1) { *btnkind = kThemeSmallRadioButton; |
︙ | ︙ | |||
1170 1171 1172 1173 1174 1175 1176 | * *-------------------------------------------------------------- */ static void PulseDefaultButtonProc(ClientData clientData) { | | | 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | * *-------------------------------------------------------------- */ static void PulseDefaultButtonProc(ClientData clientData) { MacButton *mbPtr = (MacButton *)clientData; TkpDisplayButton(clientData); /* * Fix 40ada90762: any idle calls to TkpDisplayButton need to be canceled * in case the button is destroyed and has its data freed before the idle * event is handled (DestroyButton only cancels calls when REDRAW_PENDING * is set, which is not the case after calling TkpDisplayButton directly). |
︙ | ︙ |
Changes to macosx/tkMacOSXClipboard.c.
1 2 3 4 5 | /* * tkMacOSXClipboard.c -- * * This file manages the clipboard for the Tk toolkit. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXClipboard.c -- * * This file manages the clipboard for the Tk toolkit. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXConstants.h" |
︙ | ︙ | |||
133 134 135 136 137 138 139 | NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObject: NSStringPboardType]]; if (type) { string = [pb stringForType:type]; } if (string) { | < | < < < < < | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObject: NSStringPboardType]]; if (type) { string = [pb stringForType:type]; } if (string) { result = proc(clientData, interp, string.UTF8String); } } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s selection doesn't exist or form \"%s\" not defined", Tk_GetAtomName(tkwin, selection), Tk_GetAtomName(tkwin, target))); Tcl_SetErrorCode(interp, "TK", "SELECTION", "EXISTS", NULL); |
︙ | ︙ |
Changes to macosx/tkMacOSXColor.c.
1 2 3 4 5 6 7 | /* * TkMacOSXColor.c -- * * This file maintains a database of color values for the Tk * toolkit, in order to avoid round-trips to the server to * map color names to pixel values. * | | | | | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | /* * TkMacOSXColor.c -- * * This file maintains a database of color values for the Tk * toolkit, in order to avoid round-trips to the server to * map color names to pixel values. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1996 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2020 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkColor.h" #include "tkMacOSXColor.h" static Tcl_HashTable systemColors; static int numSystemColors; static int rgbColorIndex; static int controlAccentIndex; static int selectedTabTextIndex; static int pressedButtonTextIndex; static Bool useFakeAccentColor = NO; static SystemColorDatum **systemColorIndex; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 static NSAppearance *lightAqua = nil; static NSAppearance *darkAqua = nil; #endif static NSColorSpace* sRGB = NULL; static const CGFloat WINDOWBACKGROUND[4] = {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0}; void initColorTable() { NSAutoreleasePool *pool = [NSAutoreleasePool new]; |
︙ | ︙ | |||
63 64 65 66 67 68 69 | NSString *colorName = [[NSString alloc] initWithCString:entry->macName encoding:NSUTF8StringEncoding]; SEL colorSelector = NSSelectorFromString(colorName); if (![NSColor respondsToSelector:colorSelector]) { if ([colorName isEqualToString:@"controlAccentColor"]) { useFakeAccentColor = YES; | | > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | NSString *colorName = [[NSString alloc] initWithCString:entry->macName encoding:NSUTF8StringEncoding]; SEL colorSelector = NSSelectorFromString(colorName); if (![NSColor respondsToSelector:colorSelector]) { if ([colorName isEqualToString:@"controlAccentColor"]) { useFakeAccentColor = YES; } else if ( ![colorName isEqualToString:@"selectedTabTextColor"] && ![colorName isEqualToString:@"pressedButtonTextColor"]) { /* Uncomment to print all unsupported colors: */ /* printf("Unsupported color %s\n", colorName.UTF8String); */ continue; } } entry->selector = [colorName retain]; } |
︙ | ︙ | |||
143 144 145 146 147 148 149 150 151 152 153 154 155 156 | rgbColorIndex = entry->index; hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); controlAccentIndex = entry->index; hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); selectedTabTextIndex = entry->index; [pool drain]; } /* *---------------------------------------------------------------------- * * TkMacOSXRGBPixel -- | > > > | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | rgbColorIndex = entry->index; hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); controlAccentIndex = entry->index; hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); selectedTabTextIndex = entry->index; hPtr = Tcl_FindHashEntry(&systemColors, "PressedButtonTextColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); pressedButtonTextIndex = entry->index; [pool drain]; } /* *---------------------------------------------------------------------- * * TkMacOSXRGBPixel -- |
︙ | ︙ | |||
173 174 175 176 177 178 179 | MODULE_SCOPE unsigned long TkMacOSXRGBPixel( unsigned long red, unsigned long green, unsigned long blue) { | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | MODULE_SCOPE unsigned long TkMacOSXRGBPixel( unsigned long red, unsigned long green, unsigned long blue) { MacPixel p = {0}; p.pixel.colortype = rgbColor; p.pixel.value = ((red & 0xff) << 16) | ((green & 0xff) << 8) | (blue & 0xff); return p.ulong; } |
︙ | ︙ | |||
203 204 205 206 207 208 209 | * None. *---------------------------------------------------------------------- */ MODULE_SCOPE unsigned long TkMacOSXClearPixel( void) { | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | * None. *---------------------------------------------------------------------- */ MODULE_SCOPE unsigned long TkMacOSXClearPixel( void) { MacPixel p = {0}; p.pixel.value = 0; p.pixel.colortype = clearColor; return p.ulong; } /* |
︙ | ︙ | |||
232 233 234 235 236 237 238 | *---------------------------------------------------------------------- */ SystemColorDatum* GetEntryFromPixel( unsigned long pixel) { | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | *---------------------------------------------------------------------- */ SystemColorDatum* GetEntryFromPixel( unsigned long pixel) { MacPixel p = {0}; int index = rgbColorIndex; p.ulong = pixel; if (p.pixel.colortype != rgbColor) { index = p.pixel.value; } if (index < numSystemColors) { |
︙ | ︙ | |||
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | static void GetRGBA( SystemColorDatum *entry, unsigned long pixel, CGFloat *rgba) { NSColor *bgColor, *color = nil; if (!sRGB) { sRGB = [NSColorSpace sRGBColorSpace]; } switch (entry->type) { case rgbColor: rgba[0] = ((pixel >> 16) & 0xff) / 255.0; rgba[1] = ((pixel >> 8) & 0xff) / 255.0; rgba[2] = ((pixel ) & 0xff) / 255.0; break; case ttkBackground: /* * Prior to OSX 10.14, getComponents returns black when applied to | > > | > > > > < > > > > > > > > < < | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | static void GetRGBA( SystemColorDatum *entry, unsigned long pixel, CGFloat *rgba) { NSColor *bgColor, *color = nil; int OSVersion = [NSApp macOSVersion]; if (!sRGB) { sRGB = [NSColorSpace sRGBColorSpace]; } switch (entry->type) { case rgbColor: rgba[0] = ((pixel >> 16) & 0xff) / 255.0; rgba[1] = ((pixel >> 8) & 0xff) / 255.0; rgba[2] = ((pixel ) & 0xff) / 255.0; break; case ttkBackground: /* * Prior to OSX 10.14, getComponents returns black when applied to * windowBackgroundColor. */ if ([NSApp macOSVersion] < 101400) { for (int i = 0; i < 3; i++) { rgba[i] = WINDOWBACKGROUND[i]; } } else { bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB]; [bgColor getComponents: rgba]; } if (rgba[0] + rgba[1] + rgba[2] < 1.5) { for (int i=0; i<3; i++) { rgba[i] += entry->value*8.0 / 255.0; } } else { for (int i=0; i<3; i++) { rgba[i] -= entry->value*8.0 / 255.0; } } break; case clearColor: rgba[0] = rgba[1] = rgba[2] = 1.0; rgba[3] = 0; break; case semantic: if (entry->index == controlAccentIndex && useFakeAccentColor) { #if MAC_OS_X_VERSION_MIN_REQUIRED < 101400 color = [[NSColor colorForControlTint: [NSColor currentControlTint]] colorUsingColorSpace:sRGB]; #endif } else if (entry->index == selectedTabTextIndex) { if (OSVersion > 100600 && OSVersion < 110000) { color = [[NSColor whiteColor] colorUsingColorSpace:sRGB]; } else { color = [[NSColor textColor] colorUsingColorSpace:sRGB]; } } else if (entry->index == pressedButtonTextIndex) { if (OSVersion < 120000) { color = [[NSColor whiteColor] colorUsingColorSpace:sRGB]; } else { color = [[NSColor blackColor] colorUsingColorSpace:sRGB]; } } else { color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; } [color getComponents: rgba]; break; default: break; } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
369 370 371 372 373 374 375 376 377 378 379 380 381 382 | * so it needs its own pool. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; if (entry->type == HIBrush) { OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c); return err == noErr; } GetRGBA(entry, pixel, rgba); *c = CGColorCreate(sRGB.CGColorSpace, rgba); [pool drain]; return true; } | > | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | * so it needs its own pool. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; if (entry->type == HIBrush) { OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c); [pool drain]; return err == noErr; } GetRGBA(entry, pixel, rgba); *c = CGColorCreate(sRGB.CGColorSpace, rgba); [pool drain]; return true; } |
︙ | ︙ | |||
408 409 410 411 412 413 414 | NSView *view = nil; if (winPtr && winPtr->privatePtr) { view = TkMacOSXGetNSViewForDrawable((Drawable)winPtr->privatePtr); } if (view) { name = [[view effectiveAppearance] name]; } else { | | > > | | < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | > < < < | | | < | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | NSView *view = nil; if (winPtr && winPtr->privatePtr) { view = TkMacOSXGetNSViewForDrawable((Drawable)winPtr->privatePtr); } if (view) { name = [[view effectiveAppearance] name]; } else { name = [[NSApp effectiveAppearance] name]; } return (name == NSAppearanceNameDarkAqua); } #else (void) tkwin; #endif return false; } /* *---------------------------------------------------------------------- * * TkSetMacColor -- * * Sets the components of a CGColorRef from an XColor pixel value. The * pixel value is used to look up the color in the system color table, and * then SetCGColorComponents is called with the table entry and the pixel * value. The parameter macColor should be a pointer to a CGColorRef. * * Results: * Returns false if the color is not found, true otherwise. * * Side effects: * The CGColorRef referenced by the variable macColor may be modified. * *---------------------------------------------------------------------- */ int TkSetMacColor( unsigned long pixel, /* Pixel value to convert. */ void *macColor) /* CGColorRef to modify. */ { CGColorRef *color = (CGColorRef*)macColor; SystemColorDatum *entry = GetEntryFromPixel(pixel); if (entry) { return SetCGColorComponents(entry, pixel, color); } else { return false; } } /* *---------------------------------------------------------------------- * * TkMacOSXGetNSColor -- * * Creates an autoreleased NSColor from a X style pixel value. * The return value is nil if the pixel value is invalid. * * Results: * A possibly nil pointer to an NSColor. * * Side effects: * None * *---------------------------------------------------------------------- */ NSColor* TkMacOSXGetNSColor( TCL_UNUSED(GC), unsigned long pixel) /* Pixel value to convert. */ { CGColorRef cgColor = NULL; NSColor *nsColor = nil; TkSetMacColor(pixel, &cgColor); if (cgColor) { nsColor = [NSColor colorWithColorSpace:sRGB components:CGColorGetComponents(cgColor) count:CGColorGetNumberOfComponents(cgColor)]; CGColorRelease(cgColor); } return nsColor; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
621 622 623 624 625 626 627 | * None. * *---------------------------------------------------------------------- */ void TkMacOSXSetColorInContext( | | | | < < | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | * None. * *---------------------------------------------------------------------- */ void TkMacOSXSetColorInContext( TCL_UNUSED(GC), unsigned long pixel, CGContextRef context) { OSStatus err = noErr; CGColorRef cgColor = NULL; SystemColorDatum *entry = GetEntryFromPixel(pixel); if (entry) { switch (entry->type) { case HIBrush: err = ChkErr(HIThemeSetFill, entry->value, NULL, context, kHIThemeOrientationNormal); if (err == noErr) { err = ChkErr(HIThemeSetStroke, entry->value, NULL, context, kHIThemeOrientationNormal); } break; default: SetCGColorComponents(entry, pixel, &cgColor); break; } } if (cgColor) { CGContextSetFillColorWithColor(context, cgColor); CGContextSetStrokeColorWithColor(context, cgColor); CGColorRelease(cgColor); |
︙ | ︙ | |||
691 692 693 694 695 696 697 | { Display *display = NULL; TkColor *tkColPtr; XColor color; Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap; NSView *view = nil; static Bool initialized = NO; | < < | | < | > > > > > > > > > > > > | | | > > | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | { Display *display = NULL; TkColor *tkColPtr; XColor color; Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap; NSView *view = nil; static Bool initialized = NO; if (!initialized) { initialized = YES; initColorTable(); } if (tkwin) { display = Tk_Display(tkwin); Drawable d = Tk_WindowId(tkwin); view = TkMacOSXGetNSViewForDrawable(d); } /* * Check to see if this is a system color. If not, just call XParseColor. */ if (strncasecmp(name, "system", 6) == 0) { Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&systemColors, name + 6); MacPixel p = {0}; if (hPtr != NULL) { SystemColorDatum *entry = (SystemColorDatum *)Tcl_GetHashValue(hPtr); CGColorRef c = NULL; p.pixel.colortype = entry->type; p.pixel.value = entry->index; color.pixel = p.ulong; if (entry->type == semantic) { CGFloat rgba[4]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { NSAppearance *windowAppearance; if (view) { windowAppearance = [view effectiveAppearance]; } else { windowAppearance = [NSApp effectiveAppearance]; } if ([windowAppearance name] == NSAppearanceNameDarkAqua) { colormap = darkColormap; } else { colormap = lightColormap; } if (@available(macOS 11.0, *)) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 CGFloat *rgbaPtr = rgba; [windowAppearance performAsCurrentDrawingAppearance:^{ GetRGBA(entry, p.ulong, rgbaPtr); }]; #endif } else { #if MAC_OS_X_VERSION_MIN_REQUIRED < 110000 NSAppearance *savedAppearance = [NSAppearance currentAppearance]; [NSAppearance setCurrentAppearance:windowAppearance]; GetRGBA(entry, p.ulong, rgba); [NSAppearance setCurrentAppearance:savedAppearance]; #endif } } else { GetRGBA(entry, p.ulong, rgba); } #else GetRGBA(entry, p.ulong, rgba); #endif color.red = rgba[0] * 65535.0; |
︙ | ︙ |
Changes to macosx/tkMacOSXColor.h.
︙ | ︙ | |||
83 84 85 86 87 88 89 | * preceded by a backup color with the same name which *is* supported. Systems * which do support the color will replace the backup value when the table is * constructed. Failing to ensure this will result in a Tcl_Panic abort. */ static SystemColorDatum systemColorData[] = { {"Pixel", rgbColor, 0, NULL, 0, NULL }, | | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | * preceded by a backup color with the same name which *is* supported. Systems * which do support the color will replace the backup value when the table is * constructed. Failing to ensure this will result in a Tcl_Panic abort. */ static SystemColorDatum systemColorData[] = { {"Pixel", rgbColor, 0, NULL, 0, NULL }, {"Transparent", clearColor, 0, NULL, 0, NULL }, {"Highlight", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL }, {"HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor, NULL, 0, NULL }, {"HighlightText", HIBrush, kThemeBrushBlack, NULL, 0, NULL }, {"HighlightAlternate", HIBrush, kThemeBrushAlternatePrimaryHighlightColor, NULL, 0, NULL }, {"PrimaryHighlightColor", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL }, {"ButtonFace", HIBrush, kThemeBrushButtonFaceActive, NULL, 0, NULL }, |
︙ | ︙ | |||
171 172 173 174 175 176 177 | {"WindowBackgroundColor3", ttkBackground, 3, NULL, 0, NULL }, {"WindowBackgroundColor4", ttkBackground, 4, NULL, 0, NULL }, {"WindowBackgroundColor5", ttkBackground, 5, NULL, 0, NULL }, {"WindowBackgroundColor6", ttkBackground, 6, NULL, 0, NULL }, {"WindowBackgroundColor7", ttkBackground, 7, NULL, 0, NULL }, /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */ {"SecondaryLabelColor", ttkBackground, 14, NULL, 0, NULL }, | | > > > | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | {"WindowBackgroundColor3", ttkBackground, 3, NULL, 0, NULL }, {"WindowBackgroundColor4", ttkBackground, 4, NULL, 0, NULL }, {"WindowBackgroundColor5", ttkBackground, 5, NULL, 0, NULL }, {"WindowBackgroundColor6", ttkBackground, 6, NULL, 0, NULL }, {"WindowBackgroundColor7", ttkBackground, 7, NULL, 0, NULL }, /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */ {"SecondaryLabelColor", ttkBackground, 14, NULL, 0, NULL }, /* Color to use for notebook tab label text -- depends on OS version. */ {"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL }, /* Color to use for selected button labels -- depends on OS version. */ {"PressedButtonTextColor", semantic, 0, "textColor", 0, NULL }, /* Semantic colors that we simulate on older systems which don't supoort them. */ {"SelectedMenuItemTextColor", semantic, 0, "selectedMenuItemTextColor", 0, NULL }, {"ControlAccentColor", semantic, 0, "controlAccentColor", 0, NULL }, {"LabelColor", semantic, 0, "blackColor", 0, NULL }, {"LinkColor", semantic, 0, "blueColor", 0, NULL }, {"PlaceholderTextColor", semantic, 0, "grayColor", 0, NULL }, {"SeparatorColor", semantic, 0, "grayColor", 0, NULL }, {"UnemphasizedSelectedTextBackgroundColor", semantic, 0, "grayColor", 0, NULL }, {NULL, rgbColor, 0, NULL, 0, NULL } }; #endif /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXConfig.c.
1 2 3 4 5 6 | /* * tkMacOSXConfig.c -- * * This module implements the Macintosh system defaults for * the configuration package. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /* * tkMacOSXConfig.c -- * * This module implements the Macintosh system defaults for * the configuration package. * * Copyright © 1997 Sun Microsystems, Inc. * Copyright © 2001, Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" /* *---------------------------------------------------------------------- * * Tk_GetSystemDefault -- * * Given a dbName and className for a configuration option, * return a string representation of the option. * * Results: * Returns a Tk_Uid that is the string identifier that identifies * this option. Returns NULL if there are no system defaults * that match this pair. * * Side effects: * None, once the package is initialized. * *---------------------------------------------------------------------- */ Tcl_Obj * Tk_GetSystemDefault( Tk_Window tkwin, /* A window to use. */ const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { (void)tkwin; (void)dbName; (void)className; |
︙ | ︙ |
Changes to macosx/tkMacOSXConstants.h.
1 2 3 4 5 6 7 8 | /* * tkMacOSXConstants.h -- * * Macros which map the names of NS constants used in the Tk code to * the new name that Apple came up with for subsequent versions of the * operating system. (Each new OS release seems to come with a new * naming convention for the same old constants.) * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkMacOSXConstants.h -- * * Macros which map the names of NS constants used in the Tk code to * the new name that Apple came up with for subsequent versions of the * operating system. (Each new OS release seems to come with a new * naming convention for the same old constants.) * * Copyright © 2017 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKMACCONSTANTS #define _TKMACCONSTANTS |
︙ | ︙ | |||
75 76 77 78 79 80 81 82 83 84 85 | #define NSAlternateKeyMask NSEventModifierFlagOption #define NSControlKeyMask NSEventModifierFlagControl #define NSNumericPadKeyMask NSEventModifierFlagNumericPad #define NSFunctionKeyMask NSEventModifierFlagFunction #define NSCursorUpdate NSEventTypeCursorUpdate #define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground #define NSCompositeCopy NSCompositingOperationCopy #define NSWarningAlertStyle NSAlertStyleWarning #define NSInformationalAlertStyle NSAlertStyleInformational #define NSCriticalAlertStyle NSAlertStyleCritical #define NSCenterTextAlignment NSTextAlignmentCenter | > > > < > > > > > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | #define NSAlternateKeyMask NSEventModifierFlagOption #define NSControlKeyMask NSEventModifierFlagControl #define NSNumericPadKeyMask NSEventModifierFlagNumericPad #define NSFunctionKeyMask NSEventModifierFlagFunction #define NSCursorUpdate NSEventTypeCursorUpdate #define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground #define NSCompositeCopy NSCompositingOperationCopy #define NSCompositeSourceOver NSCompositingOperationSourceOver #define NSCompositeSourceAtop NSCompositingOperationSourceAtop #define NSCompositeDestinationIn NSCompositingOperationDestinationIn #define NSWarningAlertStyle NSAlertStyleWarning #define NSInformationalAlertStyle NSAlertStyleInformational #define NSCriticalAlertStyle NSAlertStyleCritical #define NSCenterTextAlignment NSTextAlignmentCenter #define NSApplicationDefinedMask NSEventMaskApplicationDefined #define NSUtilityWindowMask NSWindowStyleMaskUtilityWindow #define NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel #define NSDocModalWindowMask NSWindowStyleMaskDocModalWindow #define NSHUDWindowMask NSWindowStyleMaskHUDWindow #define NSTitledWindowMask NSWindowStyleMaskTitled #define NSClosableWindowMask NSWindowStyleMaskClosable #define NSResizableWindowMask NSWindowStyleMaskResizable #define NSUnifiedTitleAndToolbarWindowMask NSWindowStyleMaskUnifiedTitleAndToolbar #define NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable #define NSBorderlessWindowMask NSWindowStyleMaskBorderless #define NSFullScreenWindowMask NSWindowStyleMaskFullScreen #define NSAlphaFirstBitmapFormat NSBitmapFormatAlphaFirst #define NSAnyEventMask NSEventMaskAny #define NSLeftMouseDownMask NSEventMaskLeftMouseDown #define NSMouseMovedMask NSEventMaskMouseMoved #define NSLeftMouseDraggedMask NSEventMaskLeftMouseDragged #endif #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 #define NSStringPboardType NSPasteboardTypeString #define NSOnState NSControlStateValueOn #define NSOffState NSControlStateValueOff #endif |
︙ | ︙ |
Changes to macosx/tkMacOSXCursor.c.
1 2 3 4 5 | /* * tkMacOSXCursor.c -- * * This file contains Macintosh specific cursor related routines. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXCursor.c -- * * This file contains Macintosh specific cursor related routines. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXCursors.h" |
︙ | ︙ | |||
258 259 260 261 262 263 264 | haveHotSpot = 1; break; case IMAGEPATH: path = [NSApp tkFrameworkImagePath:cursorNames[idx].id1]; break; case IMAGEBITMAP: { unsigned char *bitmap = (unsigned char *)(cursorNames[idx].id1); | | | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | haveHotSpot = 1; break; case IMAGEPATH: path = [NSApp tkFrameworkImagePath:cursorNames[idx].id1]; break; case IMAGEBITMAP: { unsigned char *bitmap = (unsigned char *)(cursorNames[idx].id1); NSBitmapImageRep *bitmapImageRep = nil; CGImageRef img = NULL, mask = NULL, maskedImg = NULL; static const CGFloat decodeWB[] = {1, 0}; CGColorSpaceRef colorspace = CGColorSpaceCreateWithName( kCGColorSpaceGenericGray); CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap, pix*pix/8, NULL); |
︙ | ︙ | |||
368 369 370 371 372 373 374 | Tcl_Interp *interp, /* Interpreter to use for error reporting. */ TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry * for details on legal syntax. */ { TkMacOSXCursor *macCursorPtr = NULL; const char **argv = NULL; | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | Tcl_Interp *interp, /* Interpreter to use for error reporting. */ TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry * for details on legal syntax. */ { TkMacOSXCursor *macCursorPtr = NULL; const char **argv = NULL; TkSizeT argc; /* * All cursor names are valid lists of one element (for * TkX11-compatibility), even unadorned system cursor names. */ if (Tcl_SplitList(interp, string, &argc, &argv) == TCL_OK) { |
︙ | ︙ | |||
453 454 455 456 457 458 459 | void TkpFreeCursor( TkCursor *cursorPtr) { TkMacOSXCursor *macCursorPtr = (TkMacOSXCursor *) cursorPtr; [macCursorPtr->macCursor release]; | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | void TkpFreeCursor( TkCursor *cursorPtr) { TkMacOSXCursor *macCursorPtr = (TkMacOSXCursor *) cursorPtr; [macCursorPtr->macCursor release]; macCursorPtr->macCursor = nil; if (macCursorPtr == gCurrentCursor) { gCurrentCursor = NULL; } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
532 533 534 535 536 537 538 | void TkpSetCursor( TkpCursor cursor) { int cursorChanged = 1; | | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | void TkpSetCursor( TkpCursor cursor) { int cursorChanged = 1; if (cursor == NULL) { /* * This is a little tricky. We can't really tell whether * gCurrentCursor is NULL because it was NULL last time around or * because we just freed the current cursor. So if the input cursor is * NULL, we always need to reset it, we can't trust the cursorChanged * logic. */ |
︙ | ︙ |
Changes to macosx/tkMacOSXCursors.h.
1 2 3 4 5 6 | /* * tkMacOSXCursors.h -- * * This file defines a set of Macintosh cursor resources that * are only available on the Macintosh platform. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkMacOSXCursors.h -- * * This file defines a set of Macintosh cursor resources that * are only available on the Macintosh platform. * * Copyright © 1995-1996 Sun Microsystems, Inc. * Copyright © 2008-2009 Apple Inc. * Copyright © 2008-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ static const unsigned char tkMacOSXCursors[][68] = { |
︙ | ︙ |
Changes to macosx/tkMacOSXDebug.c.
1 2 3 4 5 6 | /* * tkMacOSXDebug.c -- * * Implementation of Macintosh specific functions for debugging MacOS * events, regions, etc... * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXDebug.c -- * * Implementation of Macintosh specific functions for debugging MacOS * events, regions, etc... * * Copyright © 2001-2009, Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXDebug.h" |
︙ | ︙ |
Changes to macosx/tkMacOSXDebug.h.
1 2 3 4 5 6 | /* * tkMacOSXDebug.h -- * * Declarations of Macintosh specific functions for debugging MacOS events, * regions, etc... * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXDebug.h -- * * Declarations of Macintosh specific functions for debugging MacOS events, * regions, etc... * * Copyright © 2001-2009, Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKMACDEBUG #define _TKMACDEBUG |
︙ | ︙ |
Changes to macosx/tkMacOSXDefault.h.
︙ | ︙ | |||
38 39 40 41 42 43 44 | #define NORMAL_BG "systemWindowBackgroundColor" #define TEXT_BG "systemTextBackgroundColor" #define NORMAL_FG "systemTextColor" #define ACTIVE_BG "systemWindowBackgroundColor" #define ACTIVE_FG "systemTextColor" #define SELECT_BG "systemSelectedTextBackgroundColor" #define SELECT_FG "systemSelectedTextColor" | | > | | > | | < < < < < < < < < < < | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | #define NORMAL_BG "systemWindowBackgroundColor" #define TEXT_BG "systemTextBackgroundColor" #define NORMAL_FG "systemTextColor" #define ACTIVE_BG "systemWindowBackgroundColor" #define ACTIVE_FG "systemTextColor" #define SELECT_BG "systemSelectedTextBackgroundColor" #define SELECT_FG "systemSelectedTextColor" #define INACTIVE_SELECT_BG "systemUnemphasizedSelectedTextBackgroundColor" #define TROUGH "#c3c3c3" #define INDICATOR "#b03060" #define DISABLED "systemDisabledControlTextColor" #define IGNORED "#abcdef" /* * Defaults for labels, buttons, checkbuttons, and radiobuttons: */ #define DEF_BUTTON_ANCHOR "center" #define DEF_BUTTON_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_BUTTON_ACTIVE_BG_MONO BLACK #define DEF_BUTTON_ACTIVE_FG_COLOR "systemPressedButtonTextColor" #define DEF_CHKRAD_ACTIVE_FG_COLOR ACTIVE_FG #define DEF_BUTTON_ACTIVE_FG_MONO WHITE #define DEF_BUTTON_BG_COLOR NORMAL_BG #define DEF_BUTTON_BG_MONO WHITE #define DEF_BUTTON_BITMAP "" #define DEF_BUTTON_BORDER_WIDTH "2" #define DEF_BUTTON_CURSOR "" #define DEF_BUTTON_COMMAND "" #define DEF_BUTTON_COMPOUND "none" #define DEF_BUTTON_DEFAULT "disabled" #define DEF_BUTTON_DISABLED_FG_COLOR DISABLED #define DEF_BUTTON_DISABLED_FG_MONO "" #define DEF_BUTTON_FG BLACK #define DEF_LABEL_FG NORMAL_FG #define DEF_CHKRAD_FG DEF_LABEL_FG #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT NORMAL_FG #define DEF_LABEL_HIGHLIGHT_WIDTH "0" //#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS //#define DEF_BUTTON_HIGHLIGHT_WIDTH "4" //#define DEF_BUTTON_HIGHLIGHT_WIDTH_NOCM "1" //#else #define DEF_BUTTON_HIGHLIGHT_WIDTH "1" //#endif #define DEF_BUTTON_IMAGE NULL #define DEF_BUTTON_INDICATOR "1" #define DEF_BUTTON_JUSTIFY "center" #define DEF_BUTTON_OFF_VALUE "0" #define DEF_BUTTON_ON_VALUE "1" #define DEF_BUTTON_TRISTATE_VALUE "" #define DEF_BUTTON_OVER_RELIEF "" #define DEF_BUTTON_PADX "1" #define DEF_LABCHKRAD_PADX "1" #define DEF_BUTTON_PADY "1" #define DEF_LABCHKRAD_PADY "1" #define DEF_BUTTON_RELIEF "flat" #define DEF_LABCHKRAD_RELIEF "flat" #define DEF_BUTTON_REPEAT_DELAY "0" #define DEF_BUTTON_REPEAT_INTERVAL "0" #define DEF_BUTTON_SELECT_COLOR INDICATOR #define DEF_BUTTON_SELECT_MONO BLACK #define DEF_BUTTON_SELECT_IMAGE NULL #define DEF_BUTTON_STATE "normal" #define DEF_LABEL_TAKE_FOCUS "0" #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" #define DEF_RADIOBUTTON_VARIABLE "selectedButton" #define DEF_CHECKBUTTON_VARIABLE "" /* * Defaults for canvases: */ #define DEF_CANVAS_BG_COLOR NORMAL_BG #define DEF_CANVAS_BG_MONO WHITE #define DEF_CANVAS_BORDER_WIDTH "0" #define DEF_CANVAS_CLOSE_ENOUGH "1" #define DEF_CANVAS_CONFINE "1" #define DEF_CANVAS_CURSOR "" #define DEF_CANVAS_HEIGHT "7c" #define DEF_CANVAS_HIGHLIGHT_BG NORMAL_BG #define DEF_CANVAS_HIGHLIGHT NORMAL_FG #define DEF_CANVAS_HIGHLIGHT_WIDTH "3" #define DEF_CANVAS_INSERT_BG BLACK #define DEF_CANVAS_INSERT_BD_COLOR "0" #define DEF_CANVAS_INSERT_BD_MONO "0" #define DEF_CANVAS_INSERT_OFF_TIME "300" #define DEF_CANVAS_INSERT_ON_TIME "600" #define DEF_CANVAS_INSERT_WIDTH "2" |
︙ | ︙ | |||
179 180 181 182 183 184 185 | #define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG #define DEF_ENTRY_DISABLED_BG_MONO WHITE #define DEF_ENTRY_DISABLED_FG DISABLED #define DEF_ENTRY_EXPORT_SELECTION "1" #define DEF_ENTRY_FONT "TkTextFont" #define DEF_ENTRY_FG NORMAL_FG #define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG | | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | #define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG #define DEF_ENTRY_DISABLED_BG_MONO WHITE #define DEF_ENTRY_DISABLED_FG DISABLED #define DEF_ENTRY_EXPORT_SELECTION "1" #define DEF_ENTRY_FONT "TkTextFont" #define DEF_ENTRY_FG NORMAL_FG #define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG #define DEF_ENTRY_HIGHLIGHT NORMAL_FG #define DEF_ENTRY_HIGHLIGHT_WIDTH "3" #define DEF_ENTRY_INSERT_BG NORMAL_FG #define DEF_ENTRY_INSERT_BD_COLOR "0" #define DEF_ENTRY_INSERT_BD_MONO "0" #define DEF_ENTRY_INSERT_OFF_TIME "300" #define DEF_ENTRY_INSERT_ON_TIME "600" #define DEF_ENTRY_INSERT_WIDTH "1" |
︙ | ︙ | |||
221 222 223 224 225 226 227 | #define DEF_FRAME_BORDER_WIDTH "0" #define DEF_FRAME_CLASS "Frame" #define DEF_FRAME_COLORMAP "" #define DEF_FRAME_CONTAINER "0" #define DEF_FRAME_CURSOR "" #define DEF_FRAME_HEIGHT "0" #define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | #define DEF_FRAME_BORDER_WIDTH "0" #define DEF_FRAME_CLASS "Frame" #define DEF_FRAME_COLORMAP "" #define DEF_FRAME_CONTAINER "0" #define DEF_FRAME_CURSOR "" #define DEF_FRAME_HEIGHT "0" #define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG #define DEF_FRAME_HIGHLIGHT NORMAL_FG #define DEF_FRAME_HIGHLIGHT_WIDTH "0" #define DEF_FRAME_PADX "0" #define DEF_FRAME_PADY "0" #define DEF_FRAME_RELIEF "flat" #define DEF_FRAME_TAKE_FOCUS "0" #define DEF_FRAME_VISUAL "" #define DEF_FRAME_WIDTH "0" |
︙ | ︙ | |||
257 258 259 260 261 262 263 | #define DEF_LISTBOX_CURSOR "" #define DEF_LISTBOX_DISABLED_FG DISABLED #define DEF_LISTBOX_EXPORT_SELECTION "1" #define DEF_LISTBOX_FONT "TkTextFont" #define DEF_LISTBOX_FG NORMAL_FG #define DEF_LISTBOX_HEIGHT "10" #define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG | | | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | #define DEF_LISTBOX_CURSOR "" #define DEF_LISTBOX_DISABLED_FG DISABLED #define DEF_LISTBOX_EXPORT_SELECTION "1" #define DEF_LISTBOX_FONT "TkTextFont" #define DEF_LISTBOX_FG NORMAL_FG #define DEF_LISTBOX_HEIGHT "10" #define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG #define DEF_LISTBOX_HIGHLIGHT NORMAL_FG #define DEF_LISTBOX_HIGHLIGHT_WIDTH "0" #define DEF_LISTBOX_JUSTIFY "left" #define DEF_LISTBOX_RELIEF "solid" #define DEF_LISTBOX_SCROLL_COMMAND "" #define DEF_LISTBOX_LIST_VARIABLE "" #define DEF_LISTBOX_SELECT_COLOR SELECT_BG #define DEF_LISTBOX_SELECT_MONO BLACK |
︙ | ︙ | |||
301 302 303 304 305 306 307 | #define DEF_MENU_ENTRY_ON_VALUE "1" #define DEF_MENU_ENTRY_SELECT_IMAGE NULL #define DEF_MENU_ENTRY_STATE "normal" #define DEF_MENU_ENTRY_VALUE NULL #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL | < | | | | | | | | | | | | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | #define DEF_MENU_ENTRY_ON_VALUE "1" #define DEF_MENU_ENTRY_SELECT_IMAGE NULL #define DEF_MENU_ENTRY_STATE "normal" #define DEF_MENU_ENTRY_VALUE NULL #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL /* * Defaults for menus overall: */ #define DEF_MENU_ACTIVE_BG_COLOR IGNORED #define DEF_MENU_ACTIVE_BG_MONO IGNORED #define DEF_MENU_ACTIVE_BORDER_WIDTH "0" #define DEF_MENU_ACTIVE_FG_COLOR IGNORED #define DEF_MENU_ACTIVE_FG_MONO IGNORED #define DEF_MENU_ACTIVE_RELIEF "flat" #define DEF_MENU_BG_COLOR "#000001" /* Detects custom bg. */ #define DEF_MENU_BG_MONO IGNORED #define DEF_MENU_BORDER_WIDTH "0" #define DEF_MENU_CURSOR "arrow" #define DEF_MENU_DISABLED_FG_COLOR IGNORED #define DEF_MENU_DISABLED_FG_MONO "" #define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */ #define DEF_MENU_FG "#010000" /* Detects custom fg. */ #define DEF_MENU_POST_COMMAND "" #define DEF_MENU_RELIEF "flat" #define DEF_MENU_SELECT_COLOR IGNORED #define DEF_MENU_SELECT_MONO IGNORED #define DEF_MENU_TAKE_FOCUS "0" #define DEF_MENU_TEAROFF "0" #define DEF_MENU_TEAROFF_CMD NULL #define DEF_MENU_TITLE "" #define DEF_MENU_TYPE "normal" /* |
︙ | ︙ | |||
353 354 355 356 357 358 359 | #define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED #define DEF_MENUBUTTON_DISABLED_FG_MONO "" #define DEF_MENUBUTTON_FONT "TkDefaultFont" #define DEF_MENUBUTTON_FG NORMAL_FG #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO | | < | | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | #define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED #define DEF_MENUBUTTON_DISABLED_FG_MONO "" #define DEF_MENUBUTTON_FONT "TkDefaultFont" #define DEF_MENUBUTTON_FG NORMAL_FG #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO #define DEF_MENUBUTTON_HIGHLIGHT NORMAL_FG #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" #define DEF_MENUBUTTON_IMAGE NULL #define DEF_MENUBUTTON_INDICATOR "1" #define DEF_MENUBUTTON_JUSTIFY "left" #define DEF_MENUBUTTON_MENU "" #define DEF_MENUBUTTON_PADX "0" #define DEF_MENUBUTTON_PADY "0" #define DEF_MENUBUTTON_RELIEF "flat" #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" /* * Defaults for messages: */ #define DEF_MESSAGE_ANCHOR "center" #define DEF_MESSAGE_ASPECT "150" #define DEF_MESSAGE_BG_COLOR NORMAL_BG #define DEF_MESSAGE_BG_MONO WHITE #define DEF_MESSAGE_BORDER_WIDTH "1" #define DEF_MESSAGE_CURSOR "" #define DEF_MESSAGE_FG NORMAL_FG #define DEF_MESSAGE_FONT "TkDefaultFont" #define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG #define DEF_MESSAGE_HIGHLIGHT NORMAL_FG #define DEF_MESSAGE_HIGHLIGHT_WIDTH "0" #define DEF_MESSAGE_JUSTIFY "left" #define DEF_MESSAGE_PADX "-1" #define DEF_MESSAGE_PADY "-1" #define DEF_MESSAGE_RELIEF "flat" #define DEF_MESSAGE_TAKE_FOCUS "0" #define DEF_MESSAGE_TEXT "" |
︙ | ︙ | |||
449 450 451 452 453 454 455 | #define DEF_SCALE_DIGITS "0" #define DEF_SCALE_FONT "TkDefaultFont" #define DEF_SCALE_FG_COLOR NORMAL_FG #define DEF_SCALE_FG_MONO BLACK #define DEF_SCALE_FROM "0" #define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR #define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | #define DEF_SCALE_DIGITS "0" #define DEF_SCALE_FONT "TkDefaultFont" #define DEF_SCALE_FG_COLOR NORMAL_FG #define DEF_SCALE_FG_MONO BLACK #define DEF_SCALE_FROM "0" #define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR #define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO #define DEF_SCALE_HIGHLIGHT NORMAL_FG #define DEF_SCALE_HIGHLIGHT_WIDTH "0" #define DEF_SCALE_LABEL "" #define DEF_SCALE_LENGTH "100" #define DEF_SCALE_ORIENT "vertical" #define DEF_SCALE_RELIEF "flat" #define DEF_SCALE_REPEAT_DELAY "300" #define DEF_SCALE_REPEAT_INTERVAL "100" |
︙ | ︙ | |||
484 485 486 487 488 489 490 | #define DEF_SCROLLBAR_BG_COLOR NORMAL_BG #define DEF_SCROLLBAR_BG_MONO WHITE #define DEF_SCROLLBAR_BORDER_WIDTH "0" #define DEF_SCROLLBAR_COMMAND "" #define DEF_SCROLLBAR_CURSOR "" #define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1" #define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG | | | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | #define DEF_SCROLLBAR_BG_COLOR NORMAL_BG #define DEF_SCROLLBAR_BG_MONO WHITE #define DEF_SCROLLBAR_BORDER_WIDTH "0" #define DEF_SCROLLBAR_COMMAND "" #define DEF_SCROLLBAR_CURSOR "" #define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1" #define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG #define DEF_SCROLLBAR_HIGHLIGHT NORMAL_FG #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" #define DEF_SCROLLBAR_JUMP "0" #define DEF_SCROLLBAR_ORIENT "vertical" #define DEF_SCROLLBAR_RELIEF "flat" #define DEF_SCROLLBAR_REPEAT_DELAY "300" #define DEF_SCROLLBAR_REPEAT_INTERVAL "100" #define DEF_SCROLLBAR_TAKE_FOCUS NULL |
︙ | ︙ | |||
511 512 513 514 515 516 517 | #define DEF_TEXT_BORDER_WIDTH "0" #define DEF_TEXT_CURSOR "xterm" #define DEF_TEXT_FG NORMAL_FG #define DEF_TEXT_EXPORT_SELECTION "1" #define DEF_TEXT_FONT "TkFixedFont" #define DEF_TEXT_HEIGHT "24" #define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG | | | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | #define DEF_TEXT_BORDER_WIDTH "0" #define DEF_TEXT_CURSOR "xterm" #define DEF_TEXT_FG NORMAL_FG #define DEF_TEXT_EXPORT_SELECTION "1" #define DEF_TEXT_FONT "TkFixedFont" #define DEF_TEXT_HEIGHT "24" #define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG #define DEF_TEXT_HIGHLIGHT NORMAL_FG #define DEF_TEXT_HIGHLIGHT_WIDTH "3" #define DEF_TEXT_INSERT_BG NORMAL_FG #define DEF_TEXT_INSERT_BD_COLOR "0" #define DEF_TEXT_INSERT_BD_MONO "0" #define DEF_TEXT_INSERT_OFF_TIME "300" #define DEF_TEXT_INSERT_ON_TIME "600" #define DEF_TEXT_INSERT_UNFOCUSSED "none" |
︙ | ︙ |
Changes to macosx/tkMacOSXDialog.c.
1 2 3 4 5 6 | /* * tkMacOSXDialog.c -- * * Contains the Mac implementation of the common dialog boxes. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. | | | > | > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /* * tkMacOSXDialog.c -- * * Contains the Mac implementation of the common dialog boxes. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. * Copyright (c) 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2017 Christian Gollwitzer * Copyright (c) 2022 Marc Culler * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkFileFilter.h" #include "tkMacOSXConstants.h" #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOK NSOKButton #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 modalError -2 static void setAllowedFileTypes( NSSavePanel *panel, NSMutableArray *extensions) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 /* UTType exists in the SDK */ if (@available(macOS 11.0, *)) { NSMutableArray<UTType *> *allowedTypes = [NSMutableArray array]; for (NSString *ext in extensions) { UTType *uttype = [UTType typeWithFilenameExtension: ext]; [allowedTypes addObject:uttype]; } [panel setAllowedContentTypes:allowedTypes]; } else { # if MAC_OS_X_VERSION_MIN_REQUIRED < 110000 /* setAllowedFileTypes is not deprecated */ [panel setAllowedFileTypes:extensions]; #endif } #else [panel setAllowedFileTypes:extensions]; #endif } /* * Vars for filtering in "open file" and "save file" dialogs. */ typedef struct { bool doFileTypes; /* Show the accessory view which |
︙ | ︙ | |||
64 65 66 67 68 69 70 | "-initialcolor", "-parent", "-title", NULL }; enum colorOptions { COLOR_INITIAL, COLOR_PARENT, COLOR_TITLE }; static const char *const openOptionStrings[] = { | | | | | | | | | | | | | | | | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | "-initialcolor", "-parent", "-title", NULL }; enum colorOptions { COLOR_INITIAL, COLOR_PARENT, COLOR_TITLE }; static const char *const openOptionStrings[] = { "-command", "-defaultextension", "-filetypes", "-initialdir", "-initialfile", "-message", "-multiple", "-parent", "-title", "-typevariable", NULL }; enum openOptions { OPEN_COMMAND, OPEN_DEFAULT, OPEN_FILETYPES, OPEN_INITDIR, OPEN_INITFILE, OPEN_MESSAGE, OPEN_MULTIPLE, OPEN_PARENT, OPEN_TITLE, OPEN_TYPEVARIABLE }; static const char *const saveOptionStrings[] = { "-command", "-confirmoverwrite", "-defaultextension", "-filetypes", "-initialdir", "-initialfile", "-message", "-parent", "-title", "-typevariable", NULL }; enum saveOptions { SAVE_COMMAND, SAVE_CONFIRMOW, SAVE_DEFAULT, SAVE_FILETYPES, SAVE_INITDIR, SAVE_INITFILE, SAVE_MESSAGE, SAVE_PARENT, SAVE_TITLE, SAVE_TYPEVARIABLE }; static const char *const chooseOptionStrings[] = { "-command", "-initialdir", "-message", "-mustexist", "-parent", "-title", NULL }; enum chooseOptions { CHOOSE_COMMAND, CHOOSE_INITDIR, CHOOSE_MESSAGE, CHOOSE_MUSTEXIST, CHOOSE_PARENT, CHOOSE_TITLE }; typedef struct { Tcl_Interp *interp; Tcl_Obj *cmdObj; int multiple; } FilePanelCallbackInfo; static const char *const alertOptionStrings[] = { "-default", "-detail", "-icon", "-message", "-parent", "-title", "-type", "-command", NULL }; enum alertOptions { ALERT_DEFAULT, ALERT_DETAIL, ALERT_ICON, ALERT_MESSAGE, ALERT_PARENT, ALERT_TITLE, ALERT_TYPE, ALERT_COMMAND }; typedef struct { Tcl_Interp *interp; Tcl_Obj *cmdObj; int typeIndex; } AlertCallbackInfo; static const char *const alertTypeStrings[] = { |
︙ | ︙ | |||
215 216 217 218 219 220 221 | (void)sender; (void)url; *outError = nil; return YES; } - (void) tkFilePanelDidEnd: (NSSavePanel *) panel returnCode: (NSModalResponse) returnCode | | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | (void)sender; (void)url; *outError = nil; return YES; } - (void) tkFilePanelDidEnd: (NSSavePanel *) panel returnCode: (NSModalResponse) returnCode contextInfo: (const void *) contextInfo { const FilePanelCallbackInfo *callbackInfo = (const FilePanelCallbackInfo *)contextInfo; if (returnCode == modalOK) { Tcl_Obj *resultObj; if (callbackInfo->multiple) { resultObj = Tcl_NewListObj(0, NULL); for (NSURL *url in [(NSOpenPanel*)panel URLs]) { |
︙ | ︙ | |||
250 251 252 253 254 255 256 | } } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); } } else if (returnCode == modalCancel) { Tcl_ResetResult(callbackInfo->interp); } | < < < < < < | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | } } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); } } else if (returnCode == modalCancel) { Tcl_ResetResult(callbackInfo->interp); } [NSApp stopModalWithCode:returnCode]; } - (void) tkAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (const void *) contextInfo { AlertCallbackInfo *callbackInfo = (AlertCallbackInfo *)contextInfo; if (returnCode >= NSAlertFirstButtonReturn) { Tcl_Obj *resultObj = Tcl_NewStringObj(alertButtonStrings[ alertNativeButtonIndexAndTypeToButtonIndex[callbackInfo-> typeIndex][returnCode - NSAlertFirstButtonReturn]], -1); if (callbackInfo->cmdObj) { |
︙ | ︙ | |||
289 290 291 292 293 294 295 | } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); } } if ([alert window] == [NSApp modalWindow]) { [NSApp stopModalWithCode:returnCode]; } | < < < < < | | | | > | > > > > > > > > | | | | | | | < | | | | | < | < > > | < > > > | | < < < < < < < < < < < < | | | | | < | < | | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); } } if ([alert window] == [NSApp modalWindow]) { [NSApp stopModalWithCode:returnCode]; } } - (void)selectFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = [button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [openpanel setAllowsOtherFileTypes:YES]; /* * setAllowsOtherFileTypes might have no effect; it's inherited from * the NSSavePanel, where it has the effect that it does not append an * extension. Setting the allowed file types to nil allows selecting * any file. */ setAllowedFileTypes(openpanel, nil); } else { NSMutableArray *allowedtypes = [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]; setAllowedFileTypes(openpanel, allowedtypes); [openpanel setAllowsOtherFileTypes:NO]; } filterInfo.userHasSelectedFilter = true; } - (void)saveFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = [button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [savepanel setAllowsOtherFileTypes:YES]; setAllowedFileTypes(savepanel, nil); } else { NSMutableArray *allowedtypes = [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]; setAllowedFileTypes(savepanel, allowedtypes); [savepanel setAllowsOtherFileTypes:NO]; } filterInfo.userHasSelectedFilter = true; } @end #pragma mark - static NSInteger showOpenSavePanel( NSSavePanel *panel, NSWindow *parent, Tcl_Interp *interp, Tcl_Obj *cmdObj, int multiple) { NSInteger modalReturnCode; int OSVersion = [NSApp macOSVersion]; const FilePanelCallbackInfo callbackInfo = {interp, cmdObj, multiple}; /* * Use a sheet if -parent is specified (unless there is already a sheet). */ if (parent && ![parent attachedSheet]) { if (OSVersion < 101500) { [panel beginSheetModalForWindow:parent completionHandler:^(NSModalResponse returnCode) { [NSApp tkFilePanelDidEnd:panel returnCode:returnCode contextInfo:&callbackInfo ]; }]; modalReturnCode = [NSApp runModalForWindow:panel]; } else if (OSVersion < 110000) { [panel beginSheetModalForWindow:parent completionHandler:^(NSModalResponse returnCode) { [NSApp tkFilePanelDidEnd:panel returnCode:returnCode contextInfo:&callbackInfo ]; }]; modalReturnCode = [panel runModal]; } else { [parent beginSheet: panel completionHandler:nil]; modalReturnCode = [panel runModal]; [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode contextInfo:&callbackInfo ]; [parent endSheet:panel]; } } else { modalReturnCode = [panel runModal]; [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode contextInfo:&callbackInfo ]; } return cmdObj ? modalOther : modalReturnCode; } /* *---------------------------------------------------------------------- * * Tk_ChooseColorObjCmd -- * |
︙ | ︙ | |||
419 420 421 422 423 424 425 | Tk_ChooseColorObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int result = TCL_ERROR; | | | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | Tk_ChooseColorObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int result = TCL_ERROR; Tk_Window parent, tkwin = (Tk_Window)clientData; const char *title = NULL; int i; NSColor *color = nil, *initialColor = nil; NSColorPanel *colorPanel; NSInteger returnCode, numberOfComponents = 0; for (i = 1; i < objc; i += 2) { |
︙ | ︙ | |||
472 473 474 475 476 477 478 | colorPanel = [NSColorPanel sharedColorPanel]; [colorPanel orderOut:NSApp]; [colorPanel setContinuous:NO]; [colorPanel setBecomesKeyOnlyIfNeeded:NO]; [colorPanel setShowsAlpha: NO]; [colorPanel _setUseModalAppearance:YES]; if (title) { | | | 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | colorPanel = [NSColorPanel sharedColorPanel]; [colorPanel orderOut:NSApp]; [colorPanel setContinuous:NO]; [colorPanel setBecomesKeyOnlyIfNeeded:NO]; [colorPanel setShowsAlpha: NO]; [colorPanel _setUseModalAppearance:YES]; if (title) { NSString *s = [[TKNSString alloc] initWithTclUtfBytes:title length:-1]; [colorPanel setTitle:s]; [s release]; } if (initialColor) { [colorPanel setColor:initialColor]; } |
︙ | ︙ | |||
544 545 546 547 548 549 550 | filterInfo.allowedExtensions = [NSMutableArray array]; filterInfo.allowedExtensionsAllowAll = NO; if (filterInfo.doFileTypes) { for (FileFilter *filterPtr = fl.filters; filterPtr; filterPtr = filterPtr->next) { | | | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | filterInfo.allowedExtensions = [NSMutableArray array]; filterInfo.allowedExtensionsAllowAll = NO; if (filterInfo.doFileTypes) { for (FileFilter *filterPtr = fl.filters; filterPtr; filterPtr = filterPtr->next) { NSString *name = [[TKNSString alloc] initWithTclUtfBytes: filterPtr->name length:-1]; [filterInfo.fileTypeNames addObject:name]; [name release]; NSMutableArray *clauseextensions = [NSMutableArray array]; NSMutableArray *displayextensions = [NSMutableArray array]; bool allowsAll = NO; for (FileFilterClause *clausePtr = filterPtr->clauses; clausePtr; clausePtr = clausePtr->next) { for (GlobPattern *globPtr = clausePtr->patterns; globPtr; globPtr = globPtr->next) { const char *str = globPtr->pattern; while (*str && (*str == '*' || *str == '.')) { str++; } if (*str) { NSString *extension = [[TKNSString alloc] initWithTclUtfBytes:str length:-1]; if (![filterInfo.allowedExtensions containsObject:extension]) { [filterInfo.allowedExtensions addObject:extension]; } [clauseextensions addObject:extension]; [displayextensions addObject:[@"." stringByAppendingString:extension]]; |
︙ | ︙ | |||
615 616 617 618 619 620 621 | * Check that the typevariable exists. */ if (selectedFileTypeObj != NULL) { const char *selectedFileType = Tcl_GetString(selectedFileTypeObj); NSString *selectedFileTypeStr = | | | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | * Check that the typevariable exists. */ if (selectedFileTypeObj != NULL) { const char *selectedFileType = Tcl_GetString(selectedFileTypeObj); NSString *selectedFileTypeStr = [[TKNSString alloc] initWithTclUtfBytes:selectedFileType length:-1]; NSUInteger index = [filterInfo.fileTypeNames indexOfObject:selectedFileTypeStr]; if (index != NSNotFound) { filterInfo.fileTypeIndex = index; filterInfo.preselectFilter = true; } |
︙ | ︙ | |||
674 675 676 677 678 679 680 | int Tk_GetOpenFileObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { | | < < | 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | int Tk_GetOpenFileObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, len, multiple = 0; Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; NSString *directory = nil, *filename = nil; NSString *message = nil, *title = nil; NSWindow *parent; openpanel = [NSOpenPanel openPanel]; NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; |
︙ | ︙ | |||
708 709 710 711 712 713 714 | break; case OPEN_FILETYPES: fileTypesPtr = objv[i + 1]; break; case OPEN_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { | | | > | < > > | < > | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | break; case OPEN_FILETYPES: fileTypesPtr = objv[i + 1]; break; case OPEN_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { directory = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case OPEN_INITFILE: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { filename = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case OPEN_MESSAGE: str = Tcl_GetStringFromObj(objv[i + 1], &len); message = [[TKNSString alloc] initWithTclUtfBytes: str length:len]; break; case OPEN_MULTIPLE: if (Tcl_GetBooleanFromObj(interp, objv[i + 1], &multiple) != TCL_OK) { goto end; } break; case OPEN_PARENT: str = Tcl_GetStringFromObj(objv[i + 1], &len); tkwin = Tk_NameToWindow(interp, str, tkwin); if (!tkwin) { goto end; } haveParentOption = 1; break; case OPEN_TITLE: str = Tcl_GetStringFromObj(objv[i + 1], &len); title = [[TKNSString alloc] initWithTclUtfBytes: str length:len]; break; case OPEN_TYPEVARIABLE: typeVariablePtr = objv[i + 1]; break; case OPEN_COMMAND: cmdObj = objv[i+1]; break; |
︙ | ︙ | |||
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | [label setEditable:NO]; [label setStringValue:@"Filter:"]; [label setBordered:NO]; [label setBezeled:NO]; [label setDrawsBackground:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton setAction:@selector(selectFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; if (filterInfo.preselectFilter) { /* * A specific filter was selected from the typevariable. Select it * and open the accessory view. */ [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; /* * On OSX > 10.11, the options are not visible by default. Ergo * allow all file types [openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; */ | > | | < < < < | > > > | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | [label setEditable:NO]; [label setStringValue:@"Filter:"]; [label setBordered:NO]; [label setBezeled:NO]; [label setDrawsBackground:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton setTarget:NSApp]; [popupButton setAction:@selector(selectFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; if (filterInfo.preselectFilter) { /* * A specific filter was selected from the typevariable. Select it * and open the accessory view. */ [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; /* * On OSX > 10.11, the options are not visible by default. Ergo * allow all file types [openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; */ setAllowedFileTypes(openpanel, filterInfo.allowedExtensions); } else { setAllowedFileTypes(openpanel, filterInfo.allowedExtensions); } if (filterInfo.allowedExtensionsAllowAll) { [openpanel setAllowsOtherFileTypes:YES]; } else { [openpanel setAllowsOtherFileTypes:NO]; } [openpanel setAccessoryView:accessoryView]; } else { /* * No filters are given. Allow picking all files. */ [openpanel setAllowsOtherFileTypes:YES]; } if (cmdObj) { if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } if (directory || filename) { NSURL *fileURL = getFileURL(directory, filename); [openpanel setDirectoryURL:fileURL]; } if (haveParentOption) { parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; parentIsKey = False; } modalReturnCode = showOpenSavePanel(openpanel, parent, interp, cmdObj, multiple); if (cmdObj) { Tcl_DecrRefCount(cmdObj); } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } if ((typeVariablePtr && (modalReturnCode == NSOKButton)) && filterInfo.doFileTypes) { /* |
︙ | ︙ | |||
951 952 953 954 955 956 957 | { Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int confirmOverwrite = 1; int index, len; Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; | < < | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | { Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int confirmOverwrite = 1; int index, len; Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; NSString *directory = nil, *filename = nil, *defaultType = nil; NSString *message = nil, *title = nil; NSWindow *parent; savepanel = [NSSavePanel savePanel]; NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; |
︙ | ︙ | |||
975 976 977 978 979 980 981 | Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL); goto end; } switch (index) { case SAVE_DEFAULT: str = Tcl_GetStringFromObj(objv[i + 1], &len); while (*str && (*str == '*' || *str == '.')) { | | | | | > | < > > | < > | 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL); goto end; } switch (index) { case SAVE_DEFAULT: str = Tcl_GetStringFromObj(objv[i + 1], &len); while (*str && (*str == '*' || *str == '.')) { str++; len--; } if (*str) { defaultType = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case SAVE_FILETYPES: fileTypesPtr = objv[i + 1]; break; case SAVE_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { directory = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case SAVE_INITFILE: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { filename = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; [savepanel setNameFieldStringValue:filename]; } break; case SAVE_MESSAGE: str = Tcl_GetStringFromObj(objv[i + 1], &len); message = [[TKNSString alloc] initWithTclUtfBytes: str length:len]; break; case SAVE_PARENT: str = Tcl_GetStringFromObj(objv[i + 1], &len); tkwin = Tk_NameToWindow(interp, str, tkwin); if (!tkwin) { goto end; } haveParentOption = 1; break; case SAVE_TITLE: str = Tcl_GetStringFromObj(objv[i + 1], &len); title = [[TKNSString alloc] initWithTclUtfBytes: str length:len]; break; case SAVE_TYPEVARIABLE: typeVariablePtr = objv[i + 1]; break; case SAVE_COMMAND: cmdObj = objv[i+1]; break; |
︙ | ︙ | |||
1080 1081 1082 1083 1084 1085 1086 1087 | [label setDrawsBackground:NO]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 340, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; [popupButton setAction:@selector(saveFormat:)]; | > < > | | < < < < | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | [label setDrawsBackground:NO]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 340, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; [popupButton setTarget:NSApp]; [popupButton setAction:@selector(saveFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; [savepanel setAccessoryView:accessoryView]; setAllowedFileTypes(savepanel, [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]); [savepanel setAllowsOtherFileTypes:filterInfo.allowedExtensionsAllowAll]; } else if (defaultType) { /* * If no filetypes are given, defaultextension is an alternative way to * specify the attached extension. Just propose this extension, but * don't display an accessory view. */ NSMutableArray *AllowedFileTypes = [NSMutableArray array]; [AllowedFileTypes addObject:defaultType]; setAllowedFileTypes(savepanel, AllowedFileTypes); [savepanel setAllowsOtherFileTypes:YES]; } [savepanel setCanSelectHiddenExtension:YES]; [savepanel setExtensionHidden:NO]; if (cmdObj) { if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } /* * Check for file name and set to the empty string if nil. This prevents a crash |
︙ | ︙ | |||
1138 1139 1140 1141 1142 1143 1144 | if (haveParentOption) { parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; parentIsKey = False; } | | > > > | 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | if (haveParentOption) { parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; parentIsKey = False; } modalReturnCode = showOpenSavePanel(savepanel, parent, interp, cmdObj, 0); if (cmdObj) { Tcl_DecrRefCount(cmdObj); } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } if (typeVariablePtr && (modalReturnCode == NSOKButton) && filterInfo.doFileTypes) { |
︙ | ︙ | |||
1192 1193 1194 1195 1196 1197 1198 | Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, len, mustexist = 0; Tcl_Obj *cmdObj = NULL; | < < | 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 | Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, len, mustexist = 0; Tcl_Obj *cmdObj = NULL; NSString *directory = nil; NSString *message, *title; NSWindow *parent; NSOpenPanel *panel = [NSOpenPanel openPanel]; NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; |
︙ | ︙ | |||
1216 1217 1218 1219 1220 1221 1222 | Tcl_SetErrorCode(interp, "TK", "DIRDIALOG", "VALUE", NULL); goto end; } switch (index) { case CHOOSE_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { | | > | < > > | < > < < < < | > > > | 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | Tcl_SetErrorCode(interp, "TK", "DIRDIALOG", "VALUE", NULL); goto end; } switch (index) { case CHOOSE_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { directory = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case CHOOSE_MESSAGE: str = Tcl_GetStringFromObj(objv[i + 1], &len); message = [[TKNSString alloc] initWithTclUtfBytes: str length:len]; [panel setMessage:message]; [message release]; break; case CHOOSE_MUSTEXIST: if (Tcl_GetBooleanFromObj(interp, objv[i + 1], &mustexist) != TCL_OK) { goto end; } break; case CHOOSE_PARENT: str = Tcl_GetStringFromObj(objv[i + 1], &len); tkwin = Tk_NameToWindow(interp, str, tkwin); if (!tkwin) { goto end; } haveParentOption = 1; break; case CHOOSE_TITLE: str = Tcl_GetStringFromObj(objv[i + 1], &len); title = [[TKNSString alloc] initWithTclUtfBytes: str length:len]; [panel setTitle:title]; [title release]; break; case CHOOSE_COMMAND: cmdObj = objv[i+1]; break; } } [panel setPrompt:@"Choose"]; [panel setCanChooseFiles:NO]; [panel setCanChooseDirectories:YES]; [panel setCanCreateDirectories:!mustexist]; if (cmdObj) { if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } /* * Check for directory value, set to root if not specified; otherwise * crashes with exception because of nil string parameter. */ if (!directory) { directory = @"/"; } parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; if (haveParentOption) { parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; parentIsKey = False; } modalReturnCode = showOpenSavePanel(panel, parent, interp, cmdObj, 0); if (cmdObj) { Tcl_DecrRefCount(cmdObj); } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } end: return result; } |
︙ | ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | * *---------------------------------------------------------------------- */ void TkAboutDlg(void) { | < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | * *---------------------------------------------------------------------- */ void TkAboutDlg(void) { [NSApp orderFrontStandardAboutPanel:nil]; } /* *---------------------------------------------------------------------- * * TkMacOSXStandardAboutPanelObjCmd -- * * Implements the ::tk::mac::standardAboutPanel command. * |
︙ | ︙ | |||
1396 1397 1398 1399 1400 1401 1402 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { if (objc > 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } | | | 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { if (objc > 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } [NSApp orderFrontStandardAboutPanel:nil]; return TCL_OK; } /* *---------------------------------------------------------------------- * * Tk_MessageBoxObjCmd -- |
︙ | ︙ | |||
1429 1430 1431 1432 1433 1434 1435 | { Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, typeIndex, iconIndex, indexDefaultOption = 0; int defaultNativeButtonIndex = 1; /* 1, 2, 3: right to left */ Tcl_Obj *cmdObj = NULL; | | | 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 | { Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, typeIndex, iconIndex, indexDefaultOption = 0; int defaultNativeButtonIndex = 1; /* 1, 2, 3: right to left */ Tcl_Obj *cmdObj = NULL; AlertCallbackInfo callbackInfo; NSString *message, *title; NSWindow *parent; NSArray *buttons; NSAlert *alert = [NSAlert new]; NSInteger modalReturnCode = 1; BOOL parentIsKey = NO; |
︙ | ︙ | |||
1461 1462 1463 1464 1465 1466 1467 | * know the '-type' as well. */ indexDefaultOption = i; break; case ALERT_DETAIL: | < | > > < | > > < | > > | 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 | * know the '-type' as well. */ indexDefaultOption = i; break; case ALERT_DETAIL: str = Tcl_GetString(objv[i + 1]); message = [[TKNSString alloc] initWithTclUtfBytes: str length:-1]; [alert setInformativeText:message]; [message release]; break; case ALERT_ICON: if (Tcl_GetIndexFromObjStruct(interp, objv[i + 1], alertIconStrings, sizeof(char *), "-icon value", TCL_EXACT, &iconIndex) != TCL_OK) { goto end; } break; case ALERT_MESSAGE: str = Tcl_GetString(objv[i + 1]); message = [[TKNSString alloc] initWithTclUtfBytes: str length:-1]; [alert setMessageText:message]; [message release]; break; case ALERT_PARENT: str = Tcl_GetString(objv[i + 1]); tkwin = Tk_NameToWindow(interp, str, tkwin); if (!tkwin) { goto end; } haveParentOption = 1; break; case ALERT_TITLE: str = Tcl_GetString(objv[i + 1]); title = [[TKNSString alloc] initWithTclUtfBytes: str length:-1]; [[alert window] setTitle:title]; [title release]; break; case ALERT_TYPE: if (Tcl_GetIndexFromObjStruct(interp, objv[i + 1], alertTypeStrings, sizeof(char *), "-type value", TCL_EXACT, &typeIndex) != TCL_OK) { |
︙ | ︙ | |||
1557 1558 1559 1560 1561 1562 1563 | setKeyEquivalent: @"\r"]; if (cmdObj) { if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } | < | | | | | | > > > | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 | setKeyEquivalent: @"\r"]; if (cmdObj) { if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } callbackInfo.cmdObj = cmdObj; callbackInfo.interp = interp; callbackInfo.typeIndex = typeIndex; parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 [alert beginSheetModalForWindow:parent completionHandler:^(NSModalResponse returnCode) { [NSApp tkAlertDidEnd:alert returnCode:returnCode contextInfo:&callbackInfo]; }]; #else [alert beginSheetModalForWindow:parent modalDelegate:NSApp didEndSelector:@selector(tkAlertDidEnd:returnCode:contextInfo:) contextInfo:&callbackInfo]; #endif modalReturnCode = cmdObj ? 0 : [alert runModal]; } else { modalReturnCode = [alert runModal]; [NSApp tkAlertDidEnd:alert returnCode:modalReturnCode contextInfo:&callbackInfo]; } if (cmdObj) { Tcl_DecrRefCount(cmdObj); } result = (modalReturnCode >= NSAlertFirstButtonReturn) ? TCL_OK : TCL_ERROR; end: [alert release]; if (parentIsKey) { [parent makeKeyWindow]; } |
︙ | ︙ | |||
1645 1646 1647 1648 1649 1650 1651 | }; static Tcl_Interp *fontchooserInterp = NULL; static NSFont *fontPanelFont = nil; static NSMutableDictionary *fontPanelFontAttributes = nil; static const char *const fontchooserOptionStrings[] = { | | | | 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 | }; static Tcl_Interp *fontchooserInterp = NULL; static NSFont *fontPanelFont = nil; static NSMutableDictionary *fontPanelFontAttributes = nil; static const char *const fontchooserOptionStrings[] = { "-command", "-font", "-parent", "-title", "-visible", NULL }; enum FontchooserOption { FontchooserCmd, FontchooserFont, FontchooserParent, FontchooserTitle, FontchooserVisible }; @implementation TKApplication(TKFontPanel) - (void) changeFont: (id) sender { |
︙ | ︙ | |||
1730 1731 1732 1733 1734 1735 1736 | { FontchooserData *fcdPtr; Tcl_Obj *fontObj; if (!fontchooserInterp) { return; } | | | | 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 | { FontchooserData *fcdPtr; Tcl_Obj *fontObj; if (!fontchooserInterp) { return; } fcdPtr = (FontchooserData *)Tcl_GetAssocData(fontchooserInterp, "::tk::fontchooser", NULL); switch (kind) { case FontchooserClosed: if (fcdPtr->parent != NULL) { Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL); fontchooserInterp = NULL; } break; case FontchooserSelection: fontObj = TkMacOSXFontDescriptionForNSFontAndNSFontAttributes( fontPanelFont, fontPanelFontAttributes); |
︙ | ︙ | |||
1789 1790 1791 1792 1793 1794 1795 | FontchooserData *fcdPtr, int optionIndex) { Tcl_Obj *resObj = NULL; switch(optionIndex) { case FontchooserParent: | | | 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 | FontchooserData *fcdPtr, int optionIndex) { Tcl_Obj *resObj = NULL; switch(optionIndex) { case FontchooserParent: if (fcdPtr->parent != NULL) { resObj = Tcl_NewStringObj( ((TkWindow *)fcdPtr->parent)->pathName, -1); } else { resObj = Tcl_NewStringObj(".", 1); } break; case FontchooserTitle: |
︙ | ︙ | |||
1818 1819 1820 1821 1822 1823 1824 | if (fcdPtr->cmdObj) { resObj = fcdPtr->cmdObj; } else { resObj = Tcl_NewObj(); } break; case FontchooserVisible: | | | | 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 | if (fcdPtr->cmdObj) { resObj = fcdPtr->cmdObj; } else { resObj = Tcl_NewObj(); } break; case FontchooserVisible: resObj = Tcl_NewBooleanObj([[[NSFontManager sharedFontManager] fontPanel:NO] isVisible]); break; default: resObj = Tcl_NewObj(); } return resObj; } |
︙ | ︙ | |||
1852 1853 1854 1855 1856 1857 1858 | FontchooserConfigureCmd( ClientData clientData, /* Main window */ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tk_Window tkwin = (Tk_Window)clientData; | | | 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 | FontchooserConfigureCmd( ClientData clientData, /* Main window */ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tk_Window tkwin = (Tk_Window)clientData; FontchooserData *fcdPtr = (FontchooserData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); int i, r = TCL_OK; /* * With no arguments we return all the options in a dict */ |
︙ | ︙ | |||
1909 1910 1911 1912 1913 1914 1915 | Tcl_SetErrorCode(interp, "TK", "FONTDIALOG", "READONLY", NULL); return TCL_ERROR; } case FontchooserParent: { Tk_Window parent = Tk_NameToWindow(interp, Tcl_GetString(objv[i+1]), tkwin); | | | 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 | Tcl_SetErrorCode(interp, "TK", "FONTDIALOG", "READONLY", NULL); return TCL_ERROR; } case FontchooserParent: { Tk_Window parent = Tk_NameToWindow(interp, Tcl_GetString(objv[i+1]), tkwin); if (parent == NULL) { return TCL_ERROR; } if (fcdPtr->parent) { Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); } fcdPtr->parent = parent; |
︙ | ︙ | |||
1936 1937 1938 1939 1940 1941 1942 | fcdPtr->titleObj = Tcl_DuplicateObj(fcdPtr->titleObj); } Tcl_IncrRefCount(fcdPtr->titleObj); } else { fcdPtr->titleObj = NULL; } break; | | | 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 | fcdPtr->titleObj = Tcl_DuplicateObj(fcdPtr->titleObj); } Tcl_IncrRefCount(fcdPtr->titleObj); } else { fcdPtr->titleObj = NULL; } break; case FontchooserFont: { Tcl_GetStringFromObj(objv[i+1], &len); if (len) { Tk_Font f = Tk_AllocFontFromObj(interp, tkwin, objv[i+1]); if (!f) { return TCL_ERROR; } |
︙ | ︙ | |||
1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 | [fm setSelectedAttributes:fontPanelFontAttributes isMultiple:NO]; if ([fp isVisible]) { Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged", NULL); } break; case FontchooserCmd: if (fcdPtr->cmdObj) { Tcl_DecrRefCount(fcdPtr->cmdObj); } Tcl_GetStringFromObj(objv[i+1], &len); if (len) { fcdPtr->cmdObj = objv[i+1]; | > | 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 | [fm setSelectedAttributes:fontPanelFontAttributes isMultiple:NO]; if ([fp isVisible]) { Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged", NULL); } break; } case FontchooserCmd: if (fcdPtr->cmdObj) { Tcl_DecrRefCount(fcdPtr->cmdObj); } Tcl_GetStringFromObj(objv[i+1], &len); if (len) { fcdPtr->cmdObj = objv[i+1]; |
︙ | ︙ | |||
2015 2016 2017 2018 2019 2020 2021 | static int FontchooserShowCmd( ClientData clientData, /* Main window */ Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { | | | | 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 | static int FontchooserShowCmd( ClientData clientData, /* Main window */ Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { FontchooserData *fcdPtr = (FontchooserData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); if (fcdPtr->parent == NULL) { fcdPtr->parent = (Tk_Window)clientData; Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); } NSFontManager *fm = [NSFontManager sharedFontManager]; NSFontPanel *fp = [fm fontPanel:YES]; |
︙ | ︙ | |||
2093 2094 2095 2096 2097 2098 2099 | */ static void FontchooserParentEventHandler( ClientData clientData, XEvent *eventPtr) { | | | 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 | */ static void FontchooserParentEventHandler( ClientData clientData, XEvent *eventPtr) { FontchooserData *fcdPtr = (FontchooserData *)clientData; if (eventPtr->type == DestroyNotify) { Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); fcdPtr->parent = NULL; FontchooserHideCmd(NULL, NULL, 0, NULL); } |
︙ | ︙ | |||
2125 2126 2127 2128 2129 2130 2131 | */ static void DeleteFontchooserData( ClientData clientData, Tcl_Interp *interp) { | | | 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 | */ static void DeleteFontchooserData( ClientData clientData, Tcl_Interp *interp) { FontchooserData *fcdPtr = (FontchooserData *)clientData; if (fcdPtr->titleObj) { Tcl_DecrRefCount(fcdPtr->titleObj); } if (fcdPtr->cmdObj) { Tcl_DecrRefCount(fcdPtr->cmdObj); } |
︙ | ︙ |
Changes to macosx/tkMacOSXDraw.c.
1 2 3 4 5 6 | /* * tkMacOSXDraw.c -- * * This file contains functions that draw to windows. Many of thees * functions emulate Xlib functions. * | | | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | /* * tkMacOSXDraw.c -- * * This file contains functions that draw to windows. Many of thees * functions emulate Xlib functions. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2014-2020 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXDebug.h" #include "tkButton.h" #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 #define GET_CGCONTEXT [[NSGraphicsContext currentContext] CGContext] #else #define GET_CGCONTEXT [[NSGraphicsContext currentContext] graphicsPort] #endif /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_DRAWING #define TK_MAC_DEBUG_IMAGE_DRAWING #define TK_MAC_DEBUG_CG #endif */ #define radians(d) ((d) * (M_PI/180.0)) /* * Non-antialiased CG drawing looks better and more like X11 drawing when using |
︙ | ︙ | |||
128 129 130 131 132 133 134 | Display *display, Tk_Image image, int width, int height) { Pixmap pixmap; NSImage *nsImage; | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | Display *display, Tk_Image image, int width, int height) { Pixmap pixmap; NSImage *nsImage; if (width <= 0 || height <= 0) { return nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0,0)]; } pixmap = Tk_GetPixmap(display, None, width, height, 0); Tk_RedrawImage(image, 0, 0, width, height, pixmap, 0, 0); nsImage = CreateNSImageFromPixmap(pixmap, width, height); Tk_FreePixmap(display, pixmap); |
︙ | ︙ | |||
527 528 529 530 531 532 533 | int XFillPolygon( Display *display, /* Display. */ Drawable d, /* Draw on this. */ GC gc, /* Use this GC. */ XPoint *points, /* Array of points. */ int npoints, /* Number of points. */ | | | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | int XFillPolygon( Display *display, /* Display. */ Drawable d, /* Draw on this. */ GC gc, /* Use this GC. */ XPoint *points, /* Array of points. */ int npoints, /* Number of points. */ TCL_UNUSED(int), /* Shape to draw. */ int mode) /* Drawing mode. */ { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i; display->request++; |
︙ | ︙ | |||
557 558 559 560 561 562 563 | macWin->yOff + points[i].y + o); } else { prevx += points[i].x; prevy += points[i].y; CGContextAddLineToPoint(dc.context, prevx, prevy); } } | > | > | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | macWin->yOff + points[i].y + o); } else { prevx += points[i].x; prevy += points[i].y; CGContextAddLineToPoint(dc.context, prevx, prevy); } } (gc->fill_rule == EvenOddRule) ? CGContextEOFillPath(dc.context) : CGContextFillPath(dc.context); } TkMacOSXRestoreDrawingContext(&dc); return Success; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1114 1115 1116 1117 1118 1119 1120 | int width, int height, int dx, int dy, /* Distance rectangle should be moved. */ Region damageRgn) /* Region to accumulate damage in. */ { Drawable drawable = Tk_WindowId(tkwin); MacDrawable *macDraw = (MacDrawable *)drawable; TKContentView *view = (TKContentView *)TkMacOSXGetNSViewForDrawable(macDraw); | | | | > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | > > > | > > | > > > > > > > > > > | | > > > < | < | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | int width, int height, int dx, int dy, /* Distance rectangle should be moved. */ Region damageRgn) /* Region to accumulate damage in. */ { Drawable drawable = Tk_WindowId(tkwin); MacDrawable *macDraw = (MacDrawable *)drawable; TKContentView *view = (TKContentView *)TkMacOSXGetNSViewForDrawable(macDraw); HIShapeRef srcRgn, dstRgn; HIMutableShapeRef dmgRgn = HIShapeCreateMutable(); NSRect bounds, viewSrcRect, srcRect, dstRect; int result = 0; if (view) { /* * Get the scroll area in NSView coordinates (origin at bottom left). */ bounds = [view bounds]; viewSrcRect = NSMakeRect(macDraw->xOff + x, bounds.size.height - height - (macDraw->yOff + y), width, height); /* * Scroll the rectangle. */ [view scrollRect:viewSrcRect by:NSMakeSize(dx, -dy)]; /* * Compute the damage region, using Tk coordinates (origin at top left). */ srcRect = CGRectMake(x, y, width, height); dstRect = CGRectOffset(srcRect, dx, dy); srcRgn = HIShapeCreateWithRect(&srcRect); dstRgn = HIShapeCreateWithRect(&dstRect); ChkErr(HIShapeDifference, srcRgn, dstRgn, dmgRgn); result = HIShapeIsEmpty(dmgRgn) ? 0 : 1; } /* * Convert the HIShape dmgRgn into a TkRegion and store it. */ TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); /* * Mutable shapes are not reference counted, and must be released. */ CFRelease(dmgRgn); return result; } /* *---------------------------------------------------------------------- * * TkMacOSXSetUpGraphicsPort -- |
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | GC gc, TkMacOSXDrawingContext *dcPtr) { MacDrawable *macDraw = (MacDrawable *)d; Bool canDraw = true; TKContentView *view = nil; TkMacOSXDrawingContext dc = {}; /* * If the drawable is not a pixmap, get the associated NSView. */ if (!(macDraw->flags & TK_IS_PIXMAP)) { view = (TKContentView *)TkMacOSXGetNSViewForDrawable(d); | > > > > > > | 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 | GC gc, TkMacOSXDrawingContext *dcPtr) { MacDrawable *macDraw = (MacDrawable *)d; Bool canDraw = true; TKContentView *view = nil; TkMacOSXDrawingContext dc = {}; CGFloat drawingHeight; #ifdef TK_MAC_DEBUG_CG fprintf(stderr, "TkMacOSXSetupDrawingContext: %s\n", macDraw->winPtr ? Tk_PathName(macDraw->winPtr) : "None"); #endif /* * If the drawable is not a pixmap, get the associated NSView. */ if (!(macDraw->flags & TK_IS_PIXMAP)) { view = (TKContentView *)TkMacOSXGetNSViewForDrawable(d); |
︙ | ︙ | |||
1269 1270 1271 1272 1273 1274 1275 | /* * If the drawable already has a CGContext, use it. Otherwise, we must be * drawing to a window and we use the current context of its ContentView. */ dc.context = TkMacOSXGetCGContextForDrawable(d); | | < < < < | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | /* * If the drawable already has a CGContext, use it. Otherwise, we must be * drawing to a window and we use the current context of its ContentView. */ dc.context = TkMacOSXGetCGContextForDrawable(d); if (!dc.context) { NSRect drawingBounds, currentBounds; dc.view = view; dc.context = GET_CGCONTEXT; if (dc.clipRgn) { CGRect clipBounds; CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0, .ty = [view bounds].size.height}; HIShapeGetBounds(dc.clipRgn, &clipBounds); clipBounds = CGRectApplyAffineTransform(clipBounds, t); drawingBounds = NSRectFromCGRect(clipBounds); |
︙ | ︙ | |||
1318 1319 1320 1321 1322 1323 1324 | * the clipping rectangle set by drawRect does not contain the clipping * region of our drawing context. (See bug [2a61eca3a8].) If part of * the drawing bounds will be clipped then we draw whatever we can, but * we also add the drawing bounds to the view's dirty rectangle so it * will get redrawn in the next call to its drawRect method. */ | | > > > > > > > > > > | | | | | | < < < < < | > < < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 | * the clipping rectangle set by drawRect does not contain the clipping * region of our drawing context. (See bug [2a61eca3a8].) If part of * the drawing bounds will be clipped then we draw whatever we can, but * we also add the drawing bounds to the view's dirty rectangle so it * will get redrawn in the next call to its drawRect method. */ currentBounds = NSRectFromCGRect(CGContextGetClipBoundingBox(dc.context)); if (!NSContainsRect(currentBounds, drawingBounds)) { [view addTkDirtyRect:drawingBounds]; } } /* * Finish configuring the drawing context. */ #ifdef TK_MAC_DEBUG_CG fprintf(stderr, "TkMacOSXSetupDrawingContext: pushing GState for %s\n", macDraw->winPtr ? Tk_PathName(macDraw->winPtr) : "None"); #endif CGContextSaveGState(dc.context); CGContextSetTextDrawingMode(dc.context, kCGTextFill); { /* Restricted scope for t needed for C++ */ drawingHeight = view ? [view bounds].size.height : CGContextGetClipBoundingBox(dc.context).size.height; CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0, .ty = drawingHeight }; CGContextConcatCTM(dc.context, t); } if (dc.clipRgn) { #ifdef TK_MAC_DEBUG_DRAWING CGContextSaveGState(dc.context); ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); CGContextEOFillPath(dc.context); CGContextRestoreGState(dc.context); #endif /* TK_MAC_DEBUG_DRAWING */ if (!HIShapeIsRectangular(dc.clipRgn)) { /* * We expect the clipping path dc.clipRgn to consist of the * bounding rectangle of the drawable window, together with * disjoint smaller rectangles inside of it which bound its * geometric children. In that case the even-odd rule will * clip to the region inside the large rectangle and outside * of the smaller rectangles. */ ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); #ifdef TK_MAC_DEBUG_CG fprintf(stderr, "Setting complex clip for %s to:\n", macDraw->winPtr ? Tk_PathName(macDraw->winPtr) : "None"); TkMacOSXPrintRectsInRegion(dc.clipRgn); #endif CGContextEOClip(dc.context); } else { CGRect r; HIShapeGetBounds(dc.clipRgn, &r); #ifdef TK_MAC_DEBUG_CG fprintf(stderr, "Current clip BBox is %s\n", NSStringFromRect(CGContextGetClipBoundingBox(GET_CGCONTEXT)).UTF8String); fprintf(stderr, "Setting clip for %s to rect %s:\n", macDraw->winPtr ? Tk_PathName(macDraw->winPtr) : "None", NSStringFromRect(r).UTF8String); #endif CGContextClipToRect(dc.context, r); } } if (gc) { static const CGLineCap cgCap[] = { [CapNotLast] = kCGLineCapButt, [CapButt] = kCGLineCapButt, [CapRound] = kCGLineCapRound, [CapProjecting] = kCGLineCapSquare, }; static const CGLineJoin cgJoin[] = { [JoinMiter] = kCGLineJoinMiter, [JoinRound] = kCGLineJoinRound, [JoinBevel] = kCGLineJoinBevel, }; bool shouldAntialias = !notAA(gc->line_width); double w = gc->line_width; TkMacOSXSetColorInContext(gc, gc->foreground, dc.context); if (view) { CGSize size = NSSizeToCGSize([view bounds].size); CGContextSetPatternPhase(dc.context, size); } if (gc->function != GXcopy) { TkMacOSXDbgMsg("Logical functions other than GXcopy are " "not supported for CG drawing!"); } if (!shouldAntialias) { |
︙ | ︙ | |||
1417 1418 1419 1420 1421 1422 1423 | CGContextSetLineJoin(dc.context, cgJoin[(unsigned) gc->join_style]); } } end: #ifdef TK_MAC_DEBUG_DRAWING | | < < < | | < | 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | CGContextSetLineJoin(dc.context, cgJoin[(unsigned) gc->join_style]); } } end: #ifdef TK_MAC_DEBUG_DRAWING if (!canDraw && macDraw->winPtr != NULL) { fprintf(stderr, "Cannot draw in %s - postponing.\n", Tk_PathName(macDraw->winPtr)); } #endif if (!canDraw && dc.clipRgn) { CFRelease(dc.clipRgn); dc.clipRgn = NULL; } |
︙ | ︙ | |||
1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 | void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr) { if (dcPtr->context) { CGContextSynchronize(dcPtr->context); CGContextRestoreGState(dcPtr->context); } if (dcPtr->clipRgn) { CFRelease(dcPtr->clipRgn); } #ifdef TK_MAC_DEBUG bzero(dcPtr, sizeof(TkMacOSXDrawingContext)); | > > > > > > > | > | 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 | void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr) { if (dcPtr->context) { CGContextSynchronize(dcPtr->context); CGContextRestoreGState(dcPtr->context); #ifdef TK_MAC_DEBUG_CG fprintf(stderr, "TkMacOSXRestoreDrawingContext: popped GState\n"); #endif } if (dcPtr->clipRgn) { CFRelease(dcPtr->clipRgn); dcPtr->clipRgn = NULL; } #ifdef TK_MAC_DEBUG bzero(dcPtr, sizeof(TkMacOSXDrawingContext)); #endif } /* *---------------------------------------------------------------------- * * TkMacOSXGetClipRgn -- * |
︙ | ︙ | |||
1520 1521 1522 1523 1524 1525 1526 | } return clipRgn; } /* *---------------------------------------------------------------------- * | | | | 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | } return clipRgn; } /* *---------------------------------------------------------------------- * * Tk_ClipDrawableToRect -- * * Clip all drawing into the drawable d to the given rectangle. If width * or height are negative, reset to no clipping. * * Results: * None. * * Side effects: * Subsequent drawing into d is offset and clipped as specified. * *---------------------------------------------------------------------- */ void Tk_ClipDrawableToRect( TCL_UNUSED(Display *), Drawable d, int x, int y, int width, int height) { MacDrawable *macDraw = (MacDrawable *)d; |
︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | { return NULL; } /* *---------------------------------------------------------------------- * | | | 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 | { return NULL; } /* *---------------------------------------------------------------------- * * Tk_DrawHighlightBorder -- * * This procedure draws a rectangular ring around the outside of a widget * to indicate that it has received the input focus. * * On the Macintosh, this puts a 1 pixel border in the bgGC color between * the widget and the focus ring, except in the case where highlightWidth * is 1, in which case the border is left out. |
︙ | ︙ | |||
1658 1659 1660 1661 1662 1663 1664 | * A rectangle "width" pixels wide is drawn in "drawable", corresponding * to the outer area of "tkwin". * *---------------------------------------------------------------------- */ void | | | 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 | * A rectangle "width" pixels wide is drawn in "drawable", corresponding * to the outer area of "tkwin". * *---------------------------------------------------------------------- */ void Tk_DrawHighlightBorder ( Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable) { if (highlightWidth == 1) { |
︙ | ︙ |
Changes to macosx/tkMacOSXEmbed.c.
1 2 3 4 5 6 7 8 9 | /* * tkMacOSXEmbed.c -- * * This file contains platform-specific procedures for theMac to provide * basic operations needed for application embedding (where one * application can use as its main window an internal window from some * other application). Currently only Toplevel embedding within the same * Tk application is allowed on the Macintosh. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tkMacOSXEmbed.c -- * * This file contains platform-specific procedures for theMac to provide * basic operations needed for application embedding (where one * application can use as its main window an internal window from some * other application). Currently only Toplevel embedding within the same * Tk application is allowed on the Macintosh. * * Copyright © 1996-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkBusy.h" |
︙ | ︙ | |||
71 72 73 74 75 76 77 | * Side effects: * None. * *---------------------------------------------------------------------- */ Window | | | > | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | * Side effects: * None. * *---------------------------------------------------------------------- */ Window Tk_MakeWindow( Tk_Window tkwin, Window parent) { MacDrawable *macWin; TkWindow *winPtr = (TkWindow *)tkwin; (void)parent; /* * If this window is marked as embedded then the window structure should * have already been created in the Tk_UseWindow function. */ if (Tk_IsEmbedded(winPtr)) { macWin = winPtr->privatePtr; } else { /* * Allocate sub window |
︙ | ︙ | |||
174 175 176 177 178 179 180 | } return code; } /* *---------------------------------------------------------------------- * | | | | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | } return code; } /* *---------------------------------------------------------------------- * * Tk_UseWindow -- * * This procedure causes a Tk window to use a given X window as its * parent window, rather than the root window for the screen. It is * invoked by an embedded application to specify the window in which it * is embedded. * * Results: * The return value is normally TCL_OK. If an error occurs (such as * string not being a valid window spec), then the return value is * TCL_ERROR and an error message is left in the interp's result if * interp is non-NULL. * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tk_UseWindow( Tcl_Interp *interp, /* If not NULL, used for error reporting if * string is bogus. */ Tk_Window tkwin, /* Tk window that does not yet have an * associated X window. */ const char *string) /* String identifying an X window to use for * tkwin; must be an integer value. */ { |
︙ | ︙ | |||
318 319 320 321 322 323 324 | return TCL_OK; } /* *---------------------------------------------------------------------- * | | | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | return TCL_OK; } /* *---------------------------------------------------------------------- * * Tk_MakeContainer -- * * This procedure is called to indicate that a particular window will be * a container for an embedded application. This changes certain aspects * of the window's behavior, such as whether it will receive events * anymore. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void Tk_MakeContainer( Tk_Window tkwin) /* Token for a window that is about to become * a container. */ { TkWindow *winPtr = (TkWindow *) tkwin; Container *containerPtr; /* |
︙ | ︙ | |||
436 437 438 439 440 441 442 | { TkWindow *contWinPtr, *topWinPtr; topWinPtr = winPtr->privatePtr->toplevel->winPtr; if (!Tk_IsEmbedded(topWinPtr)) { return winPtr->privatePtr->toplevel; } | | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | { TkWindow *contWinPtr, *topWinPtr; topWinPtr = winPtr->privatePtr->toplevel->winPtr; if (!Tk_IsEmbedded(topWinPtr)) { return winPtr->privatePtr->toplevel; } contWinPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)topWinPtr); /* * TODO: Here we should handle out of process embedding. */ if (!contWinPtr) { return NULL; |
︙ | ︙ | |||
633 634 635 636 637 638 639 | /* TODO: Implement this or decide it definitely needs no implementation */ } /* *---------------------------------------------------------------------- * | | | | | | | | | | | | | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | /* TODO: Implement this or decide it definitely needs no implementation */ } /* *---------------------------------------------------------------------- * * Tk_GetOtherWindow -- * * If both the container and embedded window are in the same process, * this procedure will return either one, given the other. * * Results: * If tkwin is a container, the return value is the token for the * embedded window, and vice versa. If the "other" window isn't in this * process, NULL is returned. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tk_Window Tk_GetOtherWindow( Tk_Window tkwin) /* Tk's structure for a container or embedded * window. */ { Container *containerPtr; /* * Tk_GetOtherWindow returns NULL if both windows are not in the same * process... */ if (!(((TkWindow *)tkwin)->flags & TK_BOTH_HALVES)) { return NULL; } for (containerPtr = firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { if ((Tk_Window)containerPtr->embeddedPtr == tkwin) { return (Tk_Window)containerPtr->parentPtr; } else if ((Tk_Window)containerPtr->parentPtr == tkwin) { return (Tk_Window)containerPtr->embeddedPtr; } } return NULL; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
700 701 702 703 704 705 706 | */ static void EmbeddedEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { | | | 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | */ static void EmbeddedEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { EmbedWindowDeleted(winPtr); } } /* |
︙ | ︙ | |||
735 736 737 738 739 740 741 | */ static void ContainerEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { | | | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | */ static void ContainerEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { TkWindow *winPtr = (TkWindow *)clientData; Container *containerPtr; Tk_ErrorHandler errHandler; if (!firstContainerPtr) { /* * When the interpreter is being dismantled this can be nil. */ |
︙ | ︙ | |||
843 844 845 846 847 848 849 | */ static void EmbedStructureProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { | | | | 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | */ static void EmbedStructureProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = (Container *)clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { /* * Send a ConfigureNotify to the embedded application. */ if (containerPtr->embeddedPtr != NULL) { TkDoConfigureNotify(containerPtr->embeddedPtr); } if (containerPtr->embedded != None) { /* * Ignore errors, since the embedded application could have * deleted its window. */ |
︙ | ︙ | |||
897 898 899 900 901 902 903 | */ static void EmbedActivateProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { | | | 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | */ static void EmbedActivateProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = (Container *)clientData; if (containerPtr->embeddedPtr != NULL) { if (eventPtr->type == ActivateNotify) { TkGenerateActivateEvents(containerPtr->embeddedPtr,1); } else if (eventPtr->type == DeactivateNotify) { TkGenerateActivateEvents(containerPtr->embeddedPtr,0); } |
︙ | ︙ | |||
932 933 934 935 936 937 938 | */ static void EmbedFocusProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { | | | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | */ static void EmbedFocusProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = (Container *)clientData; Display *display; XEvent event; if (containerPtr->embeddedPtr != NULL) { display = Tk_Display(containerPtr->parentPtr); event.xfocus.serial = LastKnownRequestProcessed(display); event.xfocus.send_event = false; |
︙ | ︙ | |||
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | * Find the Container structure for this window. Delete the information * about the embedded application and free the container's record. */ prevPtr = NULL; containerPtr = firstContainerPtr; while (1) { if (containerPtr->embeddedPtr == winPtr) { /* * We also have to destroy our parent, to clean up the container. * Fabricate an event to do this. */ if (containerPtr->parentPtr != NULL && | > > > | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | * Find the Container structure for this window. Delete the information * about the embedded application and free the container's record. */ prevPtr = NULL; containerPtr = firstContainerPtr; while (1) { if (containerPtr == NULL) { return; } if (containerPtr->embeddedPtr == winPtr) { /* * We also have to destroy our parent, to clean up the container. * Fabricate an event to do this. */ if (containerPtr->parentPtr != NULL && |
︙ | ︙ |
Changes to macosx/tkMacOSXEntry.c.
1 2 3 4 5 | /* * tkMacOSXEntry.c -- * * This file implements the native aqua entry widget. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXEntry.c -- * * This file implements the native aqua entry widget. * * Copyright © 2001 Apple Computer, Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2008-2009 Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkEntry.h" |
︙ | ︙ |
Changes to macosx/tkMacOSXEvent.c.
1 2 3 4 5 | /* * tkMacOSXEvent.c -- * * This file contains the basic Mac OS X Event handling routines. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXEvent.c -- * * This file contains the basic Mac OS X Event handling routines. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009, Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXInt.h" |
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | default: break; /* return theEvent */ } return processedEvent; } @end #pragma mark - int XSync( Display *display, TCL_UNUSED(Bool)) { /* * The main use of XSync is by the update command, which alternates * between running an event loop to process all events without waiting and | > | | | | | > > > | < | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | default: break; /* return theEvent */ } return processedEvent; } @end #pragma mark - int XSync( Display *display, TCL_UNUSED(Bool)) { /* * The main use of XSync is by the update command, which alternates * between running an event loop to process all events without waiting and * calling XSync on all displays until no events are left. On X11 the * call to XSync might cause the window manager to generate more events * which would then get processed. Apparently this process stabilizes on * X11, leaving the window manager in a state where all events have been * generated and no additional events can be genereated by updating widgets. * * It is not clear what the Aqua port should do when XSync is called, but * currently the best option seems to be to do nothing. (See ticket * [da5f2266df].) */ display->request++; return 0; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Added macosx/tkMacOSXFileTypes.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | /* There are situations where a graphical user interface needs to know the file type (i.e. data format) of a file. The two main ones are when generating an icon to represent a file, and when filtering the choice of files in a file open or save dialog. Early Macintosh systems used OSTypes as identifiers for file types. An OSType is a FourCC datatype - four bytes which can be packed into a 32 bit integer. In the HFS filesystem they were included in the file metadata. The metadata also included another OSType (the Creator Code) which identified the application which created the file. In OSX 10.4 the Uniform Type Identifier was introduced as an alternative way to describe file types. These are strings (NSStrings, actually) in a reverse DNS format, such as "com.apple.application-bundle". Apple provided a tool for converting OSType codes to Uniform Type Identifiers, which they deprecated in macOS 12.0 after introducing the UTType class in macOS 11.0. An instance of the UTType class has properties which give the Uniform Type Identifier as well as the preferred file name extension for a given file type. This module provides tools for working with file types which are meant to abstract the many variants that Apple has used over the years, and which can be used without generating deprecation warnings. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXFileTypes.h" #if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 #import <UniformTypeIdentifiers/UniformTypeIdentifiers.h> #endif #define CHARS_TO_OSTYPE(string) (OSType) string[0] << 24 | \ (OSType) string[1] << 16 | \ (OSType) string[2] << 8 | \ (OSType) string[3] static BOOL initialized = false; static Tcl_HashTable ostype2identifier; static void initOSTypeTable(void) { int newPtr; Tcl_HashEntry *hPtr; const IdentifierForOSType *entry; Tcl_InitHashTable(&ostype2identifier, TCL_ONE_WORD_KEYS); for (entry = OSTypeDB; entry->ostype != NULL; entry++) { const char *key = INT2PTR(CHARS_TO_OSTYPE(entry->ostype)); hPtr = Tcl_CreateHashEntry(&ostype2identifier, key, &newPtr); if (newPtr) { Tcl_SetHashValue(hPtr, entry->identifier); } } initialized = true; } MODULE_SCOPE NSString *TkMacOSXOSTypeToUTI(OSType ostype) { if (!initialized) { initOSTypeTable(); } Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&ostype2identifier, INT2PTR(ostype)); if (hPtr) { char *UTI = Tcl_GetHashValue(hPtr); return [[NSString alloc] initWithCString:UTI encoding:NSASCIIStringEncoding]; } return nil; } /* * The NSWorkspace method iconForFileType, which was deprecated in macOS 12.0, would * accept an NSString which could be an encoding of an OSType, or a file extension, * or a Uniform Type Idenfier. This function can serve as a replacement. */ MODULE_SCOPE NSImage *TkMacOSXIconForFileType(NSString *filetype) { if (!initialized) { initOSTypeTable(); } #if MAC_OS_X_VERSION_MAX_ALLOWED < 110000 // We don't have UTType but iconForFileType is not deprecated, so use it. return [[NSWorkspace sharedWorkspace] iconForFileType:filetype]; #else // We might have UTType but iconForFileType might be deprecated. if (@available(macOS 11.0, *)) { /* Yes, we do have UTType */ UTType *uttype = [UTType typeWithIdentifier: filetype]; if (uttype == nil || !uttype.isDeclared) { uttype = [UTType typeWithFilenameExtension: filetype]; } if (uttype == nil || (!uttype.isDeclared && filetype.length == 4)) { OSType ostype = CHARS_TO_OSTYPE(filetype.UTF8String); NSString *UTI = TkMacOSXOSTypeToUTI(ostype); if (UTI) { uttype = [UTType typeWithIdentifier:UTI]; } } if (uttype == nil || !uttype.isDeclared) { return nil; } return [[NSWorkspace sharedWorkspace] iconForContentType:uttype]; } else { /* No, we don't have UTType. */ #if MAC_OS_X_VERSION_MIN_REQUIRED < 110000 /* but iconForFileType is not deprecated, so we can use it. */ return [[NSWorkspace sharedWorkspace] iconForFileType:filetype]; #else /* * Cannot be reached: MIN_REQUIRED >= 110000 yet 11.0 is not available. * But the compiler can't figure that out, so it will warn about an * execution path with no return value unless we put a return here. */ return nil; #endif } #endif } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Added macosx/tkMacOSXFileTypes.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | /* Apple never published a database of OSType codes for File Types. However, a database of known OSType codes representing Creators and File Types used on Apple systems prior to 2003 is available at: http://www.lacikam.co.il/tcdb/download/TCDBdata.zip Among the 12034 distinct OSType codes for File Types that are listed in the TCDB database, there are 121 for which the UTTypeCreatePreferredIdentifierForTag function (deprecated in macOS 12.0) was able to generate a Uniform Type Identifier on macOS 12.5.1. The mapping from those OSTypes to Uniform Type identifiers is given by the following array, in which OSTypes are represented as strings of length 4. */ typedef struct { const char *ostype; const char *identifier; } IdentifierForOSType; static const IdentifierForOSType OSTypeDB[] = { {".SGI", "com.sgi.sgi-image"}, {".WAV", "com.microsoft.waveform-audio"}, {"8BPS", "com.adobe.photoshop-image"}, {"ABPR", "com.apple.addressbook.person"}, {"AIFC", "public.aifc-audio"}, {"AIFF", "public.aiff-audio"}, {"APPC", "com.apple.deprecated-application-file"}, {"APPD", "com.apple.deprecated-application-file"}, {"APPL", "com.apple.application-bundle"}, {"ASF_", "com.microsoft.advanced-systems-format"}, {"ASX_", "com.microsoft.advanced-stream-redirector"}, {"BMP ", "com.microsoft.bmp"}, {"BMPf", "com.microsoft.bmp"}, {"BNDL", "com.apple.generic-bundle"}, {"DDim", "com.apple.disk-image-raw"}, {"DICM", "org.nema.dicom"}, {"DOTM", "org.openxmlformats.wordprocessingml.template.macro-enabled"}, {"EM3F", "com.apple.logic-song"}, {"EPSF", "com.adobe.encapsulated-postscript"}, {"FFIL", "com.apple.font-suitcase"}, {"FLI ", "public.flc-animation"}, {"FNDR", "com.apple.legacy.finder-icon"}, {"GIFf", "com.compuserve.gif"}, {"HTML", "public.html"}, {"JPEG", "public.jpeg"}, {"LWFN", "com.adobe.postscript-lwfn-font"}, {"MP3 ", "public.mp3"}, {"MP3!", "public.mp3"}, {"MP3U", "com.apple.tv.m3u-playlist"}, {"MPEG", "public.mpeg"}, {"MPG ", "public.mpeg"}, {"MPG2", "com.apple.music.mp2"}, {"MPG3", "public.mp3"}, {"Midi", "public.midi-audio"}, {"MooV", "com.apple.quicktime-movie"}, {"Mp3 ", "public.mp3"}, {"PAT ", "org.gimp.pat"}, {"PDF ", "com.adobe.pdf"}, {"PICT", "com.apple.pict"}, {"PNGf", "public.png"}, {"PNRA", "com.real.realaudio"}, {"PNRM", "com.real.realmedia"}, {"PNTG", "com.apple.macpaint-image"}, {"PPOT", "com.microsoft.powerpoint.pot"}, {"PPSS", "com.microsoft.powerpoint.pps"}, {"RTF ", "public.rtf"}, {"SDP ", "public.sdp"}, {"SIT5", "com.stuffit.archive.sit"}, {"SLD8", "com.microsoft.powerpoint.ppt"}, {"Sd2f", "com.digidesign.sd2-audio"}, {"TEXT", "com.apple.traditional-mac-plain-text"}, {"TIFF", "public.tiff"}, {"TPIC", "com.truevision.tga-image"}, {"ULAW", "public.ulaw-audio"}, {"VfW ", "public.avi"}, {"W8BN", "com.microsoft.word.doc"}, {"W8TN", "com.microsoft.word.dot"}, {"WAVE", "com.microsoft.waveform-audio"}, {"XLA5", "com.microsoft.excel.xla"}, {"XLS8", "com.microsoft.excel.xls"}, {"XLW8", "com.microsoft.excel.xlw"}, {"alis", "com.apple.alias-record"}, {"appe", "com.apple.deprecated-application-file"}, {"cdev", "com.apple.deprecated-application-file"}, {"clpp", "com.apple.finder.pictclipping"}, {"clps", "com.apple.finder.sound-clipping"}, {"clpt", "com.apple.finder.textclipping"}, {"clpu", "com.apple.finder.clipping"}, {"ctrl", "com.apple.legacy.finder-icon"}, {"dfil", "com.apple.deprecated-application-file"}, {"dict", "com.apple.document-type.dictionary"}, {"disk", "public.volume"}, {"docs", "com.apple.documents-folder"}, {"dvc!", "public.dv-movie"}, {"ffil", "com.apple.font-suitcase"}, {"flpy", "com.apple.storage-removable"}, {"fold", "public.folder"}, {"font", "com.apple.legacy.finder-icon"}, {"grup", "com.apple.user-group"}, {"hdrv", "com.apple.disk-image-raw"}, {"hdsk", "com.apple.storage-internal"}, {"help", "com.apple.help-document"}, {"hkdb", "com.apple.itunes.db"}, {"hvpl", "com.apple.music.visual"}, {"ilaf", "com.apple.afp-internet-location"}, {"ilfi", "com.apple.file-internet-location"}, {"ilft", "com.apple.ftp-internet-location"}, {"ilge", "com.apple.generic-internet-location"}, {"ilht", "com.apple.web-internet-location"}, {"ilma", "com.apple.mail-internet-location"}, {"ilnw", "com.apple.news-internet-location"}, {"macD", "com.apple.legacy.finder-icon"}, {"mp3!", "public.mp3"}, {"mpg3", "public.mp3"}, {"note", "com.apple.alert-note"}, {"osas", "com.apple.applescript.script"}, {"plug", "com.apple.plugin"}, {"pref", "com.apple.legacy.finder-icon"}, {"prfb", "com.apple.icon-overlay.private-folder-badge"}, {"prof", "com.apple.colorsync-profile"}, {"qtif", "com.apple.quicktime-image"}, {"sLS8", "com.microsoft.excel.xlt"}, {"sM3F", "com.apple.logic-song"}, {"sbBF", "com.apple.finder.burn-folder"}, {"scrp", "com.apple.legacy.finder-icon"}, {"sdoc", "com.apple.generic-stationery"}, {"sfnt", "com.apple.font-suitcase"}, {"shlb", "com.apple.legacy.finder-icon"}, {"srvr", "com.apple.file-server"}, {"svg ", "public.svg-image"}, {"svgz", "public.svg-image"}, {"tDoc", "com.apple.documents-folder"}, {"tfil", "com.apple.font-suitcase"}, {"trsh", "com.apple.trash-empty"}, {"ttcf", "public.truetype-collection-font"}, {"ttro", "com.apple.traditional-mac-plain-text"}, {"txtn", "com.apple.txn.text-multimedia-data"}, {"url ", "public.url"}, {"user", "com.apple.user"}, {"utxt", "public.utf16-plain-text"}, {"vCrd", "public.vcard"}, {NULL, NULL} }; |
Changes to macosx/tkMacOSXFont.c.
1 2 3 4 5 6 | /* * tkMacOSXFont.c -- * * Contains the Macintosh implementation of the platform-independent font * package interface. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkMacOSXFont.c -- * * Contains the Macintosh implementation of the platform-independent font * package interface. * * Copyright © 2002-2004 Benjamin Riefenstahl, [email protected] * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2008-2009 Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXFont.h" |
︙ | ︙ | |||
108 109 110 111 112 113 114 | - (instancetype)initWithTclUtfBytes:(const void *)bytes length:(NSUInteger)len { self = [self init]; if (self) { Tcl_DStringInit(&_ds); | | | | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - (instancetype)initWithTclUtfBytes:(const void *)bytes length:(NSUInteger)len { self = [self init]; if (self) { Tcl_DStringInit(&_ds); Tcl_UtfToChar16DString((const char *)bytes, len, &_ds); _string = [[NSString alloc] initWithCharactersNoCopy:(unichar *)Tcl_DStringValue(&_ds) length:Tcl_DStringLength(&_ds)>>1 freeWhenDone:NO]; self.UTF8String = _string.UTF8String; } return self; } - (instancetype)initWithString:(NSString *)aString { self = [self init]; if (self) { _string = [[NSString alloc] initWithString:aString]; _UTF8String = _string.UTF8String; } return self; } - (void)dealloc { Tcl_DStringFree(&_ds); |
︙ | ︙ | |||
145 146 147 148 149 150 151 | } - (unichar)characterAtIndex:(NSUInteger)index { return [_string characterAtIndex:index]; } | < < < < | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | } - (unichar)characterAtIndex:(NSUInteger)index { return [_string characterAtIndex:index]; } - (Tcl_DString)DString { if ( _ds.string == NULL) { /* * The DString has not been initialized. Construct it from * our string's unicode characters. |
︙ | ︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | Tcl_DStringSetLength(&_ds, p - Tcl_DStringValue(&_ds)); } return _ds; } #ifndef __clang__ @synthesize UTF8String = _UTF8String; #endif @end #define GetNSFontTraitsFromTkFontAttributes(faPtr) \ ((faPtr)->weight == TK_FW_BOLD ? NSBoldFontMask : NSUnboldFontMask) | \ ((faPtr)->slant == TK_FS_ITALIC ? NSItalicFontMask : NSUnitalicFontMask) | > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | Tcl_DStringSetLength(&_ds, p - Tcl_DStringValue(&_ds)); } return _ds; } #ifndef __clang__ @synthesize UTF8String = _UTF8String; @synthesize DString = _ds; #endif @end #define GetNSFontTraitsFromTkFontAttributes(faPtr) \ ((faPtr)->weight == TK_FW_BOLD ? NSBoldFontMask : NSUnboldFontMask) | \ ((faPtr)->slant == TK_FS_ITALIC ? NSItalicFontMask : NSUnitalicFontMask) |
︙ | ︙ | |||
243 244 245 246 247 248 249 | { NSFontManager *fm = [NSFontManager sharedFontManager]; NSFont *nsFont, *dflt = nil; #define defaultFont (dflt ? dflt : (dflt = [NSFont systemFontOfSize:0])) NSString *family; if (familyName) { | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | { NSFontManager *fm = [NSFontManager sharedFontManager]; NSFont *nsFont, *dflt = nil; #define defaultFont (dflt ? dflt : (dflt = [NSFont systemFontOfSize:0])) NSString *family; if (familyName) { family = [[[TKNSString alloc] initWithTclUtfBytes:familyName length:-1] autorelease]; } else { family = [defaultFont familyName]; } if (size == 0.0) { size = [defaultFont pointSize]; } nsFont = [fm fontWithFamily:family traits:traits weight:weight size:size]; |
︙ | ︙ | |||
419 420 421 422 423 424 425 426 427 428 429 430 431 432 | Tk_Window tkwin, const char* name, TkFontAttributes *faPtr) { TkDeleteNamedFont(NULL, tkwin, name); return TkCreateNamedFont(interp, tkwin, name, faPtr); } #pragma mark - #pragma mark Font handling: /* *------------------------------------------------------------------------- * | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | Tk_Window tkwin, const char* name, TkFontAttributes *faPtr) { TkDeleteNamedFont(NULL, tkwin, name); return TkCreateNamedFont(interp, tkwin, name, faPtr); } #pragma mark - #pragma mark Grapheme Cluster indexing /* *---------------------------------------------------------------------- * * startOfClusterObjCmd -- * * This function is invoked to process the startOfCluster command. * * Results: * A standard Tcl result. * * Side effects: * None * *---------------------------------------------------------------------- */ static int startOfClusterObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TKNSString *S; const char *stringArg; int numBytes; TkSizeT index; if ((unsigned)(objc - 3) > 1) { Tcl_WrongNumArgs(interp, 1 , objv, "str start ?locale?"); return TCL_ERROR; } stringArg = Tcl_GetStringFromObj(objv[1], &numBytes); if (stringArg == NULL) { return TCL_ERROR; } S = [[TKNSString alloc] initWithTclUtfBytes:stringArg length:numBytes]; if (TkGetIntForIndex(objv[2], [S length] - 1, 0, &index) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad index \"%s\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "VALUE", "INDEX", NULL); return TCL_ERROR; } if (index != TCL_INDEX_NONE) { if ((size_t)index >= [S length]) { index = (TkSizeT)[S length]; } else { NSRange range = [S rangeOfComposedCharacterSequenceAtIndex:index]; index = range.location; } Tcl_SetObjResult(interp, TkNewIndexObj(index)); } return TCL_OK; } static int endOfClusterObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TKNSString *S; char *stringArg; int numBytes; TkSizeT index; if ((unsigned)(objc - 3) > 1) { Tcl_WrongNumArgs(interp, 1 , objv, "str start ?locale?"); return TCL_ERROR; } stringArg = Tcl_GetStringFromObj(objv[1], &numBytes); if (stringArg == NULL) { return TCL_ERROR; } S = [[TKNSString alloc] initWithTclUtfBytes:stringArg length:numBytes]; if (TkGetIntForIndex(objv[2], [S length] - 1, 0, &index) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad index \"%s\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "VALUE", "INDEX", NULL); return TCL_ERROR; } if ((size_t)index + 1 <= [S length]) { if (index == TCL_INDEX_NONE) { index = 0; } else { NSRange range = [S rangeOfComposedCharacterSequenceAtIndex:index]; index = range.location + range.length; } Tcl_SetObjResult(interp, TkNewIndexObj(index)); } return TCL_OK; } #pragma mark - #pragma mark Font handling: /* *------------------------------------------------------------------------- * |
︙ | ︙ | |||
516 517 518 519 520 521 522 523 524 525 526 527 528 529 | whitespaceAndNewlineCharacterSet] retain]; cs = [whitespaceCharacterSet mutableCopy]; [cs removeCharactersInString:@" "]; lineendingCharacterSet = [cs copy]; [cs release]; } [pool drain]; } /* *--------------------------------------------------------------------------- * * TkpGetNativeFont -- * | > > | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | whitespaceAndNewlineCharacterSet] retain]; cs = [whitespaceCharacterSet mutableCopy]; [cs removeCharactersInString:@" "]; lineendingCharacterSet = [cs copy]; [cs release]; } [pool drain]; Tcl_CreateObjCommand(interp, "::tk::startOfCluster", startOfClusterObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::endOfCluster", endOfClusterObjCmd, NULL, NULL); } /* *--------------------------------------------------------------------------- * * TkpGetNativeFont -- * |
︙ | ︙ | |||
1152 1153 1154 1155 1156 1157 1158 | int numBytes, /* Number of bytes in string. */ int rangeStart, /* Index of first byte to draw. */ int rangeLength, /* Length of range to draw in bytes. */ int x, int y) /* Coordinates at which to place origin of the * whole (not just the range) string when * drawing. */ { | < | 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 | int numBytes, /* Number of bytes in string. */ int rangeStart, /* Index of first byte to draw. */ int rangeLength, /* Length of range to draw in bytes. */ int x, int y) /* Coordinates at which to place origin of the * whole (not just the range) string when * drawing. */ { TkpDrawAngledCharsInContext(display, drawable, gc, tkfont, source, numBytes, rangeStart, rangeLength, x, y, 0.0); } void TkpDrawAngledCharsInContext( TCL_UNUSED(Display *), /* Display on which to draw. */ |
︙ | ︙ | |||
1189 1190 1191 1192 1193 1194 1195 | NSAttributedString *attributedString; CTTypesetterRef typesetter; CFIndex start, length; CTLineRef line, full=nil; MacDrawable *macWin = (MacDrawable *)drawable; TkMacOSXDrawingContext drawingContext; CGContextRef context; | | | > | | > > | | 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 | NSAttributedString *attributedString; CTTypesetterRef typesetter; CFIndex start, length; CTLineRef line, full=nil; MacDrawable *macWin = (MacDrawable *)drawable; TkMacOSXDrawingContext drawingContext; CGContextRef context; CGColorRef fg = NULL; NSFont *nsFont; CGAffineTransform t; CGFloat width, height, textX = (CGFloat) x, textY = (CGFloat) y; if (rangeStart < 0 || rangeLength <= 0 || rangeStart + rangeLength > numBytes || !TkMacOSXSetupDrawingContext(drawable, gc, &drawingContext)) { return; } string = [[TKNSString alloc] initWithTclUtfBytes:source length:numBytes]; if (!string) { return; } context = drawingContext.context; TkSetMacColor(gc->foreground, &fg); attributes = [fontPtr->nsAttributes mutableCopy]; if (fg) { [attributes setObject:(id)fg forKey:(id)kCTForegroundColorAttributeName]; CGColorRelease(fg); } nsFont = [attributes objectForKey:NSFontAttributeName]; [nsFont setInContext:GET_NSCONTEXT(context, NO)]; CGContextSetTextMatrix(context, CGAffineTransformIdentity); attributedString = [[NSAttributedString alloc] initWithString:string attributes:attributes]; [string release]; typesetter = CTTypesetterCreateWithAttributedString( (CFAttributedStringRef)attributedString); textX += (CGFloat) macWin->xOff; textY += (CGFloat) macWin->yOff; height = [drawingContext.view bounds].size.height; textY = height - textY; t = CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, height); if (angle != 0.0) { t = CGAffineTransformTranslate( CGAffineTransformRotate( CGAffineTransformTranslate(t, textX, textY), angle*PI/180.0), -textX, -textY); |
︙ | ︙ | |||
1250 1251 1252 1253 1254 1255 1256 | textX += (width - CTLineGetTypographicBounds(line, NULL, NULL, NULL)); } CGContextSetTextPosition(context, textX, textY); CTLineDraw(line, context); CFRelease(line); CFRelease(typesetter); [attributedString release]; | < | 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | textX += (width - CTLineGetTypographicBounds(line, NULL, NULL, NULL)); } CGContextSetTextPosition(context, textX, textY); CTLineDraw(line, context); CFRelease(line); CFRelease(typesetter); [attributedString release]; [attributes release]; TkMacOSXRestoreDrawingContext(&drawingContext); } #pragma mark - #pragma mark Accessors: |
︙ | ︙ |
Changes to macosx/tkMacOSXFont.h.
1 2 3 4 5 6 | /* * tkMacOSXFont.h -- * * Contains the Macintosh implementation of the platform-independent * font package interface. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMacOSXFont.h -- * * Contains the Macintosh implementation of the platform-independent * font package interface. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2001-2009, Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef TKMACOSXFONT_H #define TKMACOSXFONT_H 1 |
︙ | ︙ |
Changes to macosx/tkMacOSXHLEvents.c.
1 2 3 4 5 | /* * tkMacOSXHLEvents.c -- * * Implements high level event support for the Macintosh. * | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMacOSXHLEvents.c -- * * Implements high level event support for the Macintosh. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2015-2019 Marc Culler * Copyright © 2019 Kevin Walzer/WordTech Communications LLC. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include <sys/param.h> |
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | */ static const char openDocumentProc[] = "::tk::mac::OpenDocument"; static const char launchURLProc[] = "::tk::mac::LaunchURL"; static const char printDocProc[] = "::tk::mac::PrintDocument"; static const char scriptFileProc[] = "::tk::mac::DoScriptFile"; static const char scriptTextProc[] = "::tk::mac::DoScriptText"; #pragma mark TKApplication(TKHLEvents) @implementation TKApplication(TKHLEvents) - (void) terminate: (id) sender { (void)sender; [self handleQuitApplicationEvent:Nil withReplyEvent:Nil]; } - (void) superTerminate: (id) sender { [super terminate:nil]; } - (void) preferences: (id) sender { (void)sender; [self handleShowPreferencesEvent:Nil withReplyEvent:Nil]; | > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | */ static const char openDocumentProc[] = "::tk::mac::OpenDocument"; static const char launchURLProc[] = "::tk::mac::LaunchURL"; static const char printDocProc[] = "::tk::mac::PrintDocument"; static const char scriptFileProc[] = "::tk::mac::DoScriptFile"; static const char scriptTextProc[] = "::tk::mac::DoScriptText"; static const char getSdefProc[] = "::tk::mac::GetDynamicSdef"; #pragma mark TKApplication(TKHLEvents) @implementation TKApplication(TKHLEvents) - (void) terminate: (id) sender { (void)sender; [self handleQuitApplicationEvent:Nil withReplyEvent:Nil]; } - (void) superTerminate: (id) sender { (void) sender; [super terminate:nil]; } - (void) preferences: (id) sender { (void)sender; [self handleShowPreferencesEvent:Nil withReplyEvent:Nil]; |
︙ | ︙ | |||
221 222 223 224 225 226 227 | continue; } URLString[actual] = '\0'; fileURL = [NSURL URLWithString:[NSString stringWithUTF8String:(char*)URLString]]; if (fileURL == nil) { continue; } | | > < < | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | continue; } URLString[actual] = '\0'; fileURL = [NSURL URLWithString:[NSString stringWithUTF8String:(char*)URLString]]; if (fileURL == nil) { continue; } (void)Tcl_ExternalToUtfDStringEx(utf8, [[fileURL path] UTF8String], -1, TCL_ENCODING_NOCOMPLAIN, &pathName); Tcl_DStringAppendElement(openCommand, Tcl_DStringValue(&pathName)); Tcl_DStringFree(&pathName); } Tcl_FreeEncoding(utf8); AEDisposeDesc(&contents); AEInfo->interp = _eventInterp; AEInfo->procedure = openDocumentProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; if (Tcl_FindCommand(_eventInterp, "::tk::mac::OpenDocuments", NULL, 0)){ ProcessAppleEvent((ClientData)AEInfo); } else { Tcl_CreateTimerHandler(500, ProcessAppleEvent, (ClientData)AEInfo); } } |
︙ | ︙ | |||
257 258 259 260 261 262 263 | Tcl_DStringInit(printCommand); Tcl_DStringAppend(printCommand, printDocProc, -1); Tcl_DStringAppendElement(printCommand, printFile); AEInfo->interp = _eventInterp; AEInfo->procedure = printDocProc; AEInfo->replyEvent = nil; | < | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | Tcl_DStringInit(printCommand); Tcl_DStringAppend(printCommand, printDocProc, -1); Tcl_DStringAppendElement(printCommand, printFile); AEInfo->interp = _eventInterp; AEInfo->procedure = printDocProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; ProcessAppleEvent((ClientData)AEInfo); } - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { |
︙ | ︙ | |||
320 321 322 323 324 325 326 | Tcl_DString *scriptFileCommand = &AEInfo->command; Tcl_DStringInit(scriptFileCommand); Tcl_DStringAppend(scriptFileCommand, scriptFileProc, -1); Tcl_DStringAppendElement(scriptFileCommand, [[fileURL path] UTF8String]); AEInfo->interp = _eventInterp; AEInfo->procedure = scriptFileProc; AEInfo->replyEvent = nil; | < | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | Tcl_DString *scriptFileCommand = &AEInfo->command; Tcl_DStringInit(scriptFileCommand); Tcl_DStringAppend(scriptFileCommand, scriptFileProc, -1); Tcl_DStringAppendElement(scriptFileCommand, [[fileURL path] UTF8String]); AEInfo->interp = _eventInterp; AEInfo->procedure = scriptFileProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; ProcessAppleEvent((ClientData)AEInfo); } } } else if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, NULL, 0, &actual)) { /* |
︙ | ︙ | |||
352 353 354 355 356 357 358 | AEInfo->procedure = scriptTextProc; AEInfo->retryCount = 0; if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) { AEInfo->replyEvent = replyEvent; ProcessAppleEvent(AEInfo); } else { AEInfo->replyEvent = nil; | < | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | AEInfo->procedure = scriptTextProc; AEInfo->retryCount = 0; if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) { AEInfo->replyEvent = replyEvent; ProcessAppleEvent(AEInfo); } else { AEInfo->replyEvent = nil; ProcessAppleEvent(AEInfo); } } } } } |
︙ | ︙ | |||
376 377 378 379 380 381 382 | Tcl_DStringInit(launchCommand); Tcl_DStringAppend(launchCommand, launchURLProc, -1); Tcl_DStringAppendElement(launchCommand, cURL); AEInfo->interp = _eventInterp; AEInfo->procedure = launchURLProc; AEInfo->replyEvent = nil; | > | > > > > > > > > > > > > > > | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | Tcl_DStringInit(launchCommand); Tcl_DStringAppend(launchCommand, launchURLProc, -1); Tcl_DStringAppendElement(launchCommand, cURL); AEInfo->interp = _eventInterp; AEInfo->procedure = launchURLProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; ProcessAppleEvent((ClientData)AEInfo); } - (void)handleGetSDEFEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *sdefCommand = &AEInfo->command; (void)event; (void)replyEvent; Tcl_DStringInit(sdefCommand); Tcl_DStringAppend(sdefCommand, getSdefProc, -1); AEInfo->interp = _eventInterp; AEInfo->procedure = getSdefProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; ProcessAppleEvent((ClientData)AEInfo); } @end #pragma mark - /* |
︙ | ︙ | |||
518 519 520 521 522 523 524 525 526 527 528 529 530 531 | andSelector:@selector(handleDoScriptEvent:withReplyEvent:) forEventClass:kAEMiscStandards andEventID:kAEDoScript]; [aeManager setEventHandler:NSApp andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; } } /* *---------------------------------------------------------------------- * * TkMacOSXDoHLEvent -- | > > > > > > > > > | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | andSelector:@selector(handleDoScriptEvent:withReplyEvent:) forEventClass:kAEMiscStandards andEventID:kAEDoScript]; [aeManager setEventHandler:NSApp andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; /* * We do not load our sdef dynamically but this event handler * is required to silence error messages from inline execution * of AppleScript at the Objective-C level. */ [aeManager setEventHandler:NSApp andSelector:@selector(handleGetSDEFEvent:withReplyEvent:) forEventClass:'ascr' andEventID:'gsdf']; } } /* *---------------------------------------------------------------------- * * TkMacOSXDoHLEvent -- |
︙ | ︙ |
Changes to macosx/tkMacOSXImage.c.
1 2 3 | /* * tkMacOSXImage.c -- * | | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | /* * tkMacOSXImage.c -- * * The code in this file provides an interface for XImages, and * implements the nsimage image type. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 2001-2009, Apple Inc. * Copyright (c) 2005-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2017-2021 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXConstants.h" #include "tkColor.h" #include "xbytes.h" static CGImageRef CreateCGImageFromPixmap(Drawable pixmap); static CGImageRef CreateCGImageFromDrawableRect( Drawable drawable, int x, int y, unsigned int width, unsigned int height); /* Pixel formats * * Tk uses the XImage structure defined in Xlib.h for storing images. The * image data in an XImage is a 32-bit aligned array of bytes. Interpretation * of that data is not specified, but the structure includes parameters which * provide interpretation hints so that an application can use a family of * different data structures. * * The possible values for the XImage format field are XYBitmap, XYPixmap and * ZPixmap. The macOS port does not support the XYPixmap format. This means * that bitmap images are stored as a single bit plane (XYBitmap) and that * color images are stored as a sequence of pixel values (ZPixmap). * * For a ZPixmap, the number of bits allocated to each pixel is specified by * the bits_per_pixel field of the XImage structure. The functions in this * module which convert between XImage and native CGImage or NSImage structures * only support XImages with 32 bits per pixel. The ImageGetPixel and PutPixel * implementations in this file allow 1, 4, 8, 16 or 32 bits per pixel, however. * * In tkImgPhInstance.c the layout used for pixels is determined by the values * of the red_mask, blue_mask and green_mask fields in the XImage structure. * The Aqua port always sets red_mask = 0xFF0000, green_mask = 0xFF00, and * blue_mask = 0xFF. This means that a 32bpp ZPixmap XImage uses ARGB32 pixels, * with small-endian byte order BGRA. The data array for such an XImage can be * passed directly to construct a CGBitmapImageRep if one specifies the * bitmapInfo as kCGBitmapByteOrder32Big | kCGImageAlphaLast. * * The structures below describe the bitfields in two common 32 bpp pixel * layouts. Note that bit field layouts are compiler dependent. The layouts * shown in the comments are those produced by clang and gcc. Also note * that kCGBitmapByteOrder32Big is consistently set when creating CGImages or * CGImageBitmapReps. */ /* RGBA32 0xRRGGBBAA (Byte order is RGBA on big-endian systems.) * This is used by NSBitmapImageRep when the bitmapFormat property is 0, * the default value. */ typedef struct RGBA32pixel_t { unsigned red: 8; unsigned green: 8; unsigned blue: 8; unsigned alpha: 8; } RGBA32pixel; /* * ARGB32 0xAARRGGBB (Byte order is ARGB on big-endian systems.) * This is used by Aqua Tk for XImages and by NSBitmapImageReps whose * bitmapFormat property is NSAlphaFirstBitmapFormat. */ typedef struct ARGB32pixel_t { unsigned blue: 8; unsigned green: 8; unsigned red: 8; unsigned alpha: 8; } ARGB32pixel; typedef union pixel32_t { unsigned int uint; RGBA32pixel rgba; ARGB32pixel argb; } pixel32; #pragma mark XImage handling int _XInitImageFuncPtrs( TCL_UNUSED(XImage *)) /* image */ { |
︙ | ︙ | |||
44 45 46 47 48 49 50 | * *---------------------------------------------------------------------- */ static void ReleaseData( void *info, TCL_UNUSED(const void *), /* data */ | | | > | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | * *---------------------------------------------------------------------- */ static void ReleaseData( void *info, TCL_UNUSED(const void *), /* data */ TCL_UNUSED(size_t)) /* size */ { ckfree(info); } CGImageRef TkMacOSXCreateCGImageWithXImage( XImage *image, uint32_t alphaInfo) { CGImageRef img = NULL; size_t bitsPerComponent, bitsPerPixel; size_t len = image->bytes_per_line * image->height; const CGFloat *decode = NULL; CGBitmapInfo bitmapInfo; CGDataProviderRef provider = NULL; |
︙ | ︙ | |||
73 74 75 76 77 78 79 | /* Reverses the sense of the bits */ static const CGFloat decodeWB[2] = {1, 0}; decode = decodeWB; bitsPerComponent = 1; bitsPerPixel = 1; | > > | | | | | | | | | | < > > | < > > | < > < | < | > > > | < | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | /* Reverses the sense of the bits */ static const CGFloat decodeWB[2] = {1, 0}; decode = decodeWB; bitsPerComponent = 1; bitsPerPixel = 1; data = (char *)ckalloc(len); if (data) { if (image->bitmap_bit_order != MSBFirst) { char *srcPtr = image->data + image->xoffset; char *endPtr = srcPtr + len; char *destPtr = data; while (srcPtr < endPtr) { *destPtr++ = xBitReverseTable[(unsigned char)(*(srcPtr++))]; } } else { memcpy(data, image->data + image->xoffset, len); } provider = CGDataProviderCreateWithData(data, data, len, releaseData); if (!provider) { ckfree(data); } img = CGImageMaskCreate(image->width, image->height, bitsPerComponent, bitsPerPixel, image->bytes_per_line, provider, decode, 0); CGDataProviderRelease(provider); } } else if ((image->format == ZPixmap) && (image->bits_per_pixel == 32)) { /* * Color image */ if (image->width == 0 && image->height == 0) { /* * CGCreateImage complains on early macOS releases. */ return NULL; } CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); bitsPerComponent = 8; bitsPerPixel = 32; bitmapInfo = kCGBitmapByteOrder32Big | alphaInfo; data = (char *)ckalloc(len); if (data) { memcpy(data, image->data + image->xoffset, len); provider = CGDataProviderCreateWithData(data, data, len, releaseData); if (!provider) { ckfree(data); } img = CGImageCreate(image->width, image->height, bitsPerComponent, bitsPerPixel, image->bytes_per_line, colorspace, bitmapInfo, provider, decode, 0, kCGRenderingIntentDefault); CGDataProviderRelease(provider); } if (colorspace) { CFRelease(colorspace); } } else { TkMacOSXDbgMsg("Unsupported image type"); } |
︙ | ︙ | |||
201 202 203 204 205 206 207 | if (image && image->data) { unsigned char *srcPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); switch (image->bits_per_pixel) { case 32: /* 8 bits per channel */ | > | < < < | | | < > | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | if (image && image->data) { unsigned char *srcPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); switch (image->bits_per_pixel) { case 32: /* 8 bits per channel */ { ARGB32pixel *pixel = (ARGB32pixel *)srcPtr; r = pixel->red; g = pixel->green; b = pixel->blue; } break; case 16: /* 5 bits per channel */ r = (*((unsigned short*) srcPtr) >> 7) & 0xf8; g = (*((unsigned short*) srcPtr) >> 2) & 0xf8; b = (*((unsigned short*) srcPtr) << 3) & 0xf8; break; case 8: /* 2 bits per channel */ |
︙ | ︙ | |||
245 246 247 248 249 250 251 | } /* *---------------------------------------------------------------------- * * ImagePutPixel -- * | | > > > | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | } /* *---------------------------------------------------------------------- * * ImagePutPixel -- * * Set a single pixel in an image. The pixel is provided as an unsigned * 32-bit integer. The value of that integer is interpreted by assuming * that its low-order N bits have the format specified by the XImage, * where N is equal to the bits_per_pixel field of the XImage. * * Results: * None. * * Side effects: * None. * |
︙ | ︙ | |||
271 272 273 274 275 276 277 | unsigned char *dstPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); if (image->bits_per_pixel == 32) { *((unsigned int*) dstPtr) = pixel; } else { | < < < | < | < < < | | | | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | unsigned char *dstPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); if (image->bits_per_pixel == 32) { *((unsigned int*) dstPtr) = pixel; } else { switch (image->bits_per_pixel) { case 16: *((unsigned short*) dstPtr) = pixel & 0xffff; break; case 8: *dstPtr = pixel & 0xff; break; case 4: { *dstPtr = (x % 2) ? ((*dstPtr & 0xf0) | (pixel & 0x0f)) : ((*dstPtr & 0x0f) | ((pixel << 4) & 0xf0)); break; } case 1: *dstPtr = pixel ? (*dstPtr | (0x80 >> (x % 8))) : (*dstPtr & ~(0x80 >> (x % 8))); break; } } } return 0; } |
︙ | ︙ | |||
319 320 321 322 323 324 325 | * *---------------------------------------------------------------------- */ XImage * XCreateImage( Display* display, | | | | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | * *---------------------------------------------------------------------- */ XImage * XCreateImage( Display* display, TCL_UNUSED(Visual*), /* visual */ unsigned int depth, int format, int offset, char* data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line) { XImage *ximage; display->request++; ximage = (XImage *)ckalloc(sizeof(XImage)); ximage->height = height; ximage->width = width; ximage->depth = depth; ximage->xoffset = offset; ximage->format = format; ximage->data = data; |
︙ | ︙ | |||
388 389 390 391 392 393 394 | return ximage; } /* *---------------------------------------------------------------------- * | | > | | > > > > > > > | > > > > < > > > > | | > | > | < > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | | > > | | | | | > | > | < | < | > | < > | | | < > | > > | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | return ximage; } /* *---------------------------------------------------------------------- * * TkPutImage, XPutImage, TkpPutRGBAImage -- * * These functions, which all have the same signature, copy a rectangular * subimage of an XImage into a drawable. TkPutImage is an alias for * XPutImage, which assumes that the XImage data has the structure of a * 32bpp ZPixmap in which the image data is an array of 32bit integers * packed with 8 bit values for the Red Green and Blue channels. The * fourth byte is ignored. The function TkpPutRGBAImage assumes that the * XImage data has been extended by using the fourth byte to store an * 8-bit Alpha value. (The Alpha data is assumed not to pre-multiplied). * The image is then drawn into the drawable using standard Porter-Duff * Source Atop Composition (kCGBlendModeSourceAtop in Apple's Core * Graphics). * * The TkpPutRGBAImage function is used by TkImgPhotoDisplay to render photo * images if the compile-time variable TK_CAN_RENDER_RGBA is defined in * a platform's tkXXXXPort.h header, as is the case for the macOS Aqua port. * * Results: * These functions return either BadDrawable or Success. * * Side effects: * Draws the image on the specified drawable. * *---------------------------------------------------------------------- */ #define USE_ALPHA kCGImageAlphaLast #define IGNORE_ALPHA kCGImageAlphaNoneSkipLast static int TkMacOSXPutImage( uint32_t pixelFormat, Display* display, /* Display. */ Drawable drawable, /* Drawable to place image on. */ GC gc, /* GC to use. */ XImage* image, /* Image to place. */ int src_x, /* Source X & Y. */ int src_y, int dest_x, /* Destination X & Y. */ int dest_y, unsigned int width, /* Same width & height for both */ unsigned int height) /* destination and source. */ { TkMacOSXDrawingContext dc; MacDrawable *macDraw = (MacDrawable *)drawable; int result = Success; display->request++; if (!TkMacOSXSetupDrawingContext(drawable, gc, &dc)) { return BadDrawable; } if (dc.context) { CGRect bounds, srcRect, dstRect; CGImageRef img = TkMacOSXCreateCGImageWithXImage(image, pixelFormat); /* * The CGContext for a pixmap is RGB only, with A = 0. */ if (!(macDraw->flags & TK_IS_PIXMAP)) { CGContextSetBlendMode(dc.context, kCGBlendModeSourceAtop); } if (img) { bounds = CGRectMake(0, 0, image->width, image->height); srcRect = CGRectMake(src_x, src_y, width, height); dstRect = CGRectMake(dest_x, dest_y, width, height); TkMacOSXDrawCGImage(drawable, gc, dc.context, img, gc->foreground, gc->background, bounds, srcRect, dstRect); CFRelease(img); } else { TkMacOSXDbgMsg("Invalid source drawable"); result = BadDrawable; } } else { TkMacOSXDbgMsg("Invalid destination drawable"); result = BadDrawable; } TkMacOSXRestoreDrawingContext(&dc); return result; } int XPutImage( Display* display, Drawable drawable, GC gc, XImage* image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height) { return TkMacOSXPutImage(IGNORE_ALPHA, display, drawable, gc, image, src_x, src_y, dest_x, dest_y, width, height); } int TkpPutRGBAImage( Display* display, Drawable drawable, GC gc, XImage* image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height) { return TkMacOSXPutImage(USE_ALPHA, display, drawable, gc, image, src_x, src_y, dest_x, dest_y, width, height); } /* *---------------------------------------------------------------------- * * CreateCGImageFromDrawableRect * * Extract image data from a MacOSX drawable as a CGImage. The drawable * may be either a pixmap or a window, but there issues in the case of * a window. * * CreateCGImageFromDrawableRect is called by XGetImage and XCopyArea. * The Tk core uses these two functions on some platforms in order to * implement explicit double-buffered drawing -- a pixmap is copied from a * window, modified using CPU-based graphics composition, and then copied * back to the window. Platforms, such as macOS, on which the system * provides double-buffered drawing and GPU-based composition operations * can avoid calls to XGetImage and XCopyArea from the core by defining * the compile-time variable TK_NO_DOUBLE_BUFFERING. Nonetheless, these * two functions are in the stubs table and therefore could be used by * extensions. * * The implementation here does not always work correctly when the source * is a window. The original version of this function relied on * [NSBitmapImageRep initWithFocusedViewRect:view_rect] which was * deprecated by Apple in OSX 10.14 and also required the use of other * deprecated functions such as [NSView lockFocus]. Apple's suggested * replacement is [NSView cacheDisplayInRect: toBitmapImageRep:] and that * is being used here. However, cacheDisplayInRect works by calling * [NSView drawRect] after setting the current graphics context to be one * which draws to a bitmap. There are situations in which this can be * used, e.g. when taking a screenshot of a window. But it cannot be used * as part of a normal display procedure, using the copy-modify-paste * paradigm that is the basis of the explicit double-buffering. Since the * copy operation will call the same display procedure that is calling * this function via XGetImage or XCopyArea, this would create an infinite * recursion. * * An alternative to the copy-modify-paste paradigm is to use GPU-based * graphics composition, clipping to the specified rectangle. That is * the approach that must be followed by display procedures on macOS. * * Results: * Returns an NSBitmapRep representing the image of the given rectangle of * the given drawable. This object is retained. The caller is responsible * for releasing it. * * NOTE: The x,y coordinates should be relative to a coordinate system |
︙ | ︙ | |||
512 513 514 515 516 517 518 | int y, unsigned int width, unsigned int height) { MacDrawable *mac_drawable = (MacDrawable *)drawable; CGContextRef cg_context = NULL; CGImageRef cg_image = NULL, result = NULL; | < < < < < < < < | < < < | | | < < < > > | | < | > | | < > > > > | > | < < | | < < | | < < < | < > | > > > | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | int y, unsigned int width, unsigned int height) { MacDrawable *mac_drawable = (MacDrawable *)drawable; CGContextRef cg_context = NULL; CGImageRef cg_image = NULL, result = NULL; if (mac_drawable->flags & TK_IS_PIXMAP) { cg_context = TkMacOSXGetCGContextForDrawable(drawable); CGContextRetain(cg_context); } else { NSView *view = TkMacOSXGetNSViewForDrawable(mac_drawable); if (view == nil) { TkMacOSXDbgMsg("Invalid source drawable"); return NULL; } NSSize size = view.frame.size; NSUInteger view_width = size.width, view_height = size.height; NSUInteger bytesPerPixel = 4, bytesPerRow = bytesPerPixel * view_width, bitsPerComponent = 8; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); cg_context = CGBitmapContextCreate(NULL, view_width, view_height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); CFRelease(colorSpace); [view.layer renderInContext:cg_context]; } if (cg_context) { cg_image = CGBitmapContextCreateImage(cg_context); CGContextRelease(cg_context); } if (cg_image) { CGRect rect = CGRectMake(x + mac_drawable->xOff, y + mac_drawable->yOff, width, height); result = CGImageCreateWithImageInRect(cg_image, rect); CGImageRelease(cg_image); } return result; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
610 611 612 613 614 615 616 | * constructed. * * Side effects: * None. * *---------------------------------------------------------------------- */ | < < < | | | < | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | * constructed. * * Side effects: * None. * *---------------------------------------------------------------------- */ XImage * XGetImage( Display *display, Drawable drawable, int x, int y, unsigned int width, unsigned int height, TCL_UNUSED(unsigned long), /* plane_mask */ int format) { NSBitmapImageRep* bitmapRep = nil; NSUInteger bitmap_fmt = 0; XImage* imagePtr = NULL; char *bitmap = NULL; int depth = 32, offset = 0, bitmap_pad = 0; unsigned int bytes_per_row, size, row, n, m; if (format == ZPixmap) { CGImageRef cgImage; if (width == 0 || height == 0) { return NULL; |
︙ | ︙ | |||
651 652 653 654 655 656 657 | } else { TkMacOSXDbgMsg("XGetImage: Failed to construct CGImage"); return NULL; } bitmap_fmt = [bitmapRep bitmapFormat]; size = [bitmapRep bytesPerPlane]; bytes_per_row = [bitmapRep bytesPerRow]; | | < | | | | | | | > > > > > | < | | | | < < | > > | | | | < < < < > > | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | } else { TkMacOSXDbgMsg("XGetImage: Failed to construct CGImage"); return NULL; } bitmap_fmt = [bitmapRep bitmapFormat]; size = [bitmapRep bytesPerPlane]; bytes_per_row = [bitmapRep bytesPerRow]; bitmap = (char *)ckalloc(size); if ((bitmap_fmt != 0 && bitmap_fmt != NSAlphaFirstBitmapFormat) || [bitmapRep samplesPerPixel] != 4 || [bitmapRep isPlanar] != 0 || bytes_per_row < 4 * width || size != bytes_per_row * height) { TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format"); [bitmapRep release]; return NULL; } memcpy(bitmap, (char *)[bitmapRep bitmapData], size); [bitmapRep release]; for (row = 0, n = 0; row < height; row++, n += bytes_per_row) { for (m = n; m < n + 4*width; m += 4) { pixel32 pixel = *((pixel32 *)(bitmap + m)); if (bitmap_fmt == 0) { // default format /* * This pixel is in ARGB32 format. We need RGBA32. */ pixel32 flipped; flipped.rgba.red = pixel.argb.red; flipped.rgba.green = pixel.argb.green; flipped.rgba.blue = pixel.argb.blue; flipped.rgba.alpha = pixel.argb.alpha; *((pixel32 *)(bitmap + m)) = flipped; } else { // bitmap_fmt = NSAlphaFirstBitmapFormat *((pixel32 *)(bitmap + m)) = pixel; } } } imagePtr = XCreateImage(display, NULL, depth, format, offset, (char*) bitmap, width, height, bitmap_pad, bytes_per_row); } else { /* * There are some calls to XGetImage in the generic Tk code which pass * an XYPixmap rather than a ZPixmap. XYPixmaps should be handled * here. */ TkMacOSXDbgMsg("XGetImage does not handle XYPixmaps at the moment."); } return imagePtr; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 | * Source drawable is a Window, not a Pixmap. */ return XCopyArea(display, src, dst, gc, src_x, src_y, width, height, dest_x, dest_y); } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 | * Source drawable is a Window, not a Pixmap. */ return XCopyArea(display, src, dst, gc, src_x, src_y, width, height, dest_x, dest_y); } } /* ---------------------------------------------------------------------------*/ /* * Implementation of a Tk image type which provide access to NSImages * for use in buttons etc. */ /* * Forward declarations. */ typedef struct TkMacOSXNSImageInstance TkMacOSXNSImageInstance; typedef struct TkMacOSXNSImageModel TkMacOSXNSImageModel; /* * The following data structure represents a particular use of an nsimage * in a widget. */ struct TkMacOSXNSImageInstance { TkMacOSXNSImageModel *modelPtr; /* Pointer to the model for the image. */ NSImage *image; /* Pointer to an NSImage.*/ TkMacOSXNSImageInstance *nextPtr; /* First in the list of instances associated * with this model. */ }; /* * The following data structure represents the model for an nsimage: */ struct TkMacOSXNSImageModel { Tk_ImageModel tkModel; /* Tk's token for image model. */ Tcl_Interp *interp; /* Interpreter for application. */ int width, height; /* Dimensions of the image. */ int radius; /* Radius for rounded corners. */ int ring; /* Thickness of the focus ring. */ double alpha; /* Transparency, between 0.0 and 1.0*/ bool pressed; /* Image is for use in a pressed button.*/ bool template; /* Image is for use as a template.*/ char *imageName ; /* Malloc'ed image name. */ char *source; /* Malloc'ed string describing the image. */ char *as; /* Malloc'ed interpretation of source */ int flags; /* Sundry flags, defined below. */ TkMacOSXNSImageInstance *instancePtr; /* Start of list of instances associated * with this model. */ NSImage *image; /* The underlying NSImage object. */ NSImage *darkModeImage; /* A modified image to use in Dark Mode. */ }; /* * Bit definitions for the flags field of a TkMacOSXNSImageModel. * IMAGE_CHANGED: 1 means that the instances of this image need * to be redisplayed. */ #define IMAGE_CHANGED 1 /* * The type record for nsimage images: */ static int TkMacOSXNSImageCreate(Tcl_Interp *interp, const char *name, int argc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData TkMacOSXNSImageGet(Tk_Window tkwin, ClientData clientData); static void TkMacOSXNSImageDisplay(ClientData clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); static void TkMacOSXNSImageFree(ClientData clientData, Display *display); static void TkMacOSXNSImageDelete(ClientData clientData); static Tk_ImageType TkMacOSXNSImageType = { "nsimage", /* name of image type */ TkMacOSXNSImageCreate, /* createProc */ TkMacOSXNSImageGet, /* getProc */ TkMacOSXNSImageDisplay, /* displayProc */ TkMacOSXNSImageFree, /* freeProc */ TkMacOSXNSImageDelete, /* deleteProc */ NULL, /* postscriptPtr */ NULL, /* nextPtr */ NULL }; /* * Default values used for parsing configuration specifications: */ #define DEF_SOURCE "" #define DEF_AS "name" #define DEF_HEIGHT "0" #define DEF_WIDTH "0" #define DEF_RADIUS "0" #define DEF_RING "0" #define DEF_ALPHA "1.0" #define DEF_PRESSED "0" #define DEF_TEMPLATE "0" static const Tk_OptionSpec systemImageOptions[] = { {TK_OPTION_STRING, "-source", NULL, NULL, DEF_SOURCE, -1, Tk_Offset(TkMacOSXNSImageModel, source), 0, NULL, 0}, {TK_OPTION_STRING, "-as", NULL, NULL, DEF_AS, -1, Tk_Offset(TkMacOSXNSImageModel, as), 0, NULL, 0}, {TK_OPTION_INT, "-width", NULL, NULL, DEF_WIDTH, -1, Tk_Offset(TkMacOSXNSImageModel, width), 0, NULL, 0}, {TK_OPTION_INT, "-height", NULL, NULL, DEF_HEIGHT, -1, Tk_Offset(TkMacOSXNSImageModel, height), 0, NULL, 0}, {TK_OPTION_INT, "-radius", NULL, NULL, DEF_RADIUS, -1, Tk_Offset(TkMacOSXNSImageModel, radius), 0, NULL, 0}, {TK_OPTION_INT, "-ring", NULL, NULL, DEF_RING, -1, Tk_Offset(TkMacOSXNSImageModel, ring), 0, NULL, 0}, {TK_OPTION_DOUBLE, "-alpha", NULL, NULL, DEF_ALPHA, -1, Tk_Offset(TkMacOSXNSImageModel, alpha), 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-pressed", NULL, NULL, DEF_PRESSED, -1, Tk_Offset(TkMacOSXNSImageModel, pressed), 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-template", NULL, NULL, DEF_TEMPLATE, -1, Tk_Offset(TkMacOSXNSImageModel, pressed), 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, NULL, 0} }; /* * The -as option specifies how the string provided in the -source * option should be interpreted as a description of an NSImage. * Below are the possible values and their meanings. (The last two * provide the macOS icon for a particular file type.) */ static const char *sourceInterpretations[] = { "name", /* A name for a named NSImage. */ "file", /* A path to an image file. */ "path", /* A path to a file whose type should be examined. */ "filetype", /* A file extension or 4-byte OSCode. */ }; enum {NAME_SOURCE, FILE_SOURCE, PATH_SOURCE, FILETYPE_SOURCE}; /* *---------------------------------------------------------------------- * * TintImage -- * * Modify an NSImage by blending it with a color. The transparent part of * the image remains transparent. The opaque part of the image is painted * with the color, using the specified alpha value for the transparency of * the color. * * Results: * None. * * Side effects: * The appearance of the NSImage changes. * *---------------------------------------------------------------------- */ static void TintImage( NSImage *image, NSColor *color, double alpha) { NSSize size = [image size]; NSRect rect = {NSZeroPoint, size}; NSImage *mask = [[[NSImage alloc] initWithSize:size] retain]; [mask lockFocus]; [color set]; NSRectFillUsingOperation(rect, NSCompositeCopy); [image drawInRect:rect fromRect:rect operation:NSCompositeDestinationIn fraction:1.0]; [mask unlockFocus]; [image lockFocus]; [mask drawInRect:rect fromRect:rect operation:NSCompositeSourceOver fraction:alpha]; [image unlockFocus]; [mask release]; } /* *---------------------------------------------------------------------- * * TkMacOSXNSImageConfigureModel -- * * This function is called when an nsimage image is created or * reconfigured. It processes configuration options and resets any * instances of the image. * * Results: * A standard Tcl return value. If TCL_ERROR is returned then an error * message is left in the modelPtr->interp's result. * * Side effects: * Existing instances of the image will be redisplayed to match the new * configuration options. * *---------------------------------------------------------------------- */ static int TkMacOSXNSImageConfigureModel( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ TkMacOSXNSImageModel *modelPtr, /* Pointer to data structure describing * overall photo image to (re)configure. */ int objc, /* Number of entries in objv. */ Tcl_Obj *const objv[]) /* Pairs of configuration options for image. */ { Tk_OptionTable optionTable = Tk_CreateOptionTable(interp, systemImageOptions); NSImage *newImage; Tcl_Obj *objPtr; static Tcl_Obj *asOption = NULL; int sourceInterpretation; NSString *source; int oldWidth = modelPtr->width, oldHeight = modelPtr->height; if (asOption == NULL) { asOption = Tcl_NewStringObj("-as", -1); Tcl_IncrRefCount(asOption); } modelPtr->width = 0; modelPtr->height = 0; if (Tk_SetOptions(interp, (char *) modelPtr, optionTable, objc, objv, NULL, NULL, NULL) != TCL_OK){ goto errorExit; } if (modelPtr->width == 0 && modelPtr->height == 0) { modelPtr->width = oldWidth; modelPtr->height = oldHeight; } if (modelPtr->source == NULL || modelPtr->source[0] == '0') { Tcl_SetObjResult(interp, Tcl_NewStringObj("-source is required.", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL); goto errorExit; } objPtr = Tk_GetOptionValue(interp, (char *) modelPtr, optionTable, asOption, NULL); if (Tcl_GetIndexFromObj(interp, objPtr, sourceInterpretations, "option", 0, &sourceInterpretation) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Unknown interpretation for source in -as option. " "Should be name, file, path, or filetype.", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL); goto errorExit; } source = [[NSString alloc] initWithUTF8String: modelPtr->source]; switch (sourceInterpretation) { case NAME_SOURCE: newImage = [[NSImage imageNamed:source] copy]; break; case FILE_SOURCE: newImage = [[NSImage alloc] initWithContentsOfFile:source]; break; case PATH_SOURCE: newImage = [[NSWorkspace sharedWorkspace] iconForFile:source]; break; case FILETYPE_SOURCE: newImage = TkMacOSXIconForFileType(source); break; default: newImage = NULL; break; } [source release]; if (newImage) { NSSize size = NSMakeSize(modelPtr->width - 2*modelPtr->ring, modelPtr->height - 2*modelPtr->ring); [modelPtr->image release]; [modelPtr->darkModeImage release]; newImage.size = size; modelPtr->image = [newImage retain]; if (modelPtr->template) { newImage.template = YES; } modelPtr->darkModeImage = [[newImage copy] retain]; if ([modelPtr->darkModeImage isTemplate]) { /* * For a template image the Dark Mode version should be white. */ NSRect rect = {NSZeroPoint, size}; [modelPtr->darkModeImage lockFocus]; [[NSColor whiteColor] set]; NSRectFillUsingOperation(rect, NSCompositeSourceAtop); [modelPtr->darkModeImage unlockFocus]; } else if (modelPtr->pressed) { /* * Non-template pressed images are darker in Light Mode and lighter * in Dark Mode. */ TintImage(modelPtr->image, [NSColor blackColor], 0.2); TintImage(modelPtr->darkModeImage, [NSColor whiteColor], 0.5); } } else { switch(sourceInterpretation) { case NAME_SOURCE: Tcl_SetObjResult(interp, Tcl_NewStringObj("Unknown named NSImage.\n" "Try omitting ImageName, " "e.g. use NSCaution for NSImageNameCaution.", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL); goto errorExit; case FILE_SOURCE: Tcl_SetObjResult(interp, Tcl_NewStringObj( "Failed to load image file.\n", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL); goto errorExit; default: Tcl_SetObjResult(interp, Tcl_NewStringObj( "Unrecognized file type.\n" "If using a filename extension, do not include the dot.\n", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL); goto errorExit; } } /* * Set the width and height. If only one is specified, set the other one * so as to preserve the aspect ratio. If neither is specified, match the * size of the image. */ if (modelPtr->width == 0 && modelPtr->height == 0) { CGSize size = [modelPtr->image size]; modelPtr->width = (int) size.width; modelPtr->height = (int) size.height; } else { CGSize size = [modelPtr->image size], newsize; CGFloat aspect = size.width && size.height ? size.height / size.width : 1; if (modelPtr->width == 0) { modelPtr->width = (int) ((CGFloat)(modelPtr->height) / aspect); } else if (modelPtr->height == 0) { modelPtr->height = (int) ((CGFloat)(modelPtr->width) * aspect); } newsize = NSMakeSize(modelPtr->width, modelPtr->height); modelPtr->image.size = newsize; modelPtr->darkModeImage.size = newsize; } /* * Inform the generic image code that the image has (potentially) changed. */ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width, modelPtr->height, modelPtr->width, modelPtr->height); modelPtr->flags &= ~IMAGE_CHANGED; return TCL_OK; errorExit: return TCL_ERROR; } /* *---------------------------------------------------------------------- * * TkMacOSXNSImageObjCmd -- * * This function implements the configure and cget commands for an * nsimage instance. * * Results: * A standard Tcl result. * * Side effects: * The image may be reconfigured. * *---------------------------------------------------------------------- */ int TkMacOSXNSImageObjCmd( ClientData clientData, /* Information about the image model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkMacOSXNSImageModel *modelPtr = (TkMacOSXNSImageModel *)clientData; Tk_OptionTable optionTable = Tk_CreateOptionTable(interp, systemImageOptions); static const char *const options[] = {"cget", "configure", NULL}; enum {CGET, CONFIGURE}; Tcl_Obj *objPtr; int index; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[1], options, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } Tcl_Preserve(modelPtr); switch (index) { case CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } objPtr = Tk_GetOptionValue(interp, (char *)modelPtr, optionTable, objv[2], NULL); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); break; case CONFIGURE: if (objc == 2) { objPtr = Tk_GetOptionInfo(interp, (char *)modelPtr, optionTable, NULL, NULL); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); break; } else if (objc == 3) { objPtr = Tk_GetOptionInfo(interp, (char *)modelPtr, optionTable, objv[2], NULL); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); break; } else { TkMacOSXNSImageConfigureModel(interp, modelPtr, objc - 2, objv + 2); break; } default: break; } Tcl_Release(modelPtr); return TCL_OK; error: Tcl_Release(modelPtr); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * TkMacOSXNSImageCreate -- * * Allocate and initialize an nsimage model. * * Results: * A standard Tcl result. * * Side effects: * The data structure for a new image is allocated. * *---------------------------------------------------------------------- */ static int TkMacOSXNSImageCreate( Tcl_Interp *interp, /* Interpreter for application using image. */ const char *name, /* Name to use for image. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument strings for options (not * including image name or type). */ TCL_UNUSED(const Tk_ImageType *), /* typePtr */ Tk_ImageModel model, /* Token for image, to be used in callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { TkMacOSXNSImageModel *modelPtr; Tk_OptionTable optionTable = Tk_CreateOptionTable(interp, systemImageOptions); modelPtr = (TkMacOSXNSImageModel *)ckalloc(sizeof(TkMacOSXNSImageModel)); modelPtr->tkModel = model; modelPtr->interp = interp; modelPtr->imageName = (char *)ckalloc(strlen(name) + 1); strcpy(modelPtr->imageName, name); modelPtr->flags = 0; modelPtr->instancePtr = NULL; modelPtr->image = NULL; modelPtr->darkModeImage = NULL; modelPtr->source = NULL; modelPtr->as = NULL; /* * Process configuration options given in the image create command. */ if (Tk_InitOptions(interp, (char *) modelPtr, optionTable, NULL) != TCL_OK || TkMacOSXNSImageConfigureModel(interp, modelPtr, objc, objv) != TCL_OK) { TkMacOSXNSImageDelete(modelPtr); return TCL_ERROR; } Tcl_CreateObjCommand(interp, name, TkMacOSXNSImageObjCmd, modelPtr, NULL); *clientDataPtr = modelPtr; return TCL_OK; } /* *---------------------------------------------------------------------- * * TkMacOSXNSImageGet -- * * Allocate and initialize an nsimage instance. * * Results: * The return value is a token for the image instance, which is used in * future callbacks to ImageDisplay and ImageFree. * * Side effects: * A new new nsimage instance is created. * *---------------------------------------------------------------------- */ static ClientData TkMacOSXNSImageGet( TCL_UNUSED(Tk_Window), /* tkwin */ ClientData clientData) /* Pointer to TkMacOSXNSImageModel for image. */ { TkMacOSXNSImageModel *modelPtr = (TkMacOSXNSImageModel *) clientData; TkMacOSXNSImageInstance *instPtr; instPtr = (TkMacOSXNSImageInstance *)ckalloc(sizeof(TkMacOSXNSImageInstance)); instPtr->modelPtr = modelPtr; return instPtr; } /* *---------------------------------------------------------------------- * * TkMacOSXNSImageDisplay -- * * Display or redisplay an nsimage in the given drawable. * * Results: * None. * * Side effects: * The image gets drawn. * *---------------------------------------------------------------------- */ static void TkMacOSXNSImageDisplay( ClientData clientData, /* Pointer to TkMacOSXNSImageInstance for image. */ TCL_UNUSED(Display *), /* display */ Drawable drawable, /* Where to draw or redraw image. */ int imageX, int imageY, /* Origin of area to redraw, relative to * origin of image. */ int width, int height, /* Dimensions of area to redraw. */ int drawableX, int drawableY) /* Coordinates in drawable corresponding to * imageX and imageY. */ { MacDrawable *macWin = (MacDrawable *) drawable; Tk_Window tkwin = (Tk_Window) macWin->winPtr; TkMacOSXNSImageInstance *instPtr = (TkMacOSXNSImageInstance *) clientData; TkMacOSXNSImageModel *modelPtr = instPtr->modelPtr; TkMacOSXDrawingContext dc; NSRect dstRect = NSMakeRect(macWin->xOff + drawableX, macWin->yOff + drawableY, width, height); NSRect srcRect = NSMakeRect(imageX, imageY, width, height); NSImage *image = TkMacOSXInDarkMode(tkwin) ? modelPtr->darkModeImage : modelPtr->image; int ring = modelPtr->ring; int radius = modelPtr->radius; if (TkMacOSXSetupDrawingContext(drawable, NULL, &dc)) { if (dc.context) { CGRect clipRect = CGRectMake( dstRect.origin.x - srcRect.origin.x + ring, dstRect.origin.y - srcRect.origin.y + ring, modelPtr->width - 2*ring, modelPtr->height - 2*ring); CGPathRef path = CGPathCreateWithRoundedRect(clipRect, radius, radius, NULL); CGContextSaveGState(dc.context); CGContextBeginPath(dc.context); CGContextAddPath(dc.context, path); CGContextClip(dc.context); NSGraphicsContext *savedContext = NSGraphicsContext.currentContext; NSGraphicsContext.currentContext = [NSGraphicsContext graphicsContextWithCGContext:dc.context flipped:YES]; [image drawInRect:clipRect fromRect:srcRect operation:NSCompositeSourceOver fraction:modelPtr->alpha respectFlipped:YES hints:nil]; CGContextRestoreGState(dc.context); /* * Draw the focus ring. */ if (ring) { CGRect ringRect = CGRectInset(clipRect, -ring, -ring); CGPathRef ringPath = CGPathCreateWithRoundedRect(ringRect, radius + ring, radius + ring, NULL); CGContextSaveGState(dc.context); CGContextAddPath(dc.context, path); CGContextAddPath(dc.context, ringPath); CGContextSetFillColorWithColor(dc.context, controlAccentColor().CGColor); CGContextEOFillPath(dc.context); CGContextRestoreGState(dc.context); CFRelease(ringPath); } CFRelease(path); NSGraphicsContext.currentContext = savedContext; } TkMacOSXRestoreDrawingContext(&dc); } } /* *---------------------------------------------------------------------- * * TkMacOSXNSImageFree -- * * Deallocate an instance of an nsimage. * * Results: * None. * * Side effects: * Information related to the instance is freed. * *---------------------------------------------------------------------- */ static void TkMacOSXNSImageFree( ClientData clientData, /* Pointer to TkMacOSXNSImageInstance for instance. */ TCL_UNUSED(Display *)) /* display */ { TkMacOSXNSImageInstance *instPtr = (TkMacOSXNSImageInstance *) clientData; ckfree(instPtr); } /* *---------------------------------------------------------------------- * * TkMacOSXNSImageDelete -- * * Deallocate an nsimage model. * * Results: * None. * * Side effects: * NSImages are released and memory is freed. * *---------------------------------------------------------------------- */ static void TkMacOSXNSImageDelete( ClientData clientData) /* Pointer to TkMacOSXNSImageModel for image. When * this function is called, no more instances * exist. */ { TkMacOSXNSImageModel *modelPtr = (TkMacOSXNSImageModel *) clientData; Tcl_DeleteCommand(modelPtr->interp, modelPtr->imageName); ckfree(modelPtr->imageName); ckfree(modelPtr->source); ckfree(modelPtr->as); [modelPtr->image release]; [modelPtr->darkModeImage release]; ckfree(modelPtr); } /* *---------------------------------------------------------------------- * * TkMacOSXNSImage_Init -- * * Adds the TkMacOSXNSImage type to Tk. * * Results: * Returns a standard Tcl completion code, and leaves an error message in * the interp's result if an error occurs. * * Side effects: * Creates the image create nsrect ... command. * *---------------------------------------------------------------------- */ int TkMacOSXNSImage_Init( TCL_UNUSED(Tcl_Interp *)) /* interp */ { Tk_CreateImageType(&TkMacOSXNSImageType); return 1; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXInit.c.
1 2 3 4 5 6 | /* * tkMacOSXInit.c -- * * This file contains Mac OS X -specific interpreter initialization * functions. * | | | | | > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | /* * tkMacOSXInit.c -- * * This file contains Mac OS X -specific interpreter initialization * functions. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 2017 Marc Culler * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXConstants.h" #include <dlfcn.h> #include <objc/objc-auto.h> #include <sys/stat.h> #include <sys/utsname.h> static char tkLibPath[PATH_MAX + 1] = ""; /* * If the App is in an App package, then we want to add the Scripts directory * to the auto_path. */ static char scriptPath[PATH_MAX + 1] = ""; /* * Forward declarations... */ static int TkMacOSXGetAppPathObjCmd(TCL_UNUSED(void *), Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]); static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]); #pragma mark TKApplication(TKInit) @implementation TKApplication @synthesize poolLock = _poolLock; @synthesize macOSVersion = _macOSVersion; @synthesize isDrawing = _isDrawing; @synthesize isSigned = _isSigned; @synthesize tkLiveResizeEnded = _tkLiveResizeEnded; @synthesize tkPointerWindow = _tkPointerWindow; - (void) setTkPointerWindow: (TkWindow *)winPtr { if (_tkPointerWindow) { Tcl_Release(_tkPointerWindow); } if (winPtr) { Tcl_Preserve(winPtr); } _tkPointerWindow = winPtr; return; } @synthesize tkEventTarget = _tkEventTarget; - (void) setTkEventTarget: (TkWindow *)winPtr { if (_tkEventTarget) { Tcl_Release(_tkEventTarget); } if (winPtr) { Tcl_Preserve(winPtr); } _tkEventTarget = winPtr; return; } @synthesize tkDragTarget = _tkDragTarget; - (void) setTkDragTarget: (TkWindow *)winPtr { if (_tkDragTarget) { Tcl_Release(_tkDragTarget); } if (winPtr) { Tcl_Preserve(winPtr); } _tkDragTarget = winPtr; return; } @synthesize tkButtonState = _tkButtonState; @end /* * #define this to see a message on stderr whenever _resetAutoreleasePool is * called while the pool is locked. */ #undef DEBUG_LOCK |
︙ | ︙ | |||
100 101 102 103 104 105 106 | #ifdef TK_MAC_DEBUG_NOTIFICATIONS [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_postedNotification:) name:nil object:nil]; #endif [self _setupWindowNotifications]; [self _setupApplicationNotifications]; | < < < < < > | | > > > > | < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | #ifdef TK_MAC_DEBUG_NOTIFICATIONS [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_postedNotification:) name:nil object:nil]; #endif [self _setupWindowNotifications]; [self _setupApplicationNotifications]; if ([NSApp macOSVersion] >= 110000) { /* * Initialize Apple Event processing. Apple's docs (see * https://developer.apple.com/documentation/appkit/nsapplication) * recommend doing this here, although historically we have * done this in applicationWillFinishLaunching. In response to * bug 7bb246b072. */ TkMacOSXInitAppleEvents(_eventInterp); } } -(void)applicationDidFinishLaunching:(NSNotification *)notification { (void)notification; if ([NSApp macOSVersion] < 110000) { /* * Initialize Apple Event processing on macOS versions * older than Big Sur (11). */ TkMacOSXInitAppleEvents(_eventInterp); } /* * Initialize the graphics context. */ TkMacOSXUseAntialiasedText(_eventInterp, -1); TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0); /* * Construct the menu bar. */ _defaultMainMenu = nil; [self _setupMenus]; /* * Run initialization routines that depend on the OS version. */ Ttk_MacOSXInit(); /* * It is not safe to force activation of the NSApp until this method is * called. Activating too early can cause the menu bar to be unresponsive. * The call to activateIgnoringOtherApps was moved here to avoid this. * However, with the release of macOS 10.15 (Catalina) that was no longer * sufficient. (See ticket bf93d098d7.) The call to setActivationPolicy * needed to be moved into this function as well. */ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; [NSApp activateIgnoringOtherApps: YES]; /* * Add an event monitor so we continue to receive NSMouseMoved and * NSMouseDragged events when the mouse moves outside of the key * window. The handler simply returns the events it receives, so * they can be processed in the same way as for other events. */ [NSEvent addLocalMonitorForEventsMatchingMask:(NSMouseMovedMask | NSLeftMouseDraggedMask) handler:^NSEvent *(NSEvent *event) { return event; }]; /* * Process events to ensure that the root window is fully initialized. See * ticket 56a1823c73. */ [NSApp _lockAutoreleasePool]; |
︙ | ︙ | |||
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | [NSApp setPoolLock:0]; /* * Record the OS version we are running on. */ int minorVersion, majorVersion; #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 Gestalt(gestaltSystemVersionMinor, (SInt32*)&minorVersion); majorVersion = 10; #else NSOperatingSystemVersion systemVersion; systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; majorVersion = systemVersion.majorVersion; minorVersion = systemVersion.minorVersion; #endif [NSApp setMacOSVersion: 10000*majorVersion + 100*minorVersion]; /* * We are not drawing right now. */ [NSApp setIsDrawing:NO]; | > > > > > > > > > > > > > > > > > > > | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | [NSApp setPoolLock:0]; /* * Record the OS version we are running on. */ int minorVersion, majorVersion; #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 Gestalt(gestaltSystemVersionMinor, (SInt32*)&minorVersion); majorVersion = 10; #else NSOperatingSystemVersion systemVersion; systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; majorVersion = systemVersion.majorVersion; minorVersion = systemVersion.minorVersion; #endif if (majorVersion == 10 && minorVersion == 16) { /* * If a program compiled with a macOS 10.XX SDK is run on macOS 11.0 or * later then it will report majorVersion 10 and minorVersion 16, no * matter what the actual OS version of the host may be. And of course * Apple never released macOS 10.16. To work around this we guess the * OS version from the kernel release number, as reported by uname. */ struct utsname name; char *endptr; if (uname(&name) == 0) { majorVersion = strtol(name.release, &endptr, 10) - 9; minorVersion = 0; } } [NSApp setMacOSVersion: 10000*majorVersion + 100*minorVersion]; /* * We are not drawing right now. */ [NSApp setIsDrawing:NO]; |
︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | NSString *iconFile = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleIconFile"]; if (!iconFile) { NSString *path = [NSApp tkFrameworkImagePath:@"Tk.icns"]; if (path) { NSImage *image = [[NSImage alloc] initWithContentsOfFile:path]; if (image) { [NSApp setApplicationIconImage:image]; [image release]; } } } } | > | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | NSString *iconFile = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleIconFile"]; if (!iconFile) { NSString *path = [NSApp tkFrameworkImagePath:@"Tk.icns"]; if (path) { NSImage *image = [[NSImage alloc] initWithContentsOfFile:path]; if (image) { [image setName:@"NSApplicationIcon"]; [NSApp setApplicationIconImage:image]; [image release]; } } } } |
︙ | ︙ | |||
349 350 351 352 353 354 355 | TkpInit( Tcl_Interp *interp) { static int initialized = 0; /* * TkpInit can be called multiple times with different interpreters. But | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | TkpInit( Tcl_Interp *interp) { static int initialized = 0; /* * TkpInit can be called multiple times with different interpreters. But * The application initialization should only be done once. */ if (!initialized) { struct stat st; Bool shouldOpenConsole = NO; Bool stdinIsNullish = (!isatty(0) && (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0))); |
︙ | ︙ | |||
410 411 412 413 414 415 416 | * creates a race between the initialization of the NSApplication and * the initialization of Tk. If Tk wins the race bad things happen * with the root window (see below). If the NSApplication wins then an * AppleEvent created during launch, e.g. by dropping a file icon on * the application icon, will be delivered before the procedure meant * to to handle the AppleEvent has been defined. This is handled in * tkMacOSXHLEvents.c by scheduling a timer event to handle the | | | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | * creates a race between the initialization of the NSApplication and * the initialization of Tk. If Tk wins the race bad things happen * with the root window (see below). If the NSApplication wins then an * AppleEvent created during launch, e.g. by dropping a file icon on * the application icon, will be delivered before the procedure meant * to to handle the AppleEvent has been defined. This is handled in * tkMacOSXHLEvents.c by scheduling a timer event to handle the * AppleEvent later, after the required procedure has been defined. */ [NSApp _setup:interp]; [NSApp finishLaunching]; /* * Create a Tk event source based on the Appkit event queue. |
︙ | ︙ | |||
497 498 499 500 501 502 503 | if (getenv("XCNOSTDIN") != NULL) { close(0); close(1); } /* | | | | > | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | if (getenv("XCNOSTDIN") != NULL) { close(0); close(1); } /* * Now we can run initialization routines which require that both the * NSApplication and the Tcl interpreter have been created and * initialized. */ TkMacOSXServices_Init(interp); TkMacOSXNSImage_Init(interp); /* * The root window has been created and mapped, but XMapWindow deferred its * call to makeKeyAndOrderFront because the first call to XMapWindow * occurs too early in the initialization process for that. Process idle * tasks now, so the root window is configured, then order it front. */ |
︙ | ︙ | |||
538 539 540 541 542 543 544 | * application is killed with one of these signals. */ signal(SIGINT, TkMacOSXSignalHandler); signal(SIGHUP, TkMacOSXSignalHandler); signal(SIGTERM, TkMacOSXSignalHandler); } | < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | * application is killed with one of these signals. */ signal(SIGINT, TkMacOSXSignalHandler); signal(SIGHUP, TkMacOSXSignalHandler); signal(SIGTERM, TkMacOSXSignalHandler); } /* * Initialization steps that are needed for all interpreters. */ if (tkLibPath[0] != '\0') { Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY); } if (scriptPath[0] != '\0') { Tcl_SetVar2(interp, "auto_path", NULL, scriptPath, TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE); } Tcl_CreateObjCommand(interp, "nsimage", TkMacOSXNSImageObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel", TkMacOSXStandardAboutPanelObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", TkMacOSXIconBitmapObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPathObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::macOSVersion", TkMacOSVersionObjCmd, NULL, NULL); MacSystrayInit(interp); MacPrint_Init(interp); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkMacOSXGetAppPathObjCmd -- * * Returns the path of the Wish application bundle. * * Results: * Returns the application path. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int TkMacOSXGetAppPathObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } /* * Get the application path URL and convert it to a string path reference. */ CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); /* * Convert (and copy) the string reference into a Tcl result. */ Tcl_SetObjResult(interp, Tcl_NewStringObj( CFStringGetCStringPtr(appPath, CFStringGetSystemEncoding()), -1)); CFRelease(mainBundleURL); CFRelease(appPath); return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
602 603 604 605 606 607 608 | } Tcl_DStringAppend(namePtr, name, -1); } /* *---------------------------------------------------------------------- * | | | > > | | | | > | | < < < | < < < | < < < < | < < < < | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | } Tcl_DStringAppend(namePtr, name, -1); } /* *---------------------------------------------------------------------- * * TkMacOSVersionObjCmd -- * * Tcl command which returns an integer encoding the major and minor * version numbers of the currently running operating system in the * form 10000*majorVersion + 100*minorVersion. * * Results: * Returns the OS version. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int TkMacOSVersionObjCmd( TCL_UNUSED(void *), /* ClientData */ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { static char version[16] = ""; if (objc > 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } if (version[0] == '\0') { snprintf(version, 16, "%d", [NSApp macOSVersion]); } Tcl_SetResult(interp, version, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpDisplayWarning -- |
︙ | ︙ | |||
750 751 752 753 754 755 756 | * None. * *---------------------------------------------------------------------- */ MODULE_SCOPE void* TkMacOSXGetNamedSymbol( | | | > | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | * None. * *---------------------------------------------------------------------- */ MODULE_SCOPE void* TkMacOSXGetNamedSymbol( const char* module, const char* symbol) { void *addr = dlsym(RTLD_NEXT, symbol); (void)module; if (!addr) { (void) dlerror(); /* Clear dlfcn error state */ } return addr; } |
︙ | ︙ |
Changes to macosx/tkMacOSXInt.h.
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* * Include platform specific public interfaces. */ #ifndef _TKMAC #include "tkMacOSX.h" #import <Cocoa/Cocoa.h> #endif /* * Define compatibility platform types used in the structures below so that * this header can be included without pulling in the platform headers. */ | > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* * Include platform specific public interfaces. */ #ifndef _TKMAC #include "tkMacOSX.h" #define Cursor QDCursor #import <Cocoa/Cocoa.h> #undef Cursor #endif /* * Define compatibility platform types used in the structures below so that * this header can be included without pulling in the platform headers. */ |
︙ | ︙ | |||
94 95 96 97 98 99 100 | * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the * TkWindow structure for the window, but in the MacWin. This way we can * still tell what the correct port is after the TKWindow structure has been * freed. This actually happens when you bind destroy of a toplevel to * Destroy of a child. */ | < < < < < < < < < < < < < < < | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the * TkWindow structure for the window, but in the MacWin. This way we can * still tell what the correct port is after the TKWindow structure has been * freed. This actually happens when you bind destroy of a toplevel to * Destroy of a child. */ /* * Undef compatibility platform types defined above. */ #ifndef _TKMACPRIV # ifndef CGGEOMETRY_H_ # ifndef CGFLOAT_DEFINED |
︙ | ︙ | |||
169 170 171 172 173 174 175 | #define TK_DRAW_IN_CONTEXT 1 /* * Prototypes of internal procs not in the stubs table. */ MODULE_SCOPE void TkMacOSXDefaultStartupScript(void); | < < | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | #define TK_DRAW_IN_CONTEXT 1 /* * Prototypes of internal procs not in the stubs table. */ MODULE_SCOPE void TkMacOSXDefaultStartupScript(void); MODULE_SCOPE void TkpRetainRegion(Region r); MODULE_SCOPE void TkpReleaseRegion(Region r); MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta); MODULE_SCOPE Bool TkTestLogDisplay(Drawable drawable); /* * Include the stubbed internal platform-specific API. |
︙ | ︙ |
Changes to macosx/tkMacOSXKeyEvent.c.
1 2 3 4 5 6 | /* * tkMacOSXKeyEvent.c -- * * This file implements functions that decode & handle keyboard events on * MacOS X. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMacOSXKeyEvent.c -- * * This file implements functions that decode & handle keyboard events on * MacOS X. * * Copyright © 2001-2009, Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2012 Adrian Robert. * Copyright © 2015-2020 Marc Culler. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXInt.h" |
︙ | ︙ | |||
49 50 51 52 53 54 55 | #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif NSWindow *w = [theEvent window]; TkWindow *winPtr = TkMacOSXGetTkWindow(w), *grabWinPtr, *focusWinPtr; Tk_Window tkwin = (Tk_Window)winPtr; NSEventType type = [theEvent type]; | | > > > > > > > > > > > > | > > > | | > | | | > > > > > | > | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif NSWindow *w = [theEvent window]; TkWindow *winPtr = TkMacOSXGetTkWindow(w), *grabWinPtr, *focusWinPtr; Tk_Window tkwin = (Tk_Window)winPtr; NSEventType type = [theEvent type]; NSUInteger virt = [theEvent keyCode]; NSUInteger modifiers = ([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask); XEvent xEvent; MacKeycode macKC; UniChar keychar = 0; Bool can_input_text, has_modifiers = NO, use_text_input = NO; static NSUInteger savedModifiers = 0; static NSMutableArray *nsEvArray = nil; if (nsEvArray == nil) { nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1]; processingCompose = NO; } if (!winPtr) { return theEvent; } /* * Discard repeating KeyDown events if the repeat speed has been set to * "off" in System Preferences. It is unclear why we get these, but we do. * See ticket [2ecb09d118]. */ if ([theEvent type] == NSKeyDown && [theEvent isARepeat] && [NSEvent keyRepeatDelay] < 0) { return theEvent; } /* * If a local grab is in effect, key events for windows in the * grabber's application are redirected to the grabber. Key events * for other applications are delivered normally. If a global * grab is in effect all key events are redirected to the grabber. */ grabWinPtr = winPtr->dispPtr->grabWinPtr; if (grabWinPtr) { if (winPtr->dispPtr->grabFlags || /* global grab */ grabWinPtr->mainPtr == winPtr->mainPtr){ /* same application */ winPtr = winPtr->dispPtr->focusPtr; if (!winPtr) { return theEvent; } tkwin = (Tk_Window)winPtr; } } /* * Extract the unicode character from KeyUp and KeyDown events. */ if (type == NSKeyUp || type == NSKeyDown) { NSString *characters = [theEvent characters]; if (characters.length > 0) { keychar = [characters characterAtIndex:0]; /* * Currently, real keys always send BMP characters, but who knows? */ if (CFStringIsSurrogateHighCharacter(keychar)) { UniChar lowChar = [characters characterAtIndex:1]; keychar = CFStringGetLongCharacterForSurrogatePair( keychar, lowChar); } } else { /* * This is a dead key, such as Option-e, so it usually should get * passed to the TextInputClient. But if it has a Command modifier * then it is not functioning as a dead key and should not be * handled by the TextInputClient. See ticket [1626ed65b8] and the * method performKeyEquivalent which is implemented in * tkMacOSXMenu.c. */ if (!(modifiers & NSCommandKeyMask)) { use_text_input = YES; } } /* * Apple uses 0x10 for unrecognized keys. */ if (keychar == 0x10) { keychar = UNKNOWN_KEYCHAR; } #if defined(TK_MAC_DEBUG_EVENTS) || NS_KEYLOG == 1 TKLog(@"-[%@(%p) %s] repeat=%d mods=%x char=%x code=%lu c=%d type=%d", [self class], self, _cmd, (type == NSKeyDown) && [theEvent isARepeat], modifiers, keychar, virt, w, type); #endif } /* * Build a skeleton XEvent. We need to build it here, even if we will not * send it, so we can pass it to TkFocusKeyEvent to determine whether the |
︙ | ︙ | |||
211 212 213 214 215 216 217 | /* * We are not handling this event as an NSTextInputClient, so we need to * finish constructing the XEvent and queue it. */ macKC.v.o_s = ((modifiers & NSShiftKeyMask ? INDEX_SHIFT : 0) | (modifiers & NSAlternateKeyMask ? INDEX_OPTION : 0)); | | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | /* * We are not handling this event as an NSTextInputClient, so we need to * finish constructing the XEvent and queue it. */ macKC.v.o_s = ((modifiers & NSShiftKeyMask ? INDEX_SHIFT : 0) | (modifiers & NSAlternateKeyMask ? INDEX_OPTION : 0)); macKC.v.virt = virt; switch (type) { case NSFlagsChanged: /* * This XEvent is a simulated KeyPress or KeyRelease event for a * modifier key. To determine the type, note that the highest bit * where the flags differ is 1 if and only if it is a KeyPress. The |
︙ | ︙ | |||
251 252 253 254 255 256 257 | /* * Finally we can queue the XEvent, inserting a KeyRelease before a * repeated KeyPress. */ if (type == NSKeyDown && [theEvent isARepeat]) { | < | | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | /* * Finally we can queue the XEvent, inserting a KeyRelease before a * repeated KeyPress. */ if (type == NSKeyDown && [theEvent isARepeat]) { xEvent.xany.type = KeyRelease; Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); xEvent.xany.type = KeyPress; } Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); return theEvent; } @end @implementation TKContentView @synthesize tkDirtyRect = _tkDirtyRect; @synthesize tkNeedsDisplay = _tkNeedsDisplay; /* * Implementation of the NSTextInputClient protocol. */ /* [NSTextInputClient inputText: replacementRange:] is called by * interpretKeyEvents when a composition sequence is complete. It is also |
︙ | ︙ | |||
345 346 347 348 349 350 351 | keychar = [str characterAtIndex:i]; macKC.v.keychar = keychar; if (CFStringIsSurrogateHighCharacter(keychar)) { UniChar lowChar = [str characterAtIndex:++i]; macKC.v.keychar = CFStringGetLongCharacterForSurrogatePair( (UniChar)keychar, lowChar); | | | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | keychar = [str characterAtIndex:i]; macKC.v.keychar = keychar; if (CFStringIsSurrogateHighCharacter(keychar)) { UniChar lowChar = [str characterAtIndex:++i]; macKC.v.keychar = CFStringGetLongCharacterForSurrogatePair( (UniChar)keychar, lowChar); macKC.v.virt = NON_BMP_VIRTUAL; } else if (repRange.location == 0 || sendingIMEText) { macKC.v.virt = REPLACEMENT_VIRTUAL; } else { macKC.uint = TkMacOSXAddVirtual(macKC.uint); xEvent.xkey.state |= INDEX2STATE(macKC.x.xvirtual); } keystr = [[NSString alloc] initWithCharacters:&keychar length:1]; lower = [keystr lowercaseString]; if (![keystr isEqual: lower]) { |
︙ | ︙ | |||
600 601 602 603 604 605 606 | * Set up basic fields in xevent for keyboard input. */ static void setupXEvent(XEvent *xEvent, Tk_Window tkwin, NSUInteger modifiers) { unsigned int state = 0; | | > | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | * Set up basic fields in xevent for keyboard input. */ static void setupXEvent(XEvent *xEvent, Tk_Window tkwin, NSUInteger modifiers) { unsigned int state = 0; Display *display; if (tkwin == NULL) { return; } display = Tk_Display(tkwin); if (modifiers) { state = (modifiers & NSAlphaShiftKeyMask ? LockMask : 0) | (modifiers & NSShiftKeyMask ? ShiftMask : 0) | (modifiers & NSControlKeyMask ? ControlMask : 0) | (modifiers & NSCommandKeyMask ? Mod1Mask : 0) | (modifiers & NSAlternateKeyMask ? Mod2Mask : 0) | (modifiers & NSNumericPadKeyMask ? Mod3Mask : 0) | |
︙ | ︙ | |||
639 640 641 642 643 644 645 | { TkWindow *winPtr = (TkWindow *) tkwin; NSPoint local = [w mouseLocationOutsideOfEventStream]; NSPoint global = [w tkConvertPointToScreen: local]; int win_x, win_y; if (Tk_IsEmbedded(winPtr)) { | | | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | { TkWindow *winPtr = (TkWindow *) tkwin; NSPoint local = [w mouseLocationOutsideOfEventStream]; NSPoint global = [w tkConvertPointToScreen: local]; int win_x, win_y; if (Tk_IsEmbedded(winPtr)) { TkWindow *contPtr = (TkWindow *)Tk_GetOtherWindow(tkwin); if (Tk_IsTopLevel(contPtr)) { local.x -= contPtr->wmInfoPtr->xInParent; local.y -= contPtr->wmInfoPtr->yInParent; } else { TkWindow *topPtr = TkMacOSXGetHostToplevel(winPtr)->winPtr; local.x -= (topPtr->wmInfoPtr->xInParent + contPtr->changes.x); local.y -= (topPtr->wmInfoPtr->yInParent + contPtr->changes.y); |
︙ | ︙ | |||
701 702 703 704 705 706 707 | (void)time; if (keyboardGrabWinPtr && captureWinPtr) { NSWindow *w = TkMacOSXGetNSWindowForDrawable(grab_window); MacDrawable *macWin = (MacDrawable *)grab_window; if (w && macWin->toplevel->winPtr == (TkWindow *) captureWinPtr) { | | > > > | > | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | (void)time; if (keyboardGrabWinPtr && captureWinPtr) { NSWindow *w = TkMacOSXGetNSWindowForDrawable(grab_window); MacDrawable *macWin = (MacDrawable *)grab_window; if (w && macWin->toplevel->winPtr == (TkWindow *) captureWinPtr) { if (modalSession ) { if (keyboardGrabNSWindow == w) { return GrabSuccess; } else { Tcl_Panic("XGrabKeyboard: already grabbed"); } } keyboardGrabNSWindow = w; [w retain]; modalSession = [NSApp beginModalSessionForWindow:w]; } } return GrabSuccess; |
︙ | ︙ |
Changes to macosx/tkMacOSXKeyboard.c.
1 2 3 4 5 | /* * tkMacOSXKeyboard.c -- * * Routines to support keyboard events on the Macintosh. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkMacOSXKeyboard.c -- * * Routines to support keyboard events on the Macintosh. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009, Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 2020 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXInt.h" |
︙ | ︙ | |||
139 140 141 142 143 144 145 | /* * Prototypes for static functions used in this file. */ static void InitHashTables(void); static void UpdateKeymaps(void); static int KeyDataToUnicode(UniChar *uniChars, int maxChars, | | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | /* * Prototypes for static functions used in this file. */ static void InitHashTables(void); static void UpdateKeymaps(void); static int KeyDataToUnicode(UniChar *uniChars, int maxChars, UInt16 keyaction, UInt32 virt, UInt32 modifiers, UInt32 * deadKeyStatePtr); #pragma mark TKApplication(TKKeyboard) @implementation TKApplication(TKKeyboard) - (void) keyboardChanged: (NSNotification *) notification { |
︙ | ︙ | |||
184 185 186 187 188 189 190 | Tcl_HashEntry *hPtr; const KeyInfo *kPtr; const KeysymInfo *ksPtr; int dummy, index; Tcl_InitHashTable(&special2keysym, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&keysym2keycode, TCL_ONE_WORD_KEYS); | | | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | Tcl_HashEntry *hPtr; const KeyInfo *kPtr; const KeysymInfo *ksPtr; int dummy, index; Tcl_InitHashTable(&special2keysym, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&keysym2keycode, TCL_ONE_WORD_KEYS); for (kPtr = keyArray; kPtr->virt != 0; kPtr++) { MacKeycode macKC; macKC.v.o_s = 0; hPtr = Tcl_CreateHashEntry(&special2keysym, INT2PTR(kPtr->virt), &dummy); Tcl_SetHashValue(hPtr, INT2PTR(kPtr->keysym)); hPtr = Tcl_CreateHashEntry(&keysym2keycode, INT2PTR(kPtr->keysym), &dummy); macKC.v.virt = kPtr->virt; macKC.v.keychar = kPtr->keychar; Tcl_SetHashValue(hPtr, INT2PTR(macKC.uint)); /* * The Carbon framework does not work for finding the unicode character * of a special key. But that does not depend on the keyboard layout, * so we can record the information here. |
︙ | ︙ | |||
248 249 250 251 252 253 254 | */ static void UpdateKeymaps() { static Bool keymapInitialized = false; Tcl_HashEntry *hPtr; | | | | | | | | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | */ static void UpdateKeymaps() { static Bool keymapInitialized = false; Tcl_HashEntry *hPtr; int virt, index, dummy; if (!keymapInitialized) { Tcl_InitHashTable(&unichar2xvirtual, TCL_ONE_WORD_KEYS); keymapInitialized = true; } else { Tcl_DeleteHashTable(&unichar2xvirtual); Tcl_InitHashTable(&unichar2xvirtual, TCL_ONE_WORD_KEYS); } /* * This loop goes backwards so that a lookup by keychar will provide the * minimal modifier mask. Simpler combinations will overwrite more complex * ones when constructing the table. */ for (index = 3; index >= 0; index--) { for (virt = 0; virt < 128; virt++) { MacKeycode macKC; macKC.v = (keycode_v) {.virt = virt, .o_s = index, .keychar = 0}; int modifiers = INDEX2CARBON(index); UniChar keychar = 0; KeyDataToUnicode(&keychar, 1, kUCKeyActionDown, virt, modifiers, NULL); if (keychar == 0x10) { /* * This is a special key, handled in InitHashTables. */ continue; } macKC.v.keychar = keychar; if (! ON_KEYPAD(virt)) { hPtr = Tcl_CreateHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar), &dummy); Tcl_SetHashValue(hPtr, INT2PTR(macKC.x.xvirtual)); } xvirtual2unichar[macKC.x.xvirtual] = macKC.x.keychar; } } |
︙ | ︙ | |||
322 323 324 325 326 327 328 | static int KeyDataToUnicode( UniChar *uniChars, int maxChars, UInt16 keyaction, | | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | static int KeyDataToUnicode( UniChar *uniChars, int maxChars, UInt16 keyaction, UInt32 virt, UInt32 modifiers, UInt32 *deadKeyStatePtr) { static const void *layoutData = NULL; static UInt32 keyboardType = 0; UniCharCount actuallength = 0; |
︙ | ︙ | |||
351 352 353 354 355 356 357 | keyboardChanged = 0; } if (layoutData) { OptionBits options = 0; UInt32 dummyState; OSStatus err; | | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | keyboardChanged = 0; } if (layoutData) { OptionBits options = 0; UInt32 dummyState; OSStatus err; virt &= 0xFF; modifiers = (modifiers >> 8) & 0xFF; if (!deadKeyStatePtr) { options = kUCKeyTranslateNoDeadKeysMask; dummyState = 0; deadKeyStatePtr = &dummyState; } err = ChkErr(UCKeyTranslate, (const UCKeyboardLayout *)layoutData, virt, keyaction, modifiers, keyboardType, options, deadKeyStatePtr, maxChars, &actuallength, uniChars); if (!actuallength && *deadKeyStatePtr) { /* * We are waiting for another key. */ |
︙ | ︙ | |||
420 421 422 423 424 425 426 | macKC.v.o_s = index; /* * First check if the virtual keycode corresponds to a special key, such as * an Fn function key or Tab, Backspace, Home, End, etc. */ | | | | | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | macKC.v.o_s = index; /* * First check if the virtual keycode corresponds to a special key, such as * an Fn function key or Tab, Backspace, Home, End, etc. */ hPtr = Tcl_FindHashEntry(&special2keysym, INT2PTR(macKC.v.virt)); if (hPtr != NULL) { return (KeySym) Tcl_GetHashValue(hPtr); } /* * If the virtual value in this keycode does not correspond to an actual * key in the current keyboard layout, try using its keychar to look up a * keysym. */ if (macKC.v.virt > 127) { hPtr = Tcl_FindHashEntry(&unichar2keysym, INT2PTR(macKC.v.keychar)); if (hPtr != NULL) { return (KeySym) Tcl_GetHashValue(hPtr); } } /* * If the virtual keycode does belong to a key, use the virtual and the * Option-Shift from index to look up a keychar by using the Carbon * Framework; then translate the keychar to a keysym using the * unicode2keysym hash table. */ modifiers = INDEX2CARBON(macKC.v.o_s); result = KeyDataToUnicode(&keychar, 1, kUCKeyActionDown, macKC.v.virt, modifiers, NULL); if (result) { hPtr = Tcl_FindHashEntry(&unichar2keysym, INT2PTR(keychar)); if (hPtr != NULL) { return (KeySym) Tcl_GetHashValue(hPtr); } } |
︙ | ︙ | |||
633 634 635 636 637 638 639 | /* * First check for a special key. */ hPtr = Tcl_FindHashEntry(&keysym2keycode, INT2PTR(keysym)); if (hPtr != NULL) { | | | | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | /* * First check for a special key. */ hPtr = Tcl_FindHashEntry(&keysym2keycode, INT2PTR(keysym)); if (hPtr != NULL) { return (KeyCode) PTR2INT(Tcl_GetHashValue(hPtr)); } /* * Initialize the keycode as if the keysym cannot be converted to anything * else. */ macKC.v.virt = NO_VIRTUAL; macKC.v.o_s = 0; macKC.v.keychar = 0; /* * If the keysym is recognized fill in the keychar. Also fill in the * xvirtual field if the key exists on the current keyboard. */ |
︙ | ︙ | |||
715 716 717 718 719 720 721 | if (macKC.v.o_s != eventIndex) { macKC.v.o_s |= eventIndex; } if (macKC.v.keychar < 0xF700) { UniChar keychar = macKC.v.keychar; NSString *str, *lower, *upper; | | | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | if (macKC.v.o_s != eventIndex) { macKC.v.o_s |= eventIndex; } if (macKC.v.keychar < 0xF700) { UniChar keychar = macKC.v.keychar; NSString *str, *lower, *upper; if (macKC.v.virt != NO_VIRTUAL) { macKC.x.keychar = xvirtual2unichar[macKC.x.xvirtual]; } else { str = [[NSString alloc] initWithCharacters:&keychar length:1]; lower = [str lowercaseString]; upper = [str uppercaseString]; if (![str isEqual: lower]) { macKC.v.o_s |= INDEX_SHIFT; |
︙ | ︙ | |||
777 778 779 780 781 782 783 | } /* * Modifier key events have a special mac keycode (see tkProcessKeyEvent). */ if (macKC.v.keychar == MOD_KEYCHAR) { | | | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | } /* * Modifier key events have a special mac keycode (see tkProcessKeyEvent). */ if (macKC.v.keychar == MOD_KEYCHAR) { switch (macKC.v.virt) { case 54: return XK_Meta_R; case 55: return XK_Meta_L; case 56: return XK_Shift_L; case 57: |
︙ | ︙ | |||
949 950 951 952 953 954 955 | hPtr = (Tcl_HashEntry *) Tcl_FindHashEntry(&unichar2xvirtual, INT2PTR(macKC.v.keychar)); if (hPtr != NULL) { unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr); macKC.x.xvirtual = (unsigned int) data; } else { | | | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | hPtr = (Tcl_HashEntry *) Tcl_FindHashEntry(&unichar2xvirtual, INT2PTR(macKC.v.keychar)); if (hPtr != NULL) { unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr); macKC.x.xvirtual = (unsigned int) data; } else { macKC.v.virt = NO_VIRTUAL; } return macKC.uint; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXKeysyms.h.
1 2 3 4 5 6 | /* * tkMacOSXKeysyms.h -- * * Contains data used for processing key events, some of which was * moved from tkMacOSXKeyboard.c. * | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tkMacOSXKeysyms.h -- * * Contains data used for processing key events, some of which was * moved from tkMacOSXKeyboard.c. * * Copyright © 1990-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2020 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef TKMACOSXKEYSYMS_H #define TKMACOSXKEYSYMS_H 1 |
︙ | ︙ | |||
27 28 29 30 31 32 33 | * The table includes every key listed in Apple's documentation of Function-Key * Unicodes which is not marked as "Not on most Macintosh keyboards", as well * as F20, which is reported to be usable in scripts even though it does not * appear on any Macintosh keyboard. */ typedef struct { | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | * The table includes every key listed in Apple's documentation of Function-Key * Unicodes which is not marked as "Not on most Macintosh keyboards", as well * as F20, which is reported to be usable in scripts even though it does not * appear on any Macintosh keyboard. */ typedef struct { int virt; /* value of [NSEvent keyCode] */ KeySym keysym; /* X11 keysym */ KeyCode keychar; /* XEvent keycode & 0xFFFF */ } KeyInfo; static const KeyInfo keyArray[] = { {36, XK_Return, NSNewlineCharacter}, {48, XK_Tab, NSTabCharacter}, |
︙ | ︙ |
Changes to macosx/tkMacOSXMenu.c.
1 2 3 4 5 | /* * tkMacOSXMenu.c -- * * This module implements the Mac-platform specific features of menus. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkMacOSXMenu.c -- * * This module implements the Mac-platform specific features of menus. * * Copyright © 1996-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 2012 Adrian Robert. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMenubutton.h" |
︙ | ︙ | |||
87 88 89 90 91 92 93 | ACCEL(Power, 0x233d), ACCEL(Eject, 0xf804), {NULL, 0, 0} }; #undef ACCEL #undef sl | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | ACCEL(Power, 0x233d), ACCEL(Eject, 0xf804), {NULL, 0, 0} }; #undef ACCEL #undef sl static Bool inPostMenu = false; static SInt32 menuMarkColumnWidth = 0, menuIconTrailingEdgeMargin = 0; static SInt32 menuTextLeadingEdgeMargin = 0, menuTextTrailingEdgeMargin = 0; static SInt16 menuItemExtraHeight = 0, menuItemExtraWidth = 0; static SInt16 menuSeparatorHeight = 0; static void CheckForSpecialMenu(TkMenu *menuPtr); static NSString *ParseAccelerator(const char *accel, NSUInteger *maskPtr); |
︙ | ︙ | |||
117 118 119 120 121 122 123 | * event loop in the mode NSEventTrackingRunLoopMode which does not return * until the menu has been dismissed. In Tk 8.6.10 and earlier, this meant * that the Tk event loop would block in its call to the check proc as long as * the menu was posted. For example, opening a menu during the Rube Goldberg * demo would cause the animation to stop. This was also the case for * menubuttons. * | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | * event loop in the mode NSEventTrackingRunLoopMode which does not return * until the menu has been dismissed. In Tk 8.6.10 and earlier, this meant * that the Tk event loop would block in its call to the check proc as long as * the menu was posted. For example, opening a menu during the Rube Goldberg * demo would cause the animation to stop. This was also the case for * menubuttons. * * The TKBackgroundLoop object below works around this problem, and allows a Tk * event loop to run while a menu is open. It is a subclass of NSThread which * inserts requests to call [NSApp _runBackgroundLoop] onto the queue * associated with the NSEventTrackingRunLoopMode. One of these threads gets * started in the callback [NSApp menuBeginTracking] and cancelled in [NSApp * menuEndTracking]. */ |
︙ | ︙ | |||
160 161 162 163 164 165 166 | } [pool drain]; } @end TKBackgroundLoop *backgroundLoop = nil; | < | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | } [pool drain]; } @end TKBackgroundLoop *backgroundLoop = nil; #pragma mark TKMenu /* * This interface is not declared in tkMacOSXPrivate.h because it requires * tkMenu.h. */ |
︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | NSAssert(!_tkSpecial, @"Cannot change specialness of a special menu"); _tkSpecial = special; } - (BOOL) isSpecial: (NSUInteger) special { return (_tkSpecial == special); } @end @implementation TKMenu(TKMenuPrivate) - (id) initWithTitle: (NSString *) aTitle { self = [super initWithTitle:aTitle]; if (self) { _tkMenu = NULL; _tkOffset = 0; _tkItemCount = 0; _tkSpecial = 0; [self setDelegate:self]; } return self; } - (id) initWithTkMenu: (TkMenu *) tkMenu { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | NSAssert(!_tkSpecial, @"Cannot change specialness of a special menu"); _tkSpecial = special; } - (BOOL) isSpecial: (NSUInteger) special { return (_tkSpecial == special); } /* * There are cases where a KeyEquivalent (aka menu accelerator) is defined for * a "dead key", i.e. a key which does not have an associated character but is * only meant to be the start of a composition sequence. For example, on a * Spanish keyboard both the ' and the ` keys are dead keys used to place * accents over letters. But ⌘` is a standard KeyEquivalent which cycles * through the open windows of an application, changing the focus to the next * window. This caused a bug reported in [1626ed65b8]. When a dead key that is * also as a KeyEquivalent is pressed, a KeyDown event with no characters would * be passed to performKeyEquivalent. The default implementation provided by * Apple would cause that event to be routed to some private methods of NSMenu * which raise NSInvalidArgumentException, causing an abort. Returning NO in * such a case prevents the abort. So the override below returns NO when the * event has no characters. * * In fact, however, we never want to handle accelerators because they are * handled by Tk. Hence this method could always return NO. But if we did * that then we would not see the menu flash when an accelerator is pressed. * The flash is a useful visual indicator. It turns out that the flash is an * undocumented side effect of calling the super method for * performKeyEquivalent. The super method also calls the NSMenuItem's action * method - tkMenuItemInvoke in our case. This is also not documented. * * To enable the flash we set up a flag that tells the action method to do * nothing, because it is being called by an accelerator. The override below * sets the flag and then calls super. See ticket [ead70921a9]. */ static Bool runMenuCommand = true; - (BOOL)performKeyEquivalent:(NSEvent *)event { if ([[event characters] length] == 0) { return NO; } runMenuCommand = false; /* Make the menu flash and call tkMenuItemInvoke. */ return [super performKeyEquivalent: event]; } @end @implementation TKMenu(TKMenuPrivate) - (id) initWithTitle: (NSString *) aTitle { self = [super initWithTitle:aTitle]; if (self) { _tkMenu = NULL; _tkOffset = 0; _tkItemCount = 0; _tkSpecial = 0; [self setDelegate:self]; } return self; } - (id) initWithTkMenu: (TkMenu *) tkMenu { NSString *title = [[TKNSString alloc] initWithTclUtfBytes: Tk_PathName(tkMenu->tkwin) length:-1]; self = [self initWithTitle:title]; [title release]; if (self) { _tkMenu = tkMenu; } return self; |
︙ | ︙ | |||
229 230 231 232 233 234 235 | copy->_tkItemCount = _tkItemCount; copy->_tkSpecial = _tkSpecial; return copy; } - (TkMenu *) tkMenu { | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | copy->_tkItemCount = _tkItemCount; copy->_tkSpecial = _tkSpecial; return copy; } - (TkMenu *) tkMenu { return (TkMenu *)_tkMenu; } - (int) tkIndexOfItem: (NSMenuItem *) menuItem { return [self indexOfItem:menuItem] - _tkOffset; } |
︙ | ︙ | |||
297 298 299 300 301 302 303 | - (BOOL)worksWhenModal { return YES; } - (void) tkMenuItemInvoke: (id) sender { | > > | > > > | > > > | > | < < < < < < < < < < | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | - (BOOL)worksWhenModal { return YES; } - (void) tkMenuItemInvoke: (id) sender { if (!runMenuCommand) { /* * We are being called for a menu accelerator. Tk will handle it. * Just update the runMenuCommand flag. */ runMenuCommand = true; return; } /* * We are being called for an actual menu item selection; run the command. */ if ([sender isKindOfClass:[NSMenuItem class]]) { NSMenuItem *menuItem = (NSMenuItem *) sender; TkMenu *menuPtr = (TkMenu *) _tkMenu; TkMenuEntry *mePtr = (TkMenuEntry *) [menuItem tag]; if (menuPtr && mePtr) { Tcl_Interp *interp = menuPtr->interp; Tcl_Preserve(interp); Tcl_Preserve(menuPtr); int result = TkInvokeMenu(interp, menuPtr, mePtr->index); if (result != TCL_OK && result != TCL_CONTINUE && result != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (menu invoke)"); Tcl_BackgroundException(interp, result); } Tcl_Release(menuPtr); Tcl_Release(interp); |
︙ | ︙ | |||
412 413 414 415 416 417 418 | } - (void) menuDidClose: (NSMenu *) menu { (void)menu; if (_tkMenu) { | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | } - (void) menuDidClose: (NSMenu *) menu { (void)menu; if (_tkMenu) { RecursivelyClearActiveMenu((TkMenu *)_tkMenu); } } - (void) menu: (NSMenu *) menu willHighlightItem: (NSMenuItem *) item { (void)menu; |
︙ | ︙ | |||
436 437 438 439 440 441 442 | if (menuPtr) { Tcl_Interp *interp = menuPtr->interp; Tcl_Preserve(interp); Tcl_Preserve(menuPtr); | | | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | if (menuPtr) { Tcl_Interp *interp = menuPtr->interp; Tcl_Preserve(interp); Tcl_Preserve(menuPtr); int result = TkPostCommand(menuPtr); if (result!=TCL_OK && result!=TCL_CONTINUE && result!=TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (menu preprocess)"); Tcl_BackgroundException(interp, result); } Tcl_Release(menuPtr); Tcl_Release(interp); |
︙ | ︙ | |||
464 465 466 467 468 469 470 | #endif if (backgroundLoop) { [backgroundLoop cancel]; [backgroundLoop release]; } backgroundLoop = [[TKBackgroundLoop alloc] init]; [backgroundLoop start]; | | > > > > | > | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | #endif if (backgroundLoop) { [backgroundLoop cancel]; [backgroundLoop release]; } backgroundLoop = [[TKBackgroundLoop alloc] init]; [backgroundLoop start]; /* * Make sure that we can run commands when actually using a menu. * See [412b80fcaf]. */ runMenuCommand = true; } - (void) menuEndTracking: (NSNotification *) notification { (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); |
︙ | ︙ | |||
681 682 683 684 685 686 687 | NSMenuItem *menuItem = (NSMenuItem *) mePtr->platformEntryData; NSString *title = @""; NSAttributedString *attributedTitle = nil; NSImage *image = nil; NSString *keyEquivalent = @""; NSUInteger modifierMask = NSCommandKeyMask; NSMenu *submenu = nil; | < < < < | < | < > | | < | > | > > > > > | | > > > > > > > > > > > > | | > | | < > > | | | | > | < > > | > | > > | | | | | > > < < | < | < < < < < < < < | < | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | NSMenuItem *menuItem = (NSMenuItem *) mePtr->platformEntryData; NSString *title = @""; NSAttributedString *attributedTitle = nil; NSImage *image = nil; NSString *keyEquivalent = @""; NSUInteger modifierMask = NSCommandKeyMask; NSMenu *submenu = nil; int imageWidth, imageHeight; GC gc = (mePtr->textGC ? mePtr->textGC : mePtr->menuPtr->textGC); Tcl_Obj *fontPtr = (mePtr->fontPtr ? mePtr->fontPtr : mePtr->menuPtr->fontPtr); static int initialized = 0; if (!initialized) { TkColor *tkColPtr = TkpGetColor(NULL, DEF_MENU_BG_COLOR); ckfree(tkColPtr); tkColPtr = TkpGetColor(NULL, DEF_MENU_FG); ckfree(tkColPtr); } if (mePtr->image) { Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight); image = TkMacOSXGetNSImageFromTkImage(mePtr->menuPtr->display, mePtr->image, imageWidth, imageHeight); } else if (mePtr->bitmapPtr != NULL) { Pixmap bitmap = Tk_GetBitmapFromObj(mePtr->menuPtr->tkwin, mePtr->bitmapPtr); Tk_SizeOfBitmap(mePtr->menuPtr->display, bitmap, &imageWidth, &imageHeight); image = TkMacOSXGetNSImageFromBitmap(mePtr->menuPtr->display, bitmap, gc, imageWidth, imageHeight); [image setTemplate:YES]; } [menuItem setImage:image]; if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr && mePtr->labelLength) { title = [[TKNSString alloc] initWithTclUtfBytes:Tcl_GetString(mePtr->labelPtr) length:mePtr->labelLength]; if ([title hasSuffix:@"..."]) { title = [NSString stringWithFormat:@"%@%C", [title substringToIndex:[title length] - 3], 0x2026]; } } [menuItem setTitle:title]; #if 0 /* * The -background and -foreground options are now ignored in Aqua. * See ticket [635167af14]. */ NSDictionary fontAttributes = TkMacOSXNSFontAttributesForFont( Tk_GetFontFromObj(mePtr->menuPtr->tkwin, fontPtr)); NSMutableDictionary *attributes = [fontAttributes mutableCopy]; static unsigned long defaultBg = 0, defaultFg = 0; if (defaultBg == 0) { tkColor *tkColPtr = TkpGetColor(NULL, DEF_MENU_BG_COLOR); defaultBg = tkColPtr->color.pixel; ckfree(tkColPtr); } if (defaultFg == 0) { tkColor *tkColPtr = TkpGetColor(NULL, DEF_MENU_FG); defaultFg = tkColPtr->color.pixel; ckfree(tkColPtr); } if (gc->foreground != defaultFg) { NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); [attributes setObject:fgcolor forKey:NSForegroundColorAttributeName]; } if (gc->background != defaultBg) { NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); [attributes setObject:bgcolor forKey:NSBackgroundColorAttributeName]; } #else NSDictionary *attributes = TkMacOSXNSFontAttributesForFont( Tk_GetFontFromObj(mePtr->menuPtr->tkwin, fontPtr)); #endif attributedTitle = [[NSAttributedString alloc] initWithString:title attributes:attributes]; [menuItem setAttributedTitle:attributedTitle]; [menuItem setEnabled:(mePtr->state != ENTRY_DISABLED)]; [menuItem setState:((mePtr->type == CHECK_BUTTON_ENTRY || mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)]; if (mePtr->type != CASCADE_ENTRY && mePtr->accelPtr && mePtr->accelLength) { keyEquivalent = ParseAccelerator(Tcl_GetString(mePtr->accelPtr), &modifierMask); } [menuItem setKeyEquivalent:keyEquivalent]; [menuItem setKeyEquivalentModifierMask:modifierMask]; if (mePtr->type == CASCADE_ENTRY && mePtr->namePtr) { TkMenuReferences *menuRefPtr; menuRefPtr = TkFindMenuReferencesObj(mePtr->menuPtr->interp, mePtr->namePtr); if (menuRefPtr && menuRefPtr->menuPtr) { CheckForSpecialMenu(menuRefPtr->menuPtr); submenu = (TKMenu *) menuRefPtr->menuPtr->platformData; if ([submenu supermenu] && [menuItem submenu] != submenu) { /* * This happens during a clone, where the parent menu is * cloned before its children, so just ignore this temporary * setting, it will be changed shortly (c.f. tkMenu.c * CloneMenu()) */ submenu = nil; } else { [submenu setTitle:title]; if ([menuItem isEnabled]) { /* * This menuItem might have been previously disabled which * would have disabled all of its entries; we must re-enable the * entries here. It is important to iterate though the Tk * entries, not the NSMenuItems, since some NSMenuItems may * have been added by the system. See [7185d26cf4]. */ for (TkSizeT i = 0; i < menuRefPtr->menuPtr->numEntries; i++) { TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; NSMenuItem *item = (NSMenuItem *) submePtr->platformEntryData; [item setEnabled:(submePtr->state != ENTRY_DISABLED)]; } } } } } [menuItem setSubmenu:submenu]; |
︙ | ︙ | |||
904 905 906 907 908 909 910 | NSView *view = [win contentView]; NSMenu *menu = (NSMenu *) menuPtr->platformData; NSInteger itemIndex = index; NSInteger numItems = [menu numberOfItems]; NSMenuItem *item = nil; NSPoint location = NSMakePoint(x, TkMacOSXZeroScreenHeight() - y); | | | | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | NSView *view = [win contentView]; NSMenu *menu = (NSMenu *) menuPtr->platformData; NSInteger itemIndex = index; NSInteger numItems = [menu numberOfItems]; NSMenuItem *item = nil; NSPoint location = NSMakePoint(x, TkMacOSXZeroScreenHeight() - y); inPostMenu = true; result = TkPreprocessMenu(menuPtr); if (result != TCL_OK) { inPostMenu = false; return result; } if (itemIndex >= numItems) { itemIndex = numItems - 1; } if (itemIndex >= 0) { item = [menu itemAtIndex:itemIndex]; |
︙ | ︙ | |||
929 930 931 932 933 934 935 | if (menuPtr->tkwin == NULL) { return TCL_OK; } [menu popUpMenuPositioningItem:item atLocation:[win tkConvertPointFromScreen:location] inView:view]; | | | 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 | if (menuPtr->tkwin == NULL) { return TCL_OK; } [menu popUpMenuPositioningItem:item atLocation:[win tkConvertPointFromScreen:location] inView:view]; inPostMenu = false; return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpPostTearoffMenu -- |
︙ | ︙ | |||
972 973 974 975 976 977 978 | int x, int y, int index) /* The screen coordinates where the top left * corner of the menu, or of the specified * entry, will be located. */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; | < < < < < < < > > > > > > > > > > > > | 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | int x, int y, int index) /* The screen coordinates where the top left * corner of the menu, or of the specified * entry, will be located. */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; TkActivateMenuEntry(menuPtr, -1); TkRecomputeMenu(menuPtr); result = TkPostCommand(menuPtr); if (result != TCL_OK) { return result; } /* * The post commands could have deleted the menu, which means we are dead * and should go away. */ if (menuPtr->tkwin == NULL) { return TCL_OK; } /* * Adjust the menu y position so that the specified entry will be located * at the given coordinates. */ if (index < 0 || (TkSizeT)index >= menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { y -= menuPtr->entries[index]->y; } /* * Adjust the position of the menu if necessary to keep it visible on the * screen. There are two special tricks to make this work right: * * 1. If a virtual root window manager is being used then the coordinates * are in the virtual root window of menuPtr's parent; since the menu |
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | winPtr->wmInfoPtr->menuPtr = menuPtr; } } /* *---------------------------------------------------------------------- * | | | | 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | winPtr->wmInfoPtr->menuPtr = menuPtr; } } /* *---------------------------------------------------------------------- * * Tk_SetMainMenubar -- * * Puts the menu associated with a window into the menubar. Should only be * called when the window is in front. * * This is a no-op on all other platforms. On OS X it is a no-op when * passed a NULL menuName or a nonexistent menuName, with an exception for * the first call in a new interpreter. In that special case, passing a * NULL menuName installs the default menu. * * Results: * None. * * Side effects: * The menubar may be changed. * *---------------------------------------------------------------------- */ void Tk_SetMainMenubar( Tcl_Interp *interp, /* The interpreter of the application */ Tk_Window tkwin, /* The frame we are setting up */ const char *menuName) /* The name of the menu to put in front. */ { static Tcl_Interp *currentInterp = NULL; TKMenu *menu = nil; TkWindow *winPtr = (TkWindow *) tkwin; |
︙ | ︙ | |||
1270 1271 1272 1273 1274 1275 1276 | } i++; } } if (ch) { return [[[NSString alloc] initWithCharacters:&ch length:1] autorelease]; } else { | | | | 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 | } i++; } } if (ch) { return [[[NSString alloc] initWithCharacters:&ch length:1] autorelease]; } else { return [[[[TKNSString alloc] initWithTclUtfBytes:accel length:-1] autorelease] lowercaseString]; } } /* *-------------------------------------------------------------- * * ModifierCharWidth -- * * Helper measuring width of command char in given font. * * Results: * Width of command char. * * Side effects: * None. * |
︙ | ︙ | |||
1330 1331 1332 1333 1334 1335 1336 | void TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { NSSize menuSize; Tk_Font tkfont, menuFont; | | | 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | void TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { NSSize menuSize; Tk_Font tkfont, menuFont; Tk_FontMetrics menuMetrics, entryMetrics; int modifierCharWidth, menuModifierCharWidth; int x, y, modifierWidth, labelWidth, indicatorSpace; int windowWidth, windowHeight, accelWidth; int i, maxWidth; int entryWidth, maxIndicatorSpace, borderWidth, activeBorderWidth; TkMenuEntry *mePtr; int haveAccel = 0; |
︙ | ︙ | |||
1385 1386 1387 1388 1389 1390 1391 | for (i = 0; i < (int) menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->type == TEAROFF_ENTRY) { continue; } if (mePtr->fontPtr == NULL) { tkfont = menuFont; | < < | 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 | for (i = 0; i < (int) menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->type == TEAROFF_ENTRY) { continue; } if (mePtr->fontPtr == NULL) { tkfont = menuFont; modifierCharWidth = menuModifierCharWidth; } else { tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr); Tk_GetFontMetrics(tkfont, &entryMetrics); modifierCharWidth = ModifierCharWidth(tkfont); } accelWidth = modifierWidth = indicatorSpace = 0; if (mePtr->type == SEPARATOR_ENTRY) { mePtr->height = menuSeparatorHeight; } else { /* |
︙ | ︙ | |||
1561 1562 1563 1564 1565 1566 1567 | *---------------------------------------------------------------------- */ void MenuSelectEvent( TkMenu *menuPtr) /* the menu we have selected. */ { | | | | | | | | | | | | | | | | | | 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 | *---------------------------------------------------------------------- */ void MenuSelectEvent( TkMenu *menuPtr) /* the menu we have selected. */ { union {XEvent general; XVirtualEvent virt;} event; bzero(&event, sizeof(event)); event.virt.type = VirtualEvent; event.virt.serial = LastKnownRequestProcessed(menuPtr->display); event.virt.send_event = false; event.virt.display = menuPtr->display; event.virt.event = Tk_WindowId(menuPtr->tkwin); event.virt.root = XRootWindow(menuPtr->display, 0); event.virt.subwindow = None; event.virt.time = TkpGetMS(); XQueryPointer(NULL, None, NULL, NULL, &event.virt.x_root, &event.virt.y_root, NULL, NULL, &event.virt.state); event.virt.same_screen = true; event.virt.name = Tk_GetUid("MenuSelect"); Tk_MakeWindowExist(menuPtr->tkwin); if (Tcl_GetServiceMode() != TCL_SERVICE_NONE) { Tk_HandleEvent(&event.general); } else { Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } } /* *---------------------------------------------------------------------- * * RecursivelyClearActiveMenu -- |
︙ | ︙ | |||
1670 1671 1672 1673 1674 1675 1676 | * *---------------------------------------------------------------------- */ void TkpMenuInit(void) { | < < | 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 | * *---------------------------------------------------------------------- */ void TkpMenuInit(void) { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; #define observe(n, s) \ [nc addObserver:NSApp selector:@selector(s) name:(n) object:nil] observe(NSMenuDidBeginTrackingNotification, menuBeginTracking:); observe(NSMenuDidEndTrackingNotification, menuEndTracking:); #undef observe |
︙ | ︙ | |||
1811 1812 1813 1814 1815 1816 1817 | /* *---------------------------------------------------------------------- * * TkpDrawMenuEntry -- * * Draws the given menu entry at the given coordinates with the given | | > > > > | | 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 | /* *---------------------------------------------------------------------- * * TkpDrawMenuEntry -- * * Draws the given menu entry at the given coordinates with the given * attributes. This is a no-op on macOS since the menus are drawn by * the Apple window manager, which also handles all events related to * selecting menu items. This function is only called for tearoff * menus, which are not supported on macOS but do get drawn as nearly * invisible 1 pixel wide windows on macOS * * Results: * None. * * Side effects: * None * *---------------------------------------------------------------------- */ void TkpDrawMenuEntry( TCL_UNUSED(TkMenuEntry *), /* The entry to draw */ |
︙ | ︙ |
Changes to macosx/tkMacOSXMenubutton.c.
1 2 3 4 5 6 | /* * tkMacOSXMenubutton.c -- * * This file implements the Macintosh specific portion of the menubutton * widget. * | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tkMacOSXMenubutton.c -- * * This file implements the Macintosh specific portion of the menubutton * widget. * * Copyright © 1996 Sun Microsystems, Inc. * Copyright © 2001 Apple Computer, Inc. * Copyright © 2006-2007 Daniel A. Steffen <[email protected]> * Copyright © 2007 Revar Desmera. * Copyright © 2015 Kevin Walzer/WordTech Communications LLC. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * */ #include "tkMacOSXPrivate.h" |
︙ | ︙ | |||
161 162 163 164 165 166 167 | *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { | | | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { MacMenuButton *mbPtr = (MacMenuButton *)clientData; TkMenuButton *butPtr = (TkMenuButton *)clientData; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; DrawParams *dpPtr = &mbPtr->drawParams; butPtr->flags &= ~REDRAW_PENDING; if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; |
︙ | ︙ | |||
236 237 238 239 240 241 242 | * Side effects: * The menu button's window may change size. * *---------------------------------------------------------------------- */ void | | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | * Side effects: * The menu button's window may change size. * *---------------------------------------------------------------------- */ void TkpComputeMenuButtonGeometry( TkMenuButton *butPtr) /* Widget record for menu button. */ { int width, height, avgWidth, haveImage = 0, haveText = 0; int txtWidth, txtHeight; Tk_FontMetrics fm; int highlightWidth = butPtr->highlightWidth > 0 ? butPtr->highlightWidth : 0; /* |
︙ | ︙ | |||
371 372 373 374 375 376 377 | DrawMenuButtonImageAndText( TkMenuButton *butPtr) { MacMenuButton *mbPtr = (MacMenuButton *) butPtr; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; int haveImage = 0, haveText = 0; | < < < < | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | DrawMenuButtonImageAndText( TkMenuButton *butPtr) { MacMenuButton *mbPtr = (MacMenuButton *) butPtr; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; int haveImage = 0, haveText = 0; int imageXOffset = 0, imageYOffset = 0; int textXOffset = 0, textYOffset = 0; int width = 0, height = 0; int fullWidth = 0, fullHeight = 0; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } DrawParams *dpPtr = &mbPtr->drawParams; pixmap = (Pixmap) Tk_WindowId(tkwin); if (butPtr->image != NULL) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; } else if (butPtr->bitmap != None) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0); if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) { int x = 0, y = 0; textXOffset = 0; textYOffset = 0; fullWidth = 0; |
︙ | ︙ | |||
685 686 687 688 689 690 691 | */ static void MenuButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { | | | | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | */ static void MenuButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkMenuButton *buttonPtr = (TkMenuButton *)clientData; MacMenuButton *mbPtr = (MacMenuButton *)clientData; if (eventPtr->type == ActivateNotify || eventPtr->type == DeactivateNotify) { if ((buttonPtr->tkwin == NULL) || (!Tk_IsMapped(buttonPtr->tkwin))) { return; } if (eventPtr->type == ActivateNotify) { |
︙ | ︙ |
Changes to macosx/tkMacOSXMenus.c.
1 2 3 4 5 | /* * tkMacOSXMenus.c -- * * These calls set up the default menus for Tk. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXMenus.c -- * * These calls set up the default menus for Tk. * * Copyright © 1995-1996 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMenu.h" |
︙ | ︙ | |||
199 200 201 202 203 204 205 | - (void) orderFrontStandardAboutPanel: (id) sender { (void)sender; if (!_eventInterp || !Tcl_FindCommand(_eventInterp, "tkAboutDialog", NULL, 0) || (GetCurrentEventKeyModifiers() & optionKey)) { | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | - (void) orderFrontStandardAboutPanel: (id) sender { (void)sender; if (!_eventInterp || !Tcl_FindCommand(_eventInterp, "tkAboutDialog", NULL, 0) || (GetCurrentEventKeyModifiers() & optionKey)) { [super orderFrontStandardAboutPanel:nil]; } else { int code = Tcl_EvalEx(_eventInterp, "tkAboutDialog", -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(_eventInterp, code); } |
︙ | ︙ | |||
387 388 389 390 391 392 393 | *---------------------------------------------------------------------- */ static void GenerateEditEvent( const char *name) { | | | | | | | | | | | | | | | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | *---------------------------------------------------------------------- */ static void GenerateEditEvent( const char *name) { union {XEvent general; XVirtualEvent virt;} event; int x, y; TkWindow *winPtr = TkMacOSXGetTkWindow([NSApp keyWindow]); Tk_Window tkwin; if (!winPtr) { return; } tkwin = (Tk_Window)winPtr->dispPtr->focusPtr; if (!tkwin) { return; } bzero(&event, sizeof(event)); event.virt.type = VirtualEvent; event.virt.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); event.virt.send_event = false; event.virt.display = Tk_Display(tkwin); event.virt.event = Tk_WindowId(tkwin); event.virt.root = XRootWindow(Tk_Display(tkwin), 0); event.virt.subwindow = None; event.virt.time = TkpGetMS(); XQueryPointer(NULL, winPtr->window, NULL, NULL, &event.virt.x_root, &event.virt.y_root, &x, &y, &event.virt.state); Tk_TopCoordsToWindow(tkwin, x, y, &event.virt.x, &event.virt.y); event.virt.same_screen = true; event.virt.name = Tk_GetUid(name); Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } #pragma mark - #pragma mark NSMenu & NSMenuItem Utilities @implementation NSMenu(TKUtils) |
︙ | ︙ |
Changes to macosx/tkMacOSXMouseEvent.c.
1 2 3 4 5 6 | /* * tkMacOSXMouseEvent.c -- * * This file implements functions that decode & handle mouse events on * MacOS X. * | | | > > > > > > > < < | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | > > > > | > > | | | > > | | | | > | | < > > | < | > | < | > > | > > > > > > > > > > > > > > > > | < | > > | > > | | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < | | | | < < < < < < | < < > | < > > < < < < < < < < < < < < < | < < < < | < < | < < < < < < < < | < | < | > > | | | > | > | | > > | | > | | | | > > > > > > > > > > > > > > > > | > > > > < | | > > > > > > > > | > > > > | > > > > > > > > | | | > | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | /* * tkMacOSXMouseEvent.c -- * * This file implements functions that decode & handle mouse events on * MacOS X. * * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXWm.h" #include "tkMacOSXInt.h" #include "tkMacOSXDebug.h" #include "tkMacOSXConstants.h" typedef struct { unsigned int state; long delta; Window window; Point global; Point local; } MouseEventData; typedef struct { uint64_t wheelTickPrev; /* For high resolution wheels. */ double vWheelAcc; /* For high resolution wheels (vertical). */ double hWheelAcc; /* For high resolution wheels (horizontal). */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; static Tk_Window captureWinPtr = NULL; /* Current capture window; may be * NULL. */ static int GenerateButtonEvent(MouseEventData *medPtr); #pragma mark TKApplication(TKMouseEvent) enum { NSWindowWillMoveEventType = 20 }; /* * In OS X 10.6 an NSEvent of type NSMouseMoved would always have a non-Nil * window attribute pointing to the key window. As of 10.8 this behavior had * changed. The new behavior was that if the mouse were ever moved outside of * a window, all subsequent NSMouseMoved NSEvents would have a Nil window * attribute until the mouse returned to the window. In 11.1 it changed again. * The window attribute can be non-nil, but referencing a window which does not * belong to the application. */ /* The basic job of tkProcessMouseEvent is to generate a call to * Tk_UpdatePointer. That function receives a Tk_Window which (ignoring cases * when a grab is in effect) should be the highest window within the focused * toplevel that contains the pointer, as well as the pointer location in * screen coordinates and the current button state. Tk maintains a cache of * these three values. A change in any of these values causes Tk_UpdatePointer * to generate, respectively, Enter/Leave events, or Motion events, or * button Press/Release events. The Tk_Window value is allowed to be NULL, * which indicates that the pointer is not in the focused toplevel. * * Enter or Leave events for toplevel windows are generated when the Tk_Window * value changes to or from NULL. This is problematic on macOS due to the fact * that Tk_UpdatePointer does not generate Motion events when the Tk_Window * value is NULL. A consequence of this is that Tk_UpdatePointer will either * fail to generate correct Enter/Leave events for toplevels or else be unable * to generate Motion events when the pointer is outside of the focus window. * It is important to be able to generate such events because otherwise a * scrollbar on the edge of a toplevel becomes unusable. Any time that the * pointer wanders out of the window during a scroll, the scroll will stop. * That is an extremely annoying and unexpected behavior. Much of the code in * this module, including the trickiest parts, is devoted to working around * this problem. The other tricky parts are related to transcribing Apple's * NSMouseEntered, NSMouseExited, and NSLeftMouseDragged events into a form * that makes sense to Tk. */ @implementation TKApplication(TKMouseEvent) - (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent { NSWindow *eventWindow = [theEvent window]; NSEventType eventType = [theEvent type]; TKContentView *contentView = [eventWindow contentView]; NSPoint location = [theEvent locationInWindow]; NSPoint viewLocation = [contentView convertPoint:location fromView:nil]; TkWindow *winPtr = NULL, *grabWinPtr, *scrollTarget = NULL; Tk_Window tkwin = NULL, capture, target; NSPoint local, global; NSInteger button; TkWindow *newFocus = NULL; int win_x, win_y; unsigned int buttonState = 0; Bool isTestingEvent = NO; Bool isMotionEvent = NO; Bool isOutside = NO; Bool firstDrag = NO; static Bool ignoreDrags = NO; static Bool ignoreUpDown = NO; static NSTimeInterval timestamp = 0; #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif /* * If this event is not for a Tk toplevel, it should normally just be * passed up the responder chain. However, there is are two exceptions. * One is for synthesized events, which are used in testing. Those events * are recognized by having their timestamp set to 0. The other is for * motion events sent by the local event monitor, which will have their * window attribute set to nil. */ if (![eventWindow isMemberOfClass:[TKWindow class]]) { if ([theEvent timestamp] == 0) { isTestingEvent = YES; eventWindow = [NSApp keyWindow]; } if (eventType == NSLeftMouseDragged || eventType == NSMouseMoved) { eventWindow = [NSApp keyWindow]; isMotionEvent = YES; } if (!isTestingEvent && !isMotionEvent) { return theEvent; } } else if (!NSPointInRect(viewLocation, [contentView bounds])) { isOutside = YES; } button = [theEvent buttonNumber] + Button1; if ((button & -2) == Button2) { button ^= 1; /* Swap buttons 2/3 */ } switch (eventType) { case NSRightMouseUp: case NSOtherMouseUp: buttonState &= ~Tk_GetButtonMask(button); break; case NSLeftMouseDragged: buttonState |= Tk_GetButtonMask(button); if (![NSApp tkDragTarget]) { if (isOutside) { ignoreDrags = YES; } else { firstDrag = YES; } } if (ignoreDrags) { return theEvent; } if (![NSApp tkDragTarget]) { [NSApp setTkDragTarget: [NSApp tkEventTarget]]; } break; case NSRightMouseDragged: case NSOtherMouseDragged: isMotionEvent = YES; case NSRightMouseDown: case NSOtherMouseDown: buttonState |= Tk_GetButtonMask(button); break; case NSMouseEntered: if (![eventWindow isKeyWindow] || isOutside) { return theEvent; } [NSApp setTkLiveResizeEnded:NO]; [NSApp setTkPointerWindow:[NSApp tkEventTarget]]; break; case NSMouseExited: if (![eventWindow isKeyWindow] || !isOutside) { return theEvent; } [NSApp setTkPointerWindow:nil]; break; case NSLeftMouseUp: [NSApp setTkDragTarget: nil]; if ([theEvent clickCount] == 2) { ignoreUpDown = NO; } if (ignoreUpDown) { return theEvent; } if (ignoreDrags) { ignoreDrags = NO; return theEvent; } buttonState &= ~Tk_GetButtonMask(Button1); break; case NSLeftMouseDown: /* * There are situations where Apple does not send NSLeftMouseUp events * even though the mouse button has been released. One of these is * whenever a menu is posted on the screen. This causes Tk to have an * inaccurate idea of the current button state and to behave strangely. * (See ticket[a132b5507e].) As a work-around we watch for NSButtonDown * events that arrive when Tk thinks the button is already down and * we attempt to correct Tk's cached button state by insering a call to * Tk_UpdatePointer showing the button as up. */ if ([NSApp tkButtonState] & Tk_GetButtonMask(Button1)) { int fakeState = [NSApp tkButtonState] & ~Tk_GetButtonMask(Button1); int x = location.x; int y = floor(TkMacOSXZeroScreenHeight() - location.y); Tk_UpdatePointer((Tk_Window) [NSApp tkEventTarget], x, y, fakeState); } /* * Ignore left mouse button events which are in an NSWindow but outside * of its contentView (see tickets [d72abe6b54] and [39cbacb9e8]). * Ignore the first left button press after a live resize ends. (Apple * sends the button press event that started the resize after the * resize ends. It should not be seen by Tk. See tickets [d72abe6b54] * and [39cbacb9e8]). Ignore button press events when ignoreUpDown is * set. These are extraneous events which appear when double-clicking * in a window without focus, causing duplicate Double-1 events (see * ticket [7bda9882cb]). When a LeftMouseDown event with clickCount 2 * is received we set the ignoreUpDown flag and we clear it when the * matching LeftMouseUp with click count 2 is received. */ /* * Make sure we don't ignore LeftMouseUp and LeftMouseDown forever. * Currently tkBind.c sets NEARBY_MS to 500 (the Windows default). */ if ([theEvent timestamp] - timestamp > 1) { ignoreUpDown = NO; } if ([theEvent clickCount] == 2) { if (ignoreUpDown == YES) { return theEvent; } else { timestamp = [theEvent timestamp]; ignoreUpDown = YES; } } if (!isTestingEvent) { NSRect bounds = [contentView bounds]; NSRect grip = NSMakeRect(bounds.size.width - 10, 0, 10, 10); bounds = NSInsetRect(bounds, 2.0, 2.0); if (!NSPointInRect(viewLocation, bounds)) { return theEvent; } if (NSPointInRect(viewLocation, grip)) { return theEvent; } if ([NSApp tkLiveResizeEnded]) { [NSApp setTkLiveResizeEnded:NO]; return theEvent; } } /* * If this click will change the focus, the Tk event should * be sent to the toplevel which will be receiving focus rather than to * the current focus window. So reset tkEventTarget. */ if (eventWindow != [NSApp keyWindow]) { NSWindow *w; if (eventWindow && isOutside) { return theEvent; } for (w in [NSApp orderedWindows]) { if (NSPointInRect([NSEvent mouseLocation], [w frame])) { newFocus = TkMacOSXGetTkWindow(w); break; } } if (newFocus) { [NSApp setTkEventTarget: newFocus]; [NSApp setTkPointerWindow: newFocus]; target = (Tk_Window) newFocus; } } buttonState |= Tk_GetButtonMask(Button1); break; case NSMouseMoved: if (eventWindow && eventWindow != [NSApp keyWindow]) { return theEvent; } isMotionEvent = YES; break; case NSScrollWheel: /* * Scroll wheel events are sent to the window containing the pointer, * or ignored if no window contains the pointer. See TIP #171. Note, * however, that TIP #171 proposed sending scroll wheel events to the * focus window when no window contains the pointer. That proposal was * ultimately rejected. */ scrollTarget = TkMacOSXGetTkWindow(eventWindow); #if 0 case NSCursorUpdate: case NSTabletPoint: case NSTabletProximity: #endif break; default: /* This type of event is ignored. */ return theEvent; } /* * Find the toplevel window for the event. */ if ([NSApp tkDragTarget]) { TkWindow *dragPtr = (TkWindow *) [NSApp tkDragTarget]; TKWindow *dragWindow = nil; if (dragPtr) { dragWindow = (TKWindow *)TkMacOSXGetNSWindowForDrawable( dragPtr->window); } if (!dragWindow) { [NSApp setTkDragTarget: nil]; target = NULL; return theEvent; } winPtr = TkMacOSXGetHostToplevel((TkWindow *) [NSApp tkDragTarget])->winPtr; } else if (eventType == NSScrollWheel) { winPtr = scrollTarget; } else { winPtr = [NSApp tkEventTarget]; } if (!winPtr) { /* * If we couldn't find a toplevel for this event we have to ignore it. * (But this should never happen.) */ #ifdef TK_MAC_DEBUG_EVENTS TkMacOSXDbgMsg("Event received with no Tk window."); #endif return theEvent; } tkwin = (Tk_Window) winPtr; /* * Compute the mouse position in local (toplevel) and global (screen) * coordinates. These are Tk coordinates, meaning that the local origin is * at the top left corner of the containing toplevel and the global origin * is at top left corner of the primary screen. */ global = [NSEvent mouseLocation]; local = [eventWindow tkConvertPointFromScreen: global]; global.x = floor(global.x); global.y = floor(TkMacOSXZeroScreenHeight() - global.y); local.x = floor(local.x); local.y = floor(eventWindow.frame.size.height - local.y); if (Tk_IsEmbedded(winPtr)) { TkWindow *contPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (Tk_IsTopLevel(contPtr)) { local.x -= contPtr->wmInfoPtr->xInParent; local.y -= contPtr->wmInfoPtr->yInParent; } else { TkWindow *topPtr = TkMacOSXGetHostToplevel(winPtr)->winPtr; local.x -= (topPtr->wmInfoPtr->xInParent + contPtr->changes.x); local.y -= (topPtr->wmInfoPtr->yInParent + contPtr->changes.y); } } else { if (winPtr && winPtr->wmInfoPtr) { local.x -= winPtr->wmInfoPtr->xInParent; local.y -= winPtr->wmInfoPtr->yInParent; } else { return theEvent; } } /* * Use the toplevel coordinates to decide which Tk window should receive * this event. Also convert the toplevel coordinates into the coordinate * system of that window. These converted coordinates are needed for * XEvents that we generate, namely ScrollWheel events and Motion events * when the mouse is outside of the focused toplevel. */ if ([NSApp tkDragTarget]) { Tk_Window dragTarget = (Tk_Window) [NSApp tkDragTarget]; Tk_Window dragWidget = NULL; int x, y; Tk_GetRootCoords(dragTarget, &x, &y); win_x = global.x - x; win_y = global.y - y; if (firstDrag) { dragWidget = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &x, &y); if (dragWidget) { [NSApp setTkDragTarget: (TkWindow *) dragWidget]; } } target = (Tk_Window) [NSApp tkDragTarget]; } else { target = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y); } grabWinPtr = winPtr->dispPtr->grabWinPtr; /* * Ignore the event if a local grab is in effect and the Tk window is * not in the grabber's subtree. */ if (grabWinPtr && /* There is a grab in effect ... */ !winPtr->dispPtr->grabFlags && /* and it is a local grab ... */ grabWinPtr->mainPtr == winPtr->mainPtr){ /* in the same application. */ Tk_Window w; if (!target) { return theEvent; } for (w = target; !Tk_IsTopLevel(w); w = Tk_Parent(w)) { if (w == (Tk_Window)grabWinPtr) { break; } } if (w != (Tk_Window)grabWinPtr) { return theEvent; } } /* * Ignore the event if a global grab is in effect and the Tk window is * not in the grabber's subtree. */ if (grabWinPtr && /* There is a grab in effect ... */ winPtr->dispPtr->grabFlags && /* and it is a global grab ... */ grabWinPtr->mainPtr == winPtr->mainPtr) { /* in the same application. */ Tk_Window w; if (!target) { return theEvent; } for (w = target; !Tk_IsTopLevel(w); w = Tk_Parent(w)) { if (w == (Tk_Window)grabWinPtr) { break; } } if (w != (Tk_Window)grabWinPtr) { /* Force the focus back to the grab window. */ TkpChangeFocus(grabWinPtr, 1); } } /* * Translate the current button state into Tk's format. */ unsigned int state = buttonState; NSUInteger modifiers = [theEvent modifierFlags]; if (modifiers & NSAlphaShiftKeyMask) { state |= LockMask; } if (modifiers & NSShiftKeyMask) { state |= ShiftMask; } if (modifiers & NSControlKeyMask) { |
︙ | ︙ | |||
287 288 289 290 291 292 293 294 295 296 | } if (modifiers & NSNumericPadKeyMask) { state |= Mod3Mask; } if (modifiers & NSFunctionKeyMask) { state |= Mod4Mask; } if (eventType != NSScrollWheel) { | > > > > > > > > | > | < < > > | < > > > > > > > | | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > | > | | < < < > > > > > > > > > | > > > > > > | | > | | | > | > > > > > > | | > | | > > > > > > > > > > > > > > > > > > > > > | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | } if (modifiers & NSNumericPadKeyMask) { state |= Mod3Mask; } if (modifiers & NSFunctionKeyMask) { state |= Mod4Mask; } [NSApp setTkButtonState:state]; /* * Send XEvents. We do this here for Motion events outside of the focused * toplevel and for MouseWheel events. In other cases the XEvents will be * sent when we call Tk_UpdatePointer. */ if (eventType != NSScrollWheel) { if ([NSApp tkDragTarget]) { /* * When dragging the mouse into the resize area Apple shows the * left button to be up, which confuses Tk_UpdatePointer. So * we make sure that the button state appears the way that Tk * expects. */ state |= Tk_GetButtonMask(Button1); } if (eventType == NSMouseEntered) { Tk_UpdatePointer((Tk_Window) [NSApp tkPointerWindow], global.x, global.y, state); } else if (eventType == NSMouseExited) { if ([NSApp tkDragTarget]) { Tk_UpdatePointer((Tk_Window) [NSApp tkDragTarget], global.x, global.y, state); } else { Tk_UpdatePointer(NULL, global.x, global.y, state); } } else if (eventType == NSMouseMoved || eventType == NSLeftMouseDragged) { if ([NSApp tkPointerWindow]) { Tk_UpdatePointer(target, global.x, global.y, state); } else { XEvent xEvent = {0}; xEvent.type = MotionNotify; xEvent.xany.send_event = false; xEvent.xany.display = Tk_Display(target); xEvent.xany.window = Tk_WindowId(target); xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); xEvent.xmotion.x = win_x; xEvent.xmotion.y = win_y; xEvent.xmotion.x_root = global.x; xEvent.xmotion.y_root = global.y; xEvent.xmotion.state = state; Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); /* * Tk_UpdatePointer must not be called in this case. Doing so * will break scrollbars; dragging will stop when the mouse * leaves the window. */ } } else { Tk_UpdatePointer(target, global.x, global.y, state); } } else { CGFloat delta; XEvent xEvent = {0}; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); xEvent.type = MouseWheelEvent; xEvent.xbutton.x = win_x; xEvent.xbutton.y = win_y; xEvent.xbutton.x_root = global.x; xEvent.xbutton.y_root = global.y; xEvent.xany.send_event = false; xEvent.xany.display = Tk_Display(target); xEvent.xany.window = Tk_WindowId(target); #define WHEEL_DELTA 120 #define WHEEL_DELAY 300000000 uint64_t wheelTick = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW); Bool timeout = (wheelTick - tsdPtr->wheelTickPrev) >= WHEEL_DELAY; if (timeout) { tsdPtr->vWheelAcc = tsdPtr->hWheelAcc = 0; } tsdPtr->wheelTickPrev = wheelTick; delta = [theEvent deltaY]; if (delta != 0.0) { delta = (tsdPtr->vWheelAcc += delta); if (timeout && fabs(delta) < 1.0) { delta = ((delta < 0.0) ? -1.0 : 1.0); } if (fabs(delta) >= 0.6) { int intDelta = round(delta); xEvent.xbutton.state = state; xEvent.xkey.keycode = WHEEL_DELTA * intDelta; tsdPtr->vWheelAcc -= intDelta; xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } } delta = [theEvent deltaX]; if (delta != 0.0) { delta = (tsdPtr->hWheelAcc += delta); if (timeout && fabs(delta) < 1.0) { delta = ((delta < 0.0) ? -1.0 : 1.0); } if (fabs(delta) >= 0.6) { int intDelta = round(delta); xEvent.xbutton.state = state | ShiftMask; xEvent.xkey.keycode = WHEEL_DELTA * intDelta; tsdPtr->hWheelAcc -= intDelta; xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } } } /* * If button events are being captured, and the target is not in the * subtree below the capturing window, then the NSEvent should not be sent * up the responder chain. This avoids, for example, beeps when clicking * the mouse button outside of a posted combobox. See ticket [eb26d4ec8e]. */ capture = TkpGetCapture(); if (capture && eventType == NSLeftMouseDown) { Tk_Window w; for (w = target; w != NULL; w = Tk_Parent(w)) { if (w == capture) { break; } } if (w != capture) { return nil; } } return theEvent; } @end #pragma mark - |
︙ | ︙ | |||
360 361 362 363 364 365 366 | * *---------------------------------------------------------------------- */ unsigned int TkMacOSXButtonKeyState(void) { | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | * *---------------------------------------------------------------------- */ unsigned int TkMacOSXButtonKeyState(void) { return [NSApp tkButtonState]; } /* *---------------------------------------------------------------------- * * XQueryPointer -- * |
︙ | ︙ | |||
456 457 458 459 460 461 462 | * None. * *---------------------------------------------------------------------- */ Bool XQueryPointer( | | | | < < < | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | * None. * *---------------------------------------------------------------------- */ Bool XQueryPointer( TCL_UNUSED(Display *), Window w, TCL_UNUSED(Window *), TCL_UNUSED(Window *), int *root_x_return, int *root_y_return, int *win_x_return, int *win_y_return, unsigned int *mask_return) { int getGlobal = (root_x_return && root_y_return); int getLocal = (win_x_return && win_y_return && w != None); if (getGlobal || getLocal) { NSPoint global = [NSEvent mouseLocation]; if (getLocal) { MacDrawable *macWin = (MacDrawable *)w; NSWindow *win = TkMacOSXGetNSWindowForDrawable(w); |
︙ | ︙ | |||
643 644 645 646 647 648 649 | dispPtr = TkGetDisplayList(); tkwin = Tk_IdToWindow(dispPtr->display, medPtr->window); if (tkwin != NULL) { tkwin = Tk_TopCoordsToWindow(tkwin, medPtr->local.h, medPtr->local.v, &dummy, &dummy); } | < | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | dispPtr = TkGetDisplayList(); tkwin = Tk_IdToWindow(dispPtr->display, medPtr->window); if (tkwin != NULL) { tkwin = Tk_TopCoordsToWindow(tkwin, medPtr->local.h, medPtr->local.v, &dummy, &dummy); } Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v, medPtr->state); return true; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
682 683 684 685 686 687 688 689 690 691 692 693 694 695 | pt.y = y + dispPtr->warpY; } else { pt.x = dispPtr->warpX; pt.y = dispPtr->warpY; } CGWarpMouseCursorPosition(pt); } /* *---------------------------------------------------------------------- * * TkpSetCapture -- * | > > > > > > | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | pt.y = y + dispPtr->warpY; } else { pt.x = dispPtr->warpX; pt.y = dispPtr->warpY; } CGWarpMouseCursorPosition(pt); if (dispPtr->warpWindow) { TkGenerateButtonEventForXPointer(Tk_WindowId(dispPtr->warpWindow)); } else { TkGenerateButtonEventForXPointer(None); } } /* *---------------------------------------------------------------------- * * TkpSetCapture -- * |
︙ | ︙ |
Changes to macosx/tkMacOSXNotify.c.
1 2 3 4 5 6 | /* * tkMacOSXNotify.c -- * * This file contains the implementation of a tcl event source * for the AppKit event loop. * | | | | | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | /* * tkMacOSXNotify.c -- * * This file contains the implementation of a tcl event source * for the AppKit event loop. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009, Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 2015 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXInt.h" #include "tkMacOSXConstants.h" #if TCL_MAJOR_VERSION < 9 #undef Tcl_MacOSXNotifierAddRunLoopMode #ifdef USE_TCL_STUBS #ifdef __cplusplus extern "C" { #endif /* Little hack to eliminate the need for "tclInt.h" here: Just copy a small portion of TclIntPlatStubs, just enough to make it work. See [600b72bfbc] */ typedef struct TclIntPlatStubs { int magic; void *hooks; void (*dummy[19]) (void); /* dummy entries 0-18, not used */ void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */ } TclIntPlatStubs; extern const TclIntPlatStubs *tclIntPlatStubsPtr; #ifdef __cplusplus } #endif #define Tcl_MacOSXNotifierAddRunLoopMode \ (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ #elif TCL_MINOR_VERSION < 7 extern void TclMacOSXNotifierAddRunLoopMode(const void *runLoopMode); # define Tcl_MacOSXNotifierAddRunLoopMode TclMacOSXNotifierAddRunLoopMode #else extern void Tcl_MacOSXNotifierAddRunLoopMode(const void *runLoopMode); #endif #endif #import <objc/objc-auto.h> /* This is not used for anything at the moment. */ typedef struct ThreadSpecificData { int initialized; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; #define TSD_INIT() ThreadSpecificData *tsdPtr = (ThreadSpecificData *) \ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)) static void TkMacOSXNotifyExitHandler(ClientData clientData); static void TkMacOSXEventsSetupProc(ClientData clientData, int flags); static void TkMacOSXEventsCheckProc(ClientData clientData, int flags); #ifdef TK_MAC_DEBUG_EVENTS |
︙ | ︙ | |||
265 266 267 268 269 270 271 | Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s", "first [load] of TkAqua has to occur in the main thread!"); } Tcl_CreateEventSource(TkMacOSXEventsSetupProc, TkMacOSXEventsCheckProc, NULL); TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL); | | | | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s", "first [load] of TkAqua has to occur in the main thread!"); } Tcl_CreateEventSource(TkMacOSXEventsSetupProc, TkMacOSXEventsCheckProc, NULL); TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL); Tcl_MacOSXNotifierAddRunLoopMode(NSEventTrackingRunLoopMode); Tcl_MacOSXNotifierAddRunLoopMode(NSModalPanelRunLoopMode); } } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
312 313 314 315 316 317 318 | * This static function is meant to be run as an idle task. It attempts * to redraw all views which have the tkNeedsDisplay property set to YES. * This relies on a feature of [NSApp nextEventMatchingMask: ...] which * is undocumented, namely that it sometimes blocks and calls drawRect * for all views that need display before it returns. We call it with * deQueue=NO so that it will not change anything on the AppKit event * queue, because we only want the side effect that it runs drawRect. The | | | > | > | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | * This static function is meant to be run as an idle task. It attempts * to redraw all views which have the tkNeedsDisplay property set to YES. * This relies on a feature of [NSApp nextEventMatchingMask: ...] which * is undocumented, namely that it sometimes blocks and calls drawRect * for all views that need display before it returns. We call it with * deQueue=NO so that it will not change anything on the AppKit event * queue, because we only want the side effect that it runs drawRect. The * only times when any NSViews have the needsDisplay property set to YES * are during execution of this function or in the addTkDirtyRect method * of TKContentView. * * The reason for running this function as an idle task is to try to * arrange that all widgets will be fully configured before they are * drawn. Any idle tasks that might reconfigure them should be higher on * the idle queue, so they should be run before the display procs are run * by drawRect. * * If this function is called directly with non-NULL clientData parameter * then the int which it references will be set to the number of windows * that need display, but the needsDisplay property of those windows will * not be changed. * * Results: * None. * * Side effects: * Parts of windows may get redrawn. * *---------------------------------------------------------------------- */ void TkMacOSXDrawAllViews( ClientData clientData) { int count = 0, *dirtyCount = (int *)clientData; for (NSWindow *window in [NSApp windows]) { if ([[window contentView] isMemberOfClass:[TKContentView class]]) { TKContentView *view = [window contentView]; if ([view tkNeedsDisplay]) { count++; if (dirtyCount) { continue; } [[view layer] setNeedsDisplayInRect:[view tkDirtyRect]]; [view setNeedsDisplay:YES]; } } else { [window displayIfNeeded]; } } if (dirtyCount) { *dirtyCount = count; |
︙ | ︙ | |||
408 409 410 411 412 413 414 | */ #define TICK 200 static Tcl_TimerToken ticker = NULL; static void Heartbeat( | | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | */ #define TICK 200 static Tcl_TimerToken ticker = NULL; static void Heartbeat( TCL_UNUSED(void *)) { if (ticker) { ticker = Tcl_CreateTimerHandler(TICK, Heartbeat, NULL); } } |
︙ | ︙ | |||
441 442 443 444 445 446 447 | /* * After calling this setup proc, Tcl_DoOneEvent will call * Tcl_WaitForEvent. Then it will call check proc to collect the * events and translate them into XEvents. * * If we have any events waiting or if there is any drawing to be done * we want Tcl_WaitForEvent to return immediately. So we set the block | | | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | /* * After calling this setup proc, Tcl_DoOneEvent will call * Tcl_WaitForEvent. Then it will call check proc to collect the * events and translate them into XEvents. * * If we have any events waiting or if there is any drawing to be done * we want Tcl_WaitForEvent to return immediately. So we set the block * time to 0 and stop the heartbeat. */ NSEvent *currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(TkMacOSXGetModalSession()) dequeue:NO]; |
︙ | ︙ | |||
487 488 489 490 491 492 493 | * NSevents are used to generate X events, which are added to the Tcl * event queue. * *---------------------------------------------------------------------- */ static void TkMacOSXEventsCheckProc( | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | * NSevents are used to generate X events, which are added to the Tcl * event queue. * *---------------------------------------------------------------------- */ static void TkMacOSXEventsCheckProc( TCL_UNUSED(void *), int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; int eventsFound = 0; /* * runloopMode will be nil if we are in a Tcl event loop. |
︙ | ︙ |
Changes to macosx/tkMacOSXPort.h.
︙ | ︙ | |||
31 32 33 34 35 36 37 | #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <sys/stat.h> #ifndef _TCL # include <tcl.h> #endif | < < < < | | | < < | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <sys/stat.h> #ifndef _TCL # include <tcl.h> #endif #ifdef HAVE_SYS_TIME_H # include <sys/time.h> #endif #include <time.h> #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #include <unistd.h> #if defined(__GNUC__) && !defined(__cplusplus) # pragma GCC diagnostic ignored "-Wc++-compat" #endif #include <X11/Xlib.h> |
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | # if defined(_IBMR2) # define SELECT_MASK void # else # define SELECT_MASK int # endif #endif /* * The following macro defines the number of fd_masks in an fd_set: */ #ifndef FD_SETSIZE # ifdef OPEN_MAX # define FD_SETSIZE OPEN_MAX | > > > > > > > > > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | # if defined(_IBMR2) # define SELECT_MASK void # else # define SELECT_MASK int # endif #endif /* * Used to tag functions that are only to be visible within the module being * built and not outside it (where this is supported by the linker). */ #ifndef MODULE_SCOPE # ifdef __cplusplus # define MODULE_SCOPE extern "C" # else # define MODULE_SCOPE extern # endif #endif /* * The following macro defines the number of fd_masks in an fd_set: */ #ifndef FD_SETSIZE # ifdef OPEN_MAX # define FD_SETSIZE OPEN_MAX |
︙ | ︙ | |||
131 132 133 134 135 136 137 | */ #define TK_NO_DOUBLE_BUFFERING 1 #define TK_HAS_DYNAMIC_COLORS 1 #define TK_DYNAMIC_COLORMAP 0x0fffffff /* | | | | > > > > > > > > > > > < < < < < < < < | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | */ #define TK_NO_DOUBLE_BUFFERING 1 #define TK_HAS_DYNAMIC_COLORS 1 #define TK_DYNAMIC_COLORMAP 0x0fffffff /* * Inform tkImgPhInstance.c that we implement TkpPutRGBAImage to render RGBA * images directly into a window. */ #define TK_CAN_RENDER_RGBA MODULE_SCOPE int TkpPutRGBAImage( Display* display, Drawable drawable, GC gc,XImage* image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* * Inform tkCanvas.c that our XGetImage returns a 32pp pixmap packed as 0xAABBGGRR */ #define TK_XGETIMAGE_USES_ABGR32 /* * Used by xcolor.c */ MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long green, unsigned long blue); #define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8)) /* * Used by tkAppInit */ #define USE_CUSTOM_EXIT_PROC EXTERN int TkpWantsExitProc(void); EXTERN TCL_NORETURN void TkpExitProc(void *); #endif /* _TKMACPORT */ |
Added macosx/tkMacOSXPrint.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | /* * tkMacOSXPrint.c -- * * This module implements native printing dialogs for macOS. * * Copyright © 2006 Apple Inc. * Copyright © 2011-2021 Kevin Walzer/WordTech Communications LLC. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <tcl.h> #include <tk.h> #include <tkInt.h> #include <Cocoa/Cocoa.h> #include <CoreFoundation/CoreFoundation.h> #include <CoreServices/CoreServices.h> #include <ApplicationServices/ApplicationServices.h> #include <tkMacOSXInt.h> #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> /* Forward declarations of functions and variables. */ NSString * fileName = nil; CFStringRef urlFile = NULL; int StartPrint(ClientData clientData, Tcl_Interp * interp, int objc, Tcl_Obj * const objv[]); OSStatus FinishPrint(NSString *file, int buttonValue); int MacPrint_Init(Tcl_Interp * interp); /* Delegate class for print dialogs. */ @interface PrintDelegate: NSObject - (id) init; - (void) printPanelDidEnd: (NSPrintPanel *) printPanel returnCode: (int) returnCode contextInfo: (void *) contextInfo; @end @implementation PrintDelegate - (id) init { self = [super init]; return self; } - (void) printPanelDidEnd: (NSPrintPanel *) printPanel returnCode: (int) returnCode contextInfo: (void *) contextInfo { (void) printPanel; (void) contextInfo; /* * Pass returnCode to FinishPrint function to determine how to * handle. */ FinishPrint(fileName, returnCode); } @end /* *---------------------------------------------------------------------- * * StartPrint -- * * Launch native print dialog. * * Results: * Configures values and starts print process. * *---------------------------------------------------------------------- */ int StartPrint( ClientData clientData, Tcl_Interp * interp, int objc, Tcl_Obj *const objv[]) { (void) clientData; NSPrintInfo * printInfo = [NSPrintInfo sharedPrintInfo]; NSPrintPanel * printPanel = [NSPrintPanel printPanel]; int accepted; PMPrintSession printSession; PMPrintSettings printSettings; OSStatus status = noErr; /* Check for proper number of arguments. */ if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "file"); return TCL_ERROR; } fileName = [NSString stringWithUTF8String: Tcl_GetString(objv[1])]; urlFile = (CFStringRef) fileName; CFRetain(urlFile); /* Initialize the delegate for the callback from the page panel. */ PrintDelegate * printDelegate = [[PrintDelegate alloc] init]; status = PMCreateSession( & printSession); if (status != noErr) { NSLog(@ "Error creating print session."); return TCL_ERROR; } status = PMCreatePrintSettings( & printSettings); if (status != noErr) { NSLog(@ "Error creating print settings."); return TCL_ERROR; } status = PMSessionDefaultPrintSettings(printSession, printSettings); if (status != noErr) { NSLog(@ "Error creating default print settings."); return TCL_ERROR; } printSession = (PMPrintSession)[printInfo PMPrintSession]; (void)(PMPageFormat)[printInfo PMPageFormat]; printSettings = (PMPrintSettings)[printInfo PMPrintSettings]; accepted = [printPanel runModalWithPrintInfo: printInfo]; [printDelegate printPanelDidEnd: printPanel returnCode: accepted contextInfo: printInfo]; return TCL_OK; } /* *---------------------------------------------------------------------- * * FinishPrint -- * * Handles print process based on input from dialog. * * Results: * Completes print process. * *---------------------------------------------------------------------- */ OSStatus FinishPrint( NSString *file, int buttonValue) { NSPrintInfo * printInfo = [NSPrintInfo sharedPrintInfo]; PMPrintSession printSession; PMPageFormat pageFormat; PMPrintSettings printSettings; OSStatus status = noErr; CFStringRef mimeType = NULL; /* * If value passed here is NSCancelButton, return noErr; * otherwise printing will occur regardless of value. */ if (buttonValue == NSModalResponseCancel) { return noErr; } status = PMCreateSession( & printSession); if (status != noErr) { NSLog(@ "Error creating print session."); return status; } status = PMCreatePrintSettings( & printSettings); if (status != noErr) { NSLog(@ "Error creating print settings."); return status; } status = PMSessionDefaultPrintSettings(printSession, printSettings); if (status != noErr) { NSLog(@ "Error creating default print settings."); return status; } printSession = (PMPrintSession)[printInfo PMPrintSession]; pageFormat = (PMPageFormat)[printInfo PMPageFormat]; printSettings = (PMPrintSettings)[printInfo PMPrintSettings]; /*Handle print operation.*/ if (buttonValue == NSModalResponseOK) { if (urlFile == NULL) { NSLog(@ "Could not get file to print."); return noErr; } fileName = file; CFURLRef printURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, urlFile, kCFURLPOSIXPathStyle, false); PMPrinter currentPrinter; PMDestinationType printDestination; /*Get the intended destination.*/ status = PMSessionGetDestinationType(printSession, printSettings, & printDestination); /*Destination is printer. Send file to printer.*/ if (status == noErr && printDestination == kPMDestinationPrinter) { status = PMSessionGetCurrentPrinter(printSession, & currentPrinter); if (status == noErr) { CFArrayRef mimeTypes; status = PMPrinterGetMimeTypes(currentPrinter, printSettings, & mimeTypes); if (status == noErr && mimeTypes != NULL) { mimeType = CFSTR("application/pdf"); if (CFArrayContainsValue(mimeTypes, CFRangeMake(0, CFArrayGetCount(mimeTypes)), mimeType)) { status = PMPrinterPrintWithFile(currentPrinter, printSettings, pageFormat, mimeType, printURL); CFRelease(urlFile); return status; } } } } /* Destination is file. Determine how to handle. */ if (status == noErr && printDestination == kPMDestinationFile) { CFURLRef outputLocation = NULL; status = PMSessionCopyDestinationLocation(printSession, printSettings, & outputLocation); if (status == noErr) { /*Get the source file and target destination, convert to strings.*/ CFStringRef sourceFile = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle); CFStringRef savePath = CFURLCopyFileSystemPath(outputLocation, kCFURLPOSIXPathStyle); NSString * sourcePath = (NSString * ) sourceFile; NSString * finalPath = (NSString * ) savePath; NSString * pathExtension = [finalPath pathExtension]; NSFileManager * fileManager = [NSFileManager defaultManager]; NSError * error = nil; /* * Is the target file a PDF? If so, copy print file * to output location. */ if ([pathExtension isEqualToString: @ "pdf"]) { /*Make sure no file conflict exists.*/ if ([fileManager fileExistsAtPath: finalPath]) { [fileManager removeItemAtPath: finalPath error: &error]; } if ([fileManager fileExistsAtPath: sourcePath]) { error = nil; [fileManager copyItemAtPath: sourcePath toPath: finalPath error: & error]; } return status; } /* * Is the target file PostScript? If so, run print file * through CUPS filter to convert back to PostScript. */ if ([pathExtension isEqualToString: @ "ps"]) { char source[5012]; char target[5012]; [sourcePath getCString: source maxLength: (sizeof source) encoding: NSUTF8StringEncoding]; [finalPath getCString: target maxLength: (sizeof target) encoding: NSUTF8StringEncoding]; /*Make sure no file conflict exists.*/ if ([fileManager fileExistsAtPath: finalPath]) { [fileManager removeItemAtPath: finalPath error: &error]; } /* * Fork and start new process with command string. Thanks to Peter da Silva * for assistance. */ pid_t pid; if ((pid = fork()) == -1) { return -1; } else if (pid == 0) { /* Redirect output to file and silence debugging output.*/ dup2(open(target, O_RDWR | O_CREAT, 0777), 1); dup2(open("/dev/null", O_WRONLY), 2); execl("/usr/sbin/cupsfilter", "/usr/sbin/cupsfilter", "-m", "application/postscript", source, NULL); exit(0); } return status; } } } /* Destination is preview. Open file in default application for PDF. */ if ((status == noErr) && (printDestination == kPMDestinationPreview)) { CFStringRef urlpath = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle); NSString * path = (NSString * ) urlpath; NSURL * url = [NSURL fileURLWithPath: path]; NSWorkspace * ws = [NSWorkspace sharedWorkspace]; [ws openURL: url]; status = noErr; return status; } /* * If destination is not printer, file or preview, * we do not support it. Display alert. */ if (((status == noErr) && (printDestination != kPMDestinationPreview)) || ((status == noErr) && (printDestination != kPMDestinationFile)) || ((status == noErr) && (printDestination != kPMDestinationPrinter))) { NSAlert * alert = [[[NSAlert alloc] init] autorelease]; [alert addButtonWithTitle: @ "OK"]; [alert setMessageText: @ "Unsupported Printing Operation"]; [alert setInformativeText: @ "This printing operation is not supported."]; [alert setAlertStyle: NSAlertStyleInformational]; [alert runModal]; return status; } } /* Return because cancel button was clicked. */ if (buttonValue == NSModalResponseCancel) { PMRelease(printSession); return status; } return status; } /* *---------------------------------------------------------------------- * * MacPrint_Init-- * * Initializes the printing module. * * Results: * Printing module initialized. * *---------------------------------------------------------------------- */ int MacPrint_Init(Tcl_Interp * interp) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; Tcl_CreateObjCommand(interp, "::tk::print::_print", StartPrint, NULL, NULL); [pool release]; return TCL_OK; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXPrivate.h.
1 2 3 4 5 | /* * tkMacOSXPrivate.h -- * * Macros and declarations that are purely internal & private to TkAqua. * | | | | > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /* * tkMacOSXPrivate.h -- * * Macros and declarations that are purely internal & private to TkAqua. * * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 2008-2009 Apple Inc. * Copyright © 2020 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id$ */ #ifndef _TKMACPRIV #define _TKMACPRIV #if !__OBJC__ #error Objective-C compiler required #endif #ifndef __clang__ #define instancetype id #endif #define TextStyle MacTextStyle #define Cursor QDCursor #import <ApplicationServices/ApplicationServices.h> #undef Cursor #import <Cocoa/Cocoa.h> #import <QuartzCore/QuartzCore.h> #if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 #import <UniformTypeIdentifiers/UniformTypeIdentifiers.h> #endif #ifndef NO_CARBON_H #import <Carbon/Carbon.h> #endif #undef TextStyle #import <objc/runtime.h> /* for sel_isEqual() */ #ifndef _TKMACINT |
︙ | ︙ | |||
132 133 134 135 136 137 138 | * The structure of a 32-bit XEvent keycode on macOS. It may be viewed as * an unsigned int or as having either two or three bitfields. */ typedef struct keycode_v_t { unsigned keychar: 22; /* UCS-32 character */ unsigned o_s: 2; /* State of Option and Shift keys. */ | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | * The structure of a 32-bit XEvent keycode on macOS. It may be viewed as * an unsigned int or as having either two or three bitfields. */ typedef struct keycode_v_t { unsigned keychar: 22; /* UCS-32 character */ unsigned o_s: 2; /* State of Option and Shift keys. */ unsigned virt: 8; /* 8-bit virtual keycode - identifies a key. */ } keycode_v; typedef struct keycode_x_t { unsigned keychar: 22; /* UCS-32 character */ unsigned xvirtual: 10; /* Combines o_s and virtual. This 10-bit integer * is used as a key for looking up the character * produced when pressing a key with a particular |
︙ | ︙ | |||
154 155 156 157 158 159 160 | } MacKeycode; /* * Macros used in tkMacOSXKeyboard.c and tkMacOSXKeyEvent.c. * Note that 0x7f is del and 0xF8FF is the Apple Logo character. */ | | | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | } MacKeycode; /* * Macros used in tkMacOSXKeyboard.c and tkMacOSXKeyEvent.c. * Note that 0x7f is del and 0xF8FF is the Apple Logo character. */ #define ON_KEYPAD(virt) ((virt >= 0x41) && (virt <= 0x5C)) #define IS_PRINTABLE(keychar) ((keychar >= 0x20) && (keychar != 0x7f) && \ ((keychar < 0xF700) || keychar >= 0xF8FF)) /* * An "index" is 2-bit bitfield showing the state of the Option and Shift * keys. It is used as an index when building the keymaps and it * is the value of the o_s bitfield of a keycode_v. |
︙ | ︙ | |||
200 201 202 203 204 205 206 | * Structure encapsulating current drawing environment. */ typedef struct TkMacOSXDrawingContext { CGContextRef context; NSView *view; HIShapeRef clipRgn; | < < < < < < < | > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | * Structure encapsulating current drawing environment. */ typedef struct TkMacOSXDrawingContext { CGContextRef context; NSView *view; HIShapeRef clipRgn; } TkMacOSXDrawingContext; /* * Prototypes for TkMacOSXRegion.c. */ MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(Region r); MODULE_SCOPE void TkMacOSXSetWithNativeRegion(Region r, HIShapeRef rgn); MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void); MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect( const CGRect *inRect); MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithShape( HIMutableShapeRef inDestShape, HIShapeRef inSrcShape); MODULE_SCOPE OSStatus TkMacOSHIShapeDifferenceWithRect( HIMutableShapeRef inShape, const CGRect *inRect); MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape, const CGRect *inRect); MODULE_SCOPE OSStatus TkMacOSHIShapeUnion(HIShapeRef inShape1, HIShapeRef inShape2, HIMutableShapeRef outResult); MODULE_SCOPE int TkMacOSXCountRectsInRegion(HIShapeRef shape); MODULE_SCOPE void TkMacOSXPrintRectsInRegion(HIShapeRef shape); /* * Prototypes of TkAqua internal procs. */ MODULE_SCOPE void * TkMacOSXGetNamedSymbol(const char *module, const char *symbol); MODULE_SCOPE void TkMacOSXDisplayChanged(Display *display); |
︙ | ︙ | |||
254 255 256 257 258 259 260 | CGRect srcBounds, CGRect dstBounds); MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc, TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel, CGContextRef context); | | < | < < | < | | < > | > > > > > > | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | CGRect srcBounds, CGRect dstBounds); MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc, TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel, CGContextRef context); #define TkMacOSXGetTkWindow(window) ((TkWindow *)Tk_MacOSXGetTkWindow(window)) #define TkMacOSXGetNSWindowForDrawable(drawable) ((NSWindow *)Tk_MacOSXGetNSWindowForDrawable(drawable)) #define TkMacOSXGetNSViewForDrawable(macWin) ((NSView *)Tk_MacOSXGetNSViewForDrawable((Drawable)(macWin))) #define TkMacOSXGetCGContextForDrawable(drawable) ((CGContextRef)Tk_MacOSXGetCGContextForDrawable(drawable)) MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds); MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable); MODULE_SCOPE void TkMacOSXInvalidateViewRegion(NSView *view, HIShapeRef rgn); MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromTkImage(Display *display, Tk_Image image, int width, int height); MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromBitmap(Display *display, Pixmap bitmap, GC gc, int width, int height); MODULE_SCOPE NSColor* TkMacOSXGetNSColor(GC gc, unsigned long pixel); MODULE_SCOPE NSFont* TkMacOSXNSFontForFont(Tk_Font tkfont); MODULE_SCOPE NSDictionary* TkMacOSXNSFontAttributesForFont(Tk_Font tkfont); MODULE_SCOPE NSModalSession TkMacOSXGetModalSession(void); MODULE_SCOPE void TkMacOSXSelDeadWindow(TkWindow *winPtr); MODULE_SCOPE void TkMacOSXApplyWindowAttributes(TkWindow *winPtr, NSWindow *macWindow); MODULE_SCOPE Tcl_ObjCmdProc TkMacOSXStandardAboutPanelObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TkMacOSXIconBitmapObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TkMacOSXNSImageObjCmd; MODULE_SCOPE void TkMacOSXDrawSolidBorder(Tk_Window tkwin, GC gc, int inset, int thickness); MODULE_SCOPE int TkMacOSXServices_Init(Tcl_Interp *interp); MODULE_SCOPE Tcl_ObjCmdProc TkMacOSXRegisterServiceWidgetObjCmd; MODULE_SCOPE unsigned TkMacOSXAddVirtual(unsigned int keycode); MODULE_SCOPE int TkMacOSXNSImage_Init(Tcl_Interp *interp); MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view, NSRect *bounds); MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); MODULE_SCOPE void TkMacOSXDrawAllViews(void *clientData); MODULE_SCOPE NSColor* controlAccentColor(void); MODULE_SCOPE void Ttk_MacOSXInit(void); MODULE_SCOPE unsigned long TkMacOSXClearPixel(void); MODULE_SCOPE int MacSystrayInit(Tcl_Interp *); MODULE_SCOPE int MacPrint_Init(Tcl_Interp *); MODULE_SCOPE NSString* TkMacOSXOSTypeToUTI(OSType ostype); MODULE_SCOPE NSImage* TkMacOSXIconForFileType(NSString *filetype); #pragma mark Private Objective-C Classes #define VISIBILITY_HIDDEN __attribute__((visibility("hidden"))) enum { tkMainMenu = 1, tkApplicationMenu, tkWindowsMenu, tkHelpMenu}; |
︙ | ︙ | |||
322 323 324 325 326 327 328 | NSMenu *_servicesMenu; TKMenu *_defaultMainMenu, *_defaultApplicationMenu; NSMenuItem *_demoMenuItem; NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems, *_defaultFileMenuItems; NSAutoreleasePool *_mainPool; NSThread *_backgoundLoop; | < < < < < < < < < > > > > > > > > > > > | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | NSMenu *_servicesMenu; TKMenu *_defaultMainMenu, *_defaultApplicationMenu; NSMenuItem *_demoMenuItem; NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems, *_defaultFileMenuItems; NSAutoreleasePool *_mainPool; NSThread *_backgoundLoop; } @property int poolLock; @property int macOSVersion; @property Bool isDrawing; @property Bool needsToDraw; @property Bool isSigned; @property Bool tkLiveResizeEnded; /* * Persistent state variables used by processMouseEvent. */ @property(nonatomic) TkWindow *tkPointerWindow; @property(nonatomic) TkWindow *tkEventTarget; @property(nonatomic) TkWindow *tkDragTarget; @property unsigned int tkButtonState; @end @interface TKApplication(TKInit) - (NSString *)tkFrameworkImagePath:(NSString*)image; - (void)_resetAutoreleasePool; - (void)_lockAutoreleasePool; - (void)_unlockAutoreleasePool; |
︙ | ︙ | |||
410 411 412 413 414 415 416 417 418 419 420 421 422 423 | @interface TKContentView : NSView <NSTextInputClient> { @private NSString *privateWorkingText; Bool _tkNeedsDisplay; NSRect _tkDirtyRect; } @property Bool tkNeedsDisplay; @property NSRect tkDirtyRect; @end @interface TKContentView(TKKeyEvent) - (void) deleteWorkingText; | > | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | @interface TKContentView : NSView <NSTextInputClient> { @private NSString *privateWorkingText; Bool _tkNeedsDisplay; NSRect _tkDirtyRect; NSTrackingArea *trackingArea; } @property Bool tkNeedsDisplay; @property NSRect tkDirtyRect; @end @interface TKContentView(TKKeyEvent) - (void) deleteWorkingText; |
︙ | ︙ | |||
435 436 437 438 439 440 441 | - (NSPoint) tkConvertPointToScreen:(NSPoint)point; - (NSPoint) tkConvertPointFromScreen:(NSPoint)point; @end VISIBILITY_HIDDEN @interface TKWindow : NSWindow { | < < < < < < < < < < < < < < | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | - (NSPoint) tkConvertPointToScreen:(NSPoint)point; - (NSPoint) tkConvertPointFromScreen:(NSPoint)point; @end VISIBILITY_HIDDEN @interface TKWindow : NSWindow { } @property Window tkWindow; @end @interface TKWindow(TKWm) - (void) tkLayoutChanged; @end @interface TKDrawerWindow : NSWindow { id _i1, _i2; } @property Window tkWindow; @end @interface TKPanel : NSPanel { } @property Window tkWindow; @end #pragma mark NSMenu & NSMenuItem Utilities @interface NSMenu(TKUtils) |
︙ | ︙ | |||
555 556 557 558 559 560 561 562 563 564 565 566 567 568 | *--------------------------------------------------------------------------- */ @interface TKNSString:NSString { @private Tcl_DString _ds; NSString *_string; } @property const char *UTF8String; @property (readonly) Tcl_DString DString; - (instancetype)initWithTclUtfBytes:(const void *)bytes length:(NSUInteger)len; @end | > | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | *--------------------------------------------------------------------------- */ @interface TKNSString:NSString { @private Tcl_DString _ds; NSString *_string; const char *_UTF8String; } @property const char *UTF8String; @property (readonly) Tcl_DString DString; - (instancetype)initWithTclUtfBytes:(const void *)bytes length:(NSUInteger)len; @end |
︙ | ︙ |
Changes to macosx/tkMacOSXRegion.c.
1 2 3 4 5 | /* * tkMacOSXRegion.c -- * * Implements X window calls for manipulating regions * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXRegion.c -- * * Implements X window calls for manipulating regions * * Copyright © 1995-1996 Sun Microsystems, Inc. * Copyright © 2001-2009, Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" static void RetainRegion(TkRegion r); |
︙ | ︙ | |||
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | { OSStatus result; result = HIShapeUnion(inShape1, inShape2, outResult); return result; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | { OSStatus result; result = HIShapeUnion(inShape1, inShape2, outResult); return result; } static OSStatus rectCounter( TCL_UNUSED(int), TCL_UNUSED(HIShapeRef), TCL_UNUSED(const CGRect *), void *ref) { int *count = (int *)ref; (*count)++; return noErr; } static OSStatus rectPrinter( TCL_UNUSED(int), TCL_UNUSED(HIShapeRef), const CGRect *rect, TCL_UNUSED(void *)) { if (rect) { fprintf(stderr, " %s\n", NSStringFromRect(*rect).UTF8String); } return noErr; } int TkMacOSXCountRectsInRegion( HIShapeRef shape) { int rect_count = 0; if (!HIShapeIsEmpty(shape)) { HIShapeEnumerate(shape, kHIShapeParseFromBottom|kHIShapeParseFromLeft, (HIShapeEnumerateProcPtr) rectCounter, (void *) &rect_count); } return rect_count; } void TkMacOSXPrintRectsInRegion( HIShapeRef shape) { if (!HIShapeIsEmpty(shape)) { HIShapeEnumerate( shape, kHIShapeParseFromBottom|kHIShapeParseFromLeft, (HIShapeEnumerateProcPtr) rectPrinter, NULL); } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXScale.c.
1 2 3 4 5 6 | /* * tkMacOSXScale.c -- * * This file implements the Macintosh specific portion of the * scale widget. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMacOSXScale.c -- * * This file implements the Macintosh specific portion of the * scale widget. * * Copyright © 1996 Sun Microsystems, Inc. * Copyright © 1998-2000 Scriptics Corporation. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2008-2009 Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkScale.h" |
︙ | ︙ |
Changes to macosx/tkMacOSXScrlbr.c.
1 2 3 4 5 6 | /* * tkMacOSXScrollbar.c -- * * This file implements the Macintosh specific portion of the scrollbar * widget. * | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tkMacOSXScrollbar.c -- * * This file implements the Macintosh specific portion of the scrollbar * widget. * * Copyright © 1996 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2015 Kevin Walzer/WordTech Commununications LLC. * Copyright © 2018-2019 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScrollbar.h" |
︙ | ︙ | |||
242 243 244 245 246 247 248 | } #endif void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | } #endif void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; Tk_Window tkwin = scrollPtr->tkwin; TkWindow *winPtr = (TkWindow *) tkwin; TkMacOSXDrawingContext dc; scrollPtr->flags &= ~REDRAW_PENDING; |
︙ | ︙ | |||
289 290 291 292 293 294 295 | bgGC = Tk_GCForColor(scrollPtr->highlightBgColorPtr, (Pixmap) macWin); if (scrollPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(scrollPtr->highlightColorPtr, (Pixmap) macWin); } else { fgGC = bgGC; } | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | bgGC = Tk_GCForColor(scrollPtr->highlightBgColorPtr, (Pixmap) macWin); if (scrollPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(scrollPtr->highlightColorPtr, (Pixmap) macWin); } else { fgGC = bgGC; } Tk_DrawHighlightBorder(tkwin, fgGC, bgGC, scrollPtr->highlightWidth, (Pixmap) macWin); } Tk_Draw3DRectangle(tkwin, (Pixmap) macWin, scrollPtr->bgBorder, scrollPtr->highlightWidth, scrollPtr->highlightWidth, Tk_Width(tkwin) - 2*scrollPtr->highlightWidth, Tk_Height(tkwin) - 2*scrollPtr->highlightWidth, |
︙ | ︙ | |||
452 453 454 455 456 457 458 | void TkpDestroyScrollbar( TkScrollbar *scrollPtr) { MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr; | | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | void TkpDestroyScrollbar( TkScrollbar *scrollPtr) { MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr; if (macScrollPtr->troughGC != NULL) { Tk_FreeGC(scrollPtr->display, macScrollPtr->troughGC); } if (macScrollPtr->copyGC != NULL) { Tk_FreeGC(scrollPtr->display, macScrollPtr->copyGC); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
589 590 591 592 593 594 595 | TkScrollbar *scrollPtr) /* Scrollbar data struct. */ { MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; Tk_Window tkwin = scrollPtr->tkwin; MacDrawable *macWin = (MacDrawable *)Tk_WindowId(scrollPtr->tkwin); double dViewSize; HIRect contrlRect; | | < | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | TkScrollbar *scrollPtr) /* Scrollbar data struct. */ { MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; Tk_Window tkwin = scrollPtr->tkwin; MacDrawable *macWin = (MacDrawable *)Tk_WindowId(scrollPtr->tkwin); double dViewSize; HIRect contrlRect; short height; NSView *view = TkMacOSXGetNSViewForDrawable(macWin); CGFloat viewHeight = [view bounds].size.height; NSRect frame; frame = NSMakeRect(macWin->xOff, macWin->yOff, Tk_Width(tkwin), Tk_Height(tkwin)); frame = NSInsetRect(frame, scrollPtr->inset, scrollPtr->inset); frame.origin.y = viewHeight - (frame.origin.y + frame.size.height); contrlRect = NSRectToCGRect(frame); msPtr->info.bounds = contrlRect; height = contrlRect.size.height - scrollPtr->arrowLength; /* * Ensure we set scrollbar control bounds only once all size adjustments * have been computed. */ |
︙ | ︙ | |||
766 767 768 769 770 771 772 | */ static void ScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { | | | | | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | */ static void ScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; switch (eventPtr->type) { case UnmapNotify: TkMacOSXSetScrollbarGrow((TkWindow *) scrollPtr->tkwin, false); break; case ActivateNotify: case DeactivateNotify: TkScrollbarEventuallyRedraw(scrollPtr); break; case ButtonPress: case ButtonRelease: case EnterNotify: case LeaveNotify: ScrollbarEvent(scrollPtr, eventPtr); break; default: TkScrollbarEventProc(scrollPtr, eventPtr); } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXSend.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | * interps in one wish app, and you need to send it to the right one. * * Implementing this has been on our list of things to do, but what with * the demise of Tcl at Sun, and the lack of resources at Scriptics it * may not get done for awhile. So this sketch is offered for the brave * to attempt if they need the functionality... * | | | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | * interps in one wish app, and you need to send it to the right one. * * Implementing this has been on our list of things to do, but what with * the demise of Tcl at Sun, and the lack of resources at Scriptics it * may not get done for awhile. So this sketch is offered for the brave * to attempt if they need the functionality... * * Copyright © 1989-1994 The Regents of the University of California. * Copyright © 1994-1998 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXInt.h" |
︙ | ︙ |
Changes to macosx/tkMacOSXServices.c.
1 2 3 4 5 | /* * tkMacOSXServices.c -- *\ * This file allows the integration of Tk and the Cocoa NSServices API. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXServices.c -- *\ * This file allows the integration of Tk and the Cocoa NSServices API. * * Copyright © 2010-2019 Kevin Walzer/WordTech Communications LLC. * Copyright © 2019 Marc Culler. * Copyright © 2010 Adrian Robert. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <tkInt.h> #include <tkMacOSXInt.h> |
︙ | ︙ |
Changes to macosx/tkMacOSXSubwindows.c.
1 2 3 4 5 | /* * tkMacOSXSubwindows.c -- * * Implements subwindows for the macintosh version of Tk. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSXSubwindows.c -- * * Implements subwindows for the macintosh version of Tk. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXDebug.h" |
︙ | ︙ | |||
101 102 103 104 105 106 107 | if (macWin->drawRgn) { CFRelease(macWin->drawRgn); macWin->drawRgn = NULL; } macWin->view = nil; /* | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | if (macWin->drawRgn) { CFRelease(macWin->drawRgn); macWin->drawRgn = NULL; } macWin->view = nil; /* * Delay deletion of a toplevel data structure until all children have * been deleted. */ if (macWin->toplevel->referenceCount == 0) { ckfree(macWin->toplevel); } return Success; |
︙ | ︙ | |||
144 145 146 147 148 149 150 151 152 153 154 155 156 157 | if (!window) { return BadWindow; } MacDrawable *macWin = (MacDrawable *)window; TkWindow *winPtr = macWin->winPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); static Bool initialized = NO; /* * Under certain situations it's possible for this function to be called * before the toplevel window it's associated with has actually been * mapped. In that case we need to create the real Macintosh window now as * this function as well as other X functions assume that the portPtr is * valid. | > > | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | if (!window) { return BadWindow; } MacDrawable *macWin = (MacDrawable *)window; TkWindow *winPtr = macWin->winPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); static Bool initialized = NO; NSPoint mouse = [NSEvent mouseLocation]; int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y; /* * Under certain situations it's possible for this function to be called * before the toplevel window it's associated with has actually been * mapped. In that case we need to create the real Macintosh window now as * this function as well as other X functions assume that the portPtr is * valid. |
︙ | ︙ | |||
181 182 183 184 185 186 187 188 | if (initialized) { if ([win canBecomeKeyWindow]) { [win makeKeyAndOrderFront:NSApp]; } else { [win orderFrontRegardless]; } } } else { | > > > > > > > > > > | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | if (initialized) { if ([win canBecomeKeyWindow]) { [win makeKeyAndOrderFront:NSApp]; } else { [win orderFrontRegardless]; } } /* * Call Tk_UpdatePointer to tell Tk whether the pointer is in the * new window. */ NSPoint viewLocation = [view convertPoint:mouse fromView:nil]; if (NSPointInRect(viewLocation, NSInsetRect([view bounds], 2, 2))) { Tk_UpdatePointer((Tk_Window) winPtr, x, y, [NSApp tkButtonState]); } } else { Tk_Window contWinPtr = Tk_GetOtherWindow((Tk_Window)winPtr); /* * Rebuild the container's clipping region and display * the window. */ TkMacOSXInvalClipRgns(contWinPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } TkMacOSXInvalClipRgns((Tk_Window)winPtr); } else { /* * For non-toplevel windows, rebuild the parent's clipping region |
︙ | ︙ | |||
299 300 301 302 303 304 305 | if (!window) { return BadWindow; } display->request++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr) && | | > | > | > > > > > > > | > > > > > > > > > > > > > > > > > > > > | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | if (!window) { return BadWindow; } display->request++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr) && winPtr->wmInfoPtr->hints.initial_state!=IconicState) { [win setExcludedFromWindowsMenu:YES]; [win orderOut:NSApp]; if ([win isKeyWindow]) { /* * If we are unmapping the key window then we need to make sure * that a new key window is assigned, if possible. This is * supposed to happen when a key window is ordered out, but as * noted in tkMacOSXWm.c this does not happen, in spite of * Apple's claims to the contrary. */ for (NSWindow *w in [NSApp orderedWindows]) { TkWindow *winPtr2 = TkMacOSXGetTkWindow(w); WmInfo *wmInfoPtr; BOOL isOnScreen; if (!winPtr2 || !winPtr2->wmInfoPtr) { continue; } wmInfoPtr = winPtr2->wmInfoPtr; isOnScreen = (wmInfoPtr->hints.initial_state != IconicState && wmInfoPtr->hints.initial_state != WithdrawnState); if (w != win && isOnScreen && [w canBecomeKeyWindow]) { [w makeKeyAndOrderFront:NSApp]; break; } } } } TkMacOSXInvalClipRgns((Tk_Window)winPtr); } else { /* * Rebuild the visRgn clip region for the parent so it will be allowed * to draw in the space from which this subwindow was removed and then * redraw the window. */ if (parentPtr && parentPtr->privatePtr->visRgn) { TkMacOSXInvalidateViewRegion( TkMacOSXGetNSViewForDrawable(parentPtr->window), parentPtr->privatePtr->visRgn); } TkMacOSXInvalClipRgns((Tk_Window)parentPtr); TkMacOSXUpdateClipRgn(parentPtr); } TKContentView *view = [win contentView]; if (view != [NSView focusView]) { |
︙ | ︙ | |||
497 498 499 500 501 502 503 | NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable((Drawable)macWin); /* * Find the Parent window, for an embedded window it will be its container. */ if (Tk_IsEmbedded(macWin->winPtr)) { | | | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable((Drawable)macWin); /* * Find the Parent window, for an embedded window it will be its container. */ if (Tk_IsEmbedded(macWin->winPtr)) { TkWindow *contWinPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)macWin->winPtr); if (contWinPtr) { macParent = contWinPtr->privatePtr; } else { /* * Here we should handle out of process embedding. At this point, * we are assuming that the changes.x,y is not maintained, if you |
︙ | ︙ | |||
755 756 757 758 759 760 761 | } /* * If the window is a container, set the flag for its embedded window. */ if (Tk_IsContainer(winPtr)) { | | | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | } /* * If the window is a container, set the flag for its embedded window. */ if (Tk_IsContainer(winPtr)) { childPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (childPtr) { TkMacOSXSetDrawingEnabled(childPtr, flag); } } } |
︙ | ︙ | |||
836 837 838 839 840 841 842 | if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) { continue; } TkMacOSXWinCGBounds(win2Ptr, &bounds); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); } } else if (Tk_IsEmbedded(winPtr)) { | | | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) { continue; } TkMacOSXWinCGBounds(win2Ptr, &bounds); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); } } else if (Tk_IsEmbedded(winPtr)) { win2Ptr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (win2Ptr) { TkMacOSXUpdateClipRgn(win2Ptr); ChkErr(HIShapeIntersect, win2Ptr->privatePtr->aboveVisRgn, rgn, rgn); } /* |
︙ | ︙ | |||
869 870 871 872 873 874 875 | TkMacOSXWinCGBounds(win2Ptr, &bounds); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); rgnChanged = 1; win2Ptr = win2Ptr->nextPtr; } if (Tk_IsContainer(winPtr)) { | | | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 | TkMacOSXWinCGBounds(win2Ptr, &bounds); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); rgnChanged = 1; win2Ptr = win2Ptr->nextPtr; } if (Tk_IsContainer(winPtr)) { win2Ptr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (win2Ptr) { if (Tk_IsMapped(win2Ptr)) { TkMacOSXWinCGBounds(win2Ptr, &bounds); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); rgnChanged = 1; } } |
︙ | ︙ | |||
903 904 905 906 907 908 909 | * (erroneous) drawing into it or its children from becoming * visible. [Bug 940117] */ if (!Tk_IsTopLevel(winPtr)) { TkMacOSXUpdateClipRgn(winPtr->parentPtr); } else if (Tk_IsEmbedded(winPtr)) { | | | 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 | * (erroneous) drawing into it or its children from becoming * visible. [Bug 940117] */ if (!Tk_IsTopLevel(winPtr)) { TkMacOSXUpdateClipRgn(winPtr->parentPtr); } else if (Tk_IsEmbedded(winPtr)) { win2Ptr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (win2Ptr) { TkMacOSXUpdateClipRgn(win2Ptr); } } macWin->aboveVisRgn = TkMacOSXHIShapeCreateEmpty(); } if (!macWin->visRgn) { |
︙ | ︙ | |||
969 970 971 972 973 974 975 | InvalViewRect( int msg, TCL_UNUSED(HIShapeRef), const CGRect *rect, void *ref) { static CGAffineTransform t; | | | 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | InvalViewRect( int msg, TCL_UNUSED(HIShapeRef), const CGRect *rect, void *ref) { static CGAffineTransform t; TKContentView *view = (TKContentView *)ref; NSRect dirtyRect; if (!view) { return paramErr; } switch (msg) { case kHIShapeEnumerateInit: |
︙ | ︙ | |||
1066 1067 1068 1069 1070 1071 1072 | macWin->toplevel->winPtr->wmInfoPtr && macWin->toplevel->winPtr->wmInfoPtr->window) { result = macWin->toplevel->winPtr->wmInfoPtr->window; } else if (macWin->winPtr && macWin->winPtr->wmInfoPtr && macWin->winPtr->wmInfoPtr->window) { result = macWin->winPtr->wmInfoPtr->window; } else if (macWin->toplevel && (macWin->toplevel->flags & TK_EMBEDDED)) { | | | 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 | macWin->toplevel->winPtr->wmInfoPtr && macWin->toplevel->winPtr->wmInfoPtr->window) { result = macWin->toplevel->winPtr->wmInfoPtr->window; } else if (macWin->winPtr && macWin->winPtr->wmInfoPtr && macWin->winPtr->wmInfoPtr->window) { result = macWin->winPtr->wmInfoPtr->window; } else if (macWin->toplevel && (macWin->toplevel->flags & TK_EMBEDDED)) { TkWindow *contWinPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)macWin->toplevel->winPtr); if (contWinPtr) { result = TkMacOSXGetNSWindowForDrawable((Drawable)contWinPtr->privatePtr); } } return result; } |
︙ | ︙ | |||
1112 1113 1114 1115 1116 1117 1118 | if (!macWin) { result = NULL; } else if (!macWin->toplevel) { result = macWin->view; } else if (!(macWin->toplevel->flags & TK_EMBEDDED)) { result = macWin->toplevel->view; } else { | | | 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 | if (!macWin) { result = NULL; } else if (!macWin->toplevel) { result = macWin->view; } else if (!(macWin->toplevel->flags & TK_EMBEDDED)) { result = macWin->toplevel->view; } else { TkWindow *contWinPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)macWin->toplevel->winPtr); if (contWinPtr) { result = TkMacOSXGetRootControl((Drawable)contWinPtr->privatePtr); } } return result; } |
︙ | ︙ | |||
1194 1195 1196 1197 1198 1199 1200 | } /* * Also, if the window is a container, mark its embedded window. */ if (Tk_IsContainer(winPtr)) { | | | 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 | } /* * Also, if the window is a container, mark its embedded window. */ if (Tk_IsContainer(winPtr)) { childPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (childPtr) { TkMacOSXInvalClipRgns((Tk_Window)childPtr); } /* * TODO: Here we should handle out of process embedding. |
︙ | ︙ | |||
1349 1350 1351 1352 1353 1354 1355 | if (!Tk_IsTopLevel(childPtr)) { UpdateOffsets(childPtr, deltaX, deltaY); } childPtr = childPtr->nextPtr; } if (Tk_IsContainer(winPtr)) { | | | 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | if (!Tk_IsTopLevel(childPtr)) { UpdateOffsets(childPtr, deltaX, deltaY); } childPtr = childPtr->nextPtr; } if (Tk_IsContainer(winPtr)) { childPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (childPtr != NULL) { UpdateOffsets(childPtr,deltaX,deltaY); } /* * TODO: Here we should handle out of process embedding. */ |
︙ | ︙ | |||
1431 1432 1433 1434 1435 1436 1437 | Display *display, /* Display. */ Pixmap pixmap) /* Pixmap to destroy */ { MacDrawable *macPix = (MacDrawable *)pixmap; display->request++; if (macPix->context) { | | > > > | > | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 | Display *display, /* Display. */ Pixmap pixmap) /* Pixmap to destroy */ { MacDrawable *macPix = (MacDrawable *)pixmap; display->request++; if (macPix->context) { char *data = (char *)CGBitmapContextGetData(macPix->context); if (data) { ckfree(data); } /* * Releasing the context here causes a crash in the 8.7 regression * tests, but not in 8.6. * CFRelease(macPix->context); */ } ckfree(macPix); } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Added macosx/tkMacOSXSysTray.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | /* * tkMacOSXSysTray.c -- * * tkMacOSXSysTray.c implements a "systray" Tcl command which allows * one to change the system tray/taskbar icon of a Tk toplevel * window and a "sysnotify" command to post system notifications. * In macOS the icon appears on the right hand side of the menu bar. * * Copyright © 2020 Kevin Walzer/WordTech Communications LLC. * Copyright © 2020 Jan Nijtmans. * Copyright © 2020 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <tkInt.h> #include <tkMacOSXInt.h> #include "tkMacOSXPrivate.h" /* * Class declaration for TkStatusItem. */ @interface TkStatusItem: NSObject { NSStatusItem * statusItem; NSStatusBar * statusBar; NSImage * icon; NSString * tooltip; Tcl_Interp * interp; Tcl_Obj * b1_callback; Tcl_Obj * b3_callback; } - (id) init : (Tcl_Interp *) interp; - (void) setImagewithImage : (NSImage *) image; - (void) setTextwithString : (NSString *) string; - (void) setB1Callback : (Tcl_Obj *) callback; - (void) setB3Callback : (Tcl_Obj *) callback; - (void) clickOnStatusItem; - (void) dealloc; @end /* * Class declaration for TkStatusItem. A TkStatusItem represents an icon posted * on the status bar located on the right side of the MenuBar. Each interpreter * may have at most one TkStatusItem. A pointer to the TkStatusItem belonging * to an interpreter is stored as the clientData of the MacSystrayObjCmd instance * in that interpreter. It will be NULL until the tk systray command is executed * by the interpreter. */ @implementation TkStatusItem : NSObject - (id) init : (Tcl_Interp *) interpreter { [super init]; statusBar = [NSStatusBar systemStatusBar]; statusItem = [[statusBar statusItemWithLength:NSVariableStatusItemLength] retain]; statusItem.button.target = self; statusItem.button.action = @selector(clickOnStatusItem); [statusItem.button sendActionOn : NSEventMaskLeftMouseUp | NSEventMaskRightMouseUp]; statusItem.visible = YES; interp = interpreter; b1_callback = NULL; b3_callback = NULL; return self; } - (void) setImagewithImage : (NSImage *) image { icon = nil; icon = image; statusItem.button.image = icon; } - (void) setTextwithString : (NSString *) string { tooltip = nil; tooltip = string; statusItem.button.toolTip = tooltip; } - (void) setB1Callback : (Tcl_Obj *) obj { if (obj != NULL) { Tcl_IncrRefCount(obj); } if (b1_callback != NULL) { Tcl_DecrRefCount(b1_callback); } b1_callback = obj; } - (void) setB3Callback : (Tcl_Obj *) obj { if (obj != NULL) { Tcl_IncrRefCount(obj); } if (b3_callback != NULL) { Tcl_DecrRefCount(b3_callback); } b3_callback = obj; } - (void) clickOnStatusItem { NSEvent *event = [NSApp currentEvent]; if (([event type] == NSEventTypeLeftMouseUp) && (b1_callback != NULL)) { int result = Tcl_EvalObjEx(interp, b1_callback, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_BackgroundException(interp, result); } } else { if (([event type] == NSEventTypeRightMouseUp) && (b3_callback != NULL)) { int result = Tcl_EvalObjEx(interp, b3_callback, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_BackgroundException(interp, result); } } } } - (void) dealloc { [statusBar removeStatusItem: statusItem]; if (b1_callback != NULL) { Tcl_DecrRefCount(b1_callback); } if (b3_callback != NULL) { Tcl_DecrRefCount(b3_callback); } [super dealloc]; } @end /* * Type used for the ClientData of a MacSystrayObjCmd instance. */ typedef TkStatusItem** StatusItemInfo; /* *---------------------------------------------------------------------- * * MacSystrayDestroy -- * * Removes an intepreters icon from the status bar. * * Results: * None. * * Side effects: * The icon is removed and memory is freed. * *---------------------------------------------------------------------- */ static void MacSystrayDestroy( ClientData clientData, TCL_UNUSED(Tcl_Interp *)) { StatusItemInfo info = (StatusItemInfo)clientData; if (info) { [*info release]; ckfree(info); } } /* *---------------------------------------------------------------------- * * MacSystrayObjCmd -- * * Main command for creating, displaying, and removing icons from the * status bar. * * Results: * * A standard Tcl result. * * Side effects: * * Management of icon display in the status bar. * *---------------------------------------------------------------------- */ static int MacSystrayObjCmd( void *clientData, Tcl_Interp * interp, int objc, Tcl_Obj *const *objv) { Tk_Image tk_image; int result, idx; static const char *options[] = {"create", "modify", "destroy", NULL}; typedef enum {TRAY_CREATE, TRAY_MODIFY, TRAY_DESTROY} optionsEnum; static const char *modifyOptions[] = {"image", "text", "b1_callback", "b3_callback", NULL}; typedef enum {TRAY_IMAGE, TRAY_TEXT, TRAY_B1_CALLBACK, TRAY_B3_CALLBACK } modifyOptionsEnum; if ([NSApp macOSVersion] < 101000) { Tcl_AppendResult(interp, "StatusItem icons not supported on macOS versions lower than 10.10", NULL); return TCL_OK; } StatusItemInfo info = (StatusItemInfo)clientData; TkStatusItem *statusItem = *info; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "create | modify | destroy"); return TCL_ERROR; } result = Tcl_GetIndexFromObjStruct(interp, objv[1], options, sizeof(char *), "command", 0, &idx); if (result != TCL_OK) { return TCL_ERROR; } switch((optionsEnum)idx) { case TRAY_CREATE: { if (objc < 3 || objc > 6) { Tcl_WrongNumArgs(interp, 1, objv, "create -image -text -button1 -button3"); return TCL_ERROR; } if (statusItem == NULL) { statusItem = [[TkStatusItem alloc] init: interp]; *info = statusItem; } else { Tcl_AppendResult(interp, "Only one system tray icon supported per interpreter", NULL); return TCL_ERROR; } /* * Create the icon. */ int width, height; Tk_Window tkwin = Tk_MainWindow(interp); TkWindow *winPtr = (TkWindow *)tkwin; Display *d = winPtr->display; NSImage *icon; tk_image = Tk_GetImage(interp, tkwin, Tcl_GetString(objv[2]), NULL, NULL); if (tk_image == NULL) { return TCL_ERROR; } Tk_SizeOfImage(tk_image, &width, &height); if (width != 0 && height != 0) { icon = TkMacOSXGetNSImageFromTkImage(d, tk_image, width, height); [statusItem setImagewithImage: icon]; Tk_FreeImage(tk_image); } /* * Set the text for the tooltip. */ NSString *tooltip = [NSString stringWithUTF8String: Tcl_GetString(objv[3])]; if (tooltip == nil) { Tcl_AppendResult(interp, " unable to set tooltip for systray icon", NULL); return TCL_ERROR; } [statusItem setTextwithString: tooltip]; /* * Set the proc for the callback. */ [statusItem setB1Callback : (objc > 4) ? objv[4] : NULL]; [statusItem setB3Callback : (objc > 5) ? objv[5] : NULL]; break; } case TRAY_MODIFY: { if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "modify object item"); return TCL_ERROR; } /* * Modify the icon. */ result = Tcl_GetIndexFromObjStruct(interp, objv[2], modifyOptions, sizeof(char *), "option", 0, &idx); if (result != TCL_OK) { return TCL_ERROR; } switch ((modifyOptionsEnum)idx) { case TRAY_IMAGE: { Tk_Window tkwin = Tk_MainWindow(interp); TkWindow *winPtr = (TkWindow *)tkwin; Display *d = winPtr -> display; NSImage *icon; int width, height; tk_image = Tk_GetImage(interp, tkwin, Tcl_GetString(objv[3]), NULL, NULL); if (tk_image == NULL) { Tcl_AppendResult(interp, " unable to obtain image for systray icon", NULL); return TCL_ERROR; } Tk_SizeOfImage(tk_image, &width, &height); if (width != 0 && height != 0) { icon = TkMacOSXGetNSImageFromTkImage(d, tk_image, width, height); [statusItem setImagewithImage: icon]; } Tk_FreeImage(tk_image); break; } /* * Modify the text for the tooltip. */ case TRAY_TEXT: { NSString *tooltip = [NSString stringWithUTF8String:Tcl_GetString(objv[3])]; if (tooltip == nil) { Tcl_AppendResult(interp, "unable to set tooltip for systray icon", NULL); return TCL_ERROR; } [statusItem setTextwithString: tooltip]; break; } /* * Modify the proc for the callback. */ case TRAY_B1_CALLBACK: { [statusItem setB1Callback : objv[3]]; break; } case TRAY_B3_CALLBACK: { [statusItem setB3Callback : objv[3]]; break; } } break; } case TRAY_DESTROY: { /* * Set all properties to nil, and release statusItem. */ [statusItem setImagewithImage: nil]; [statusItem setTextwithString: nil]; [statusItem setB1Callback : NULL]; [statusItem setB3Callback : NULL]; [statusItem release]; *info = NULL; statusItem = NULL; break; } } return TCL_OK; } /* *---------------------------------------------------------------------- * * SysNotifyObjCmd -- * * Create system notification. * * Results: * * A standard Tcl result. * * Side effects: * * System notifications are posted. * *-------------------------------z--------------------------------------- */ static int SysNotifyObjCmd( TCL_UNUSED(void *), Tcl_Interp * interp, int objc, Tcl_Obj *const *objv) { if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "title message"); return TCL_ERROR; } if ([NSApp macOSVersion] < 101000) { Tcl_AppendResult(interp, "Notifications not supported on macOS versions lower than 10.10", NULL); return TCL_OK; } /* * Using NSAppleScript API here allows us to use a single API rather * than multiple, some deprecated, API's, and also allows notifications * to work correctly without requiring Wish to be code-signed - an * undocumented but apparently consistent requirement. And by calling * NSAppleScript inline rather than shelling to out osascript, * Wish shows correctly as the calling app rather than Script Editor. */ NSString *title = [NSString stringWithUTF8String: Tcl_GetString(objv[1])]; NSString *message = [NSString stringWithUTF8String: Tcl_GetString(objv[2])]; NSMutableString *notify = [NSMutableString new]; [notify appendString: @"display notification "]; [notify appendString:@"\""]; [notify appendString:message]; [notify appendString:@"\""]; [notify appendString:@" with title \""]; [notify appendString:title]; [notify appendString:@"\""]; NSAppleScript *scpt = [[[NSAppleScript alloc] initWithSource:notify] autorelease]; NSDictionary *errorInfo; NSAppleEventDescriptor *result = [scpt executeAndReturnError:&errorInfo]; NSString *info = [result stringValue]; const char* output = [info UTF8String]; Tcl_AppendResult(interp, output, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * MacSystrayInit -- * * Initialize this package and create script-level commands. * This is called from TkpInit for each interpreter. * * Results: * * A standard Tcl result. * * Side effects: * * The tk systray and tk sysnotify commands are installed in an * interpreter * *---------------------------------------------------------------------- */ int MacSystrayInit(Tcl_Interp *interp) { /* * Initialize the TkStatusItem for this interpreter. */ StatusItemInfo info = (StatusItemInfo) ckalloc(sizeof(StatusItemInfo)); *info = 0; Tcl_CreateObjCommand(interp, "::tk::systray::_systray", MacSystrayObjCmd, info, (Tcl_CmdDeleteProc *)MacSystrayDestroy); Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", SysNotifyObjCmd, NULL, NULL); return TCL_OK; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXTest.c.
1 2 3 4 5 6 | /* * tkMacOSXTest.c -- * * Contains commands for platform specific tests for * the Macintosh platform. * | | | | | | < | < | < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* * tkMacOSXTest.c -- * * Contains commands for platform specific tests for * the Macintosh platform. * * Copyright © 1996 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXConstants.h" #include "tkMacOSXWm.h" /* * Forward declarations of procedures defined later in this file: */ #if !defined(NDEBUG) && MAC_OS_X_VERSION_MAX_ALLOWED < 1080 static Tcl_ObjCmdProc DebuggerObjCmd; #endif static Tcl_ObjCmdProc PressButtonObjCmd; static Tcl_ObjCmdProc InjectKeyEventObjCmd; static Tcl_ObjCmdProc MenuBarHeightObjCmd; /* *---------------------------------------------------------------------- * * TkplatformtestInit -- * |
︙ | ︙ | |||
54 55 56 57 58 59 60 | TkplatformtestInit( Tcl_Interp *interp) /* Interpreter to add commands to. */ { /* * Add commands for platform specific tests on MacOS here. */ | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | TkplatformtestInit( Tcl_Interp *interp) /* Interpreter to add commands to. */ { /* * Add commands for platform specific tests on MacOS here. */ #if !defined(NDEBUG) && MAC_OS_X_VERSION_MAX_ALLOWED < 1080 Tcl_CreateObjCommand(interp, "debugger", DebuggerObjCmd, NULL, NULL); #endif Tcl_CreateObjCommand(interp, "pressbutton", PressButtonObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "injectkeyevent", InjectKeyEventObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "menubarheight", MenuBarHeightObjCmd, NULL, NULL); return TCL_OK; } |
︙ | ︙ | |||
80 81 82 83 84 85 86 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #if !defined(NDEBUG) && MAC_OS_X_VERSION_MAX_ALLOWED < 1080 static int DebuggerObjCmd( TCL_UNUSED(void *), TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { Debugger(); return TCL_OK; } #endif /* |
︙ | ︙ | |||
174 175 176 177 178 179 180 | * * PressButtonObjCmd -- * * This Tcl command simulates a button press at a specific screen * location. It injects NSEvents into the NSApplication event queue, as * opposed to adding events to the Tcl queue as event generate would do. * One application is for testing the grab command. These events have | | < | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | * * PressButtonObjCmd -- * * This Tcl command simulates a button press at a specific screen * location. It injects NSEvents into the NSApplication event queue, as * opposed to adding events to the Tcl queue as event generate would do. * One application is for testing the grab command. These events have * their timestamp property set to 0 as a signal indicating that they * should not be ignored by [NSApp tkProcessMouseEvent]. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int PressButtonObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { int x = 0, y = 0, i, value; CGPoint pt; NSPoint loc; NSEvent *motion, *press, *release; NSArray *screens = [NSScreen screens]; CGFloat ScreenHeight = 0; enum {X=1, Y}; |
︙ | ︙ | |||
230 231 232 233 234 235 236 | } } pt.x = loc.x = x; pt.y = y; loc.y = ScreenHeight - y; /* | < | | | | | | | | | | | | | | | | | | | | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | } } pt.x = loc.x = x; pt.y = y; loc.y = ScreenHeight - y; /* * We set the timestamp to 0 as a signal to tkProcessMouseEvent. */ CGWarpMouseCursorPosition(pt); motion = [NSEvent mouseEventWithType:NSMouseMoved location:loc modifierFlags:0 timestamp:0 windowNumber:0 context:nil eventNumber:0 clickCount:1 pressure:0]; [NSApp postEvent:motion atStart:NO]; press = [NSEvent mouseEventWithType:NSLeftMouseDown location:loc modifierFlags:0 timestamp:0 windowNumber:0 context:nil eventNumber:0 clickCount:1 pressure:0]; [NSApp postEvent:press atStart:NO]; release = [NSEvent mouseEventWithType:NSLeftMouseUp location:loc modifierFlags:0 timestamp:0 windowNumber:0 context:nil eventNumber:0 clickCount:1 pressure:0]; [NSApp postEvent:release atStart:NO]; return TCL_OK; } static int InjectKeyEventObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { static const char *const optionStrings[] = { "flagschanged", "press", "release", NULL}; NSUInteger types[3] = {NSFlagsChanged, NSKeyDown, NSKeyUp}; static const char *const argStrings[] = { "-command", "-control", "-function", "-option", "-shift", "-x", "-y", NULL}; enum args {KEYEVENT_COMMAND, KEYEVENT_CONTROL, KEYEVENT_FUNCTION, KEYEVENT_OPTION, KEYEVENT_SHIFT, KEYEVENT_X, KEYEVENT_Y}; int i, index, keysym, mods = 0, x = 0, y = 0; NSString *chars = nil, *unmod = nil, *upper, *lower; NSEvent *keyEvent; NSUInteger type; MacKeycode macKC; if (objc < 3) { wrongArgs: Tcl_WrongNumArgs(interp, 1, objv, "option keysym ?arg?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } type = types[index]; if (Tcl_GetIntFromObj(interp, objv[2], &keysym) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "keysym must be an integer")); Tcl_SetErrorCode(interp, "TK", "TEST", "INJECT", "KEYSYM", NULL); |
︙ | ︙ | |||
372 373 374 375 376 377 378 | modifierFlags:mods timestamp:GetCurrentEventTime() windowNumber:0 context:nil characters:chars charactersIgnoringModifiers:unmod isARepeat:NO | | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | modifierFlags:mods timestamp:GetCurrentEventTime() windowNumber:0 context:nil characters:chars charactersIgnoringModifiers:unmod isARepeat:NO keyCode:macKC.v.virt]; [NSApp postEvent:keyEvent atStart:NO]; return TCL_OK; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXWindowEvent.c.
1 2 3 4 5 6 | /* * tkMacOSXWindowEvent.c -- * * This file defines the routines for both creating and handling Window * Manager class events for Tk. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMacOSXWindowEvent.c -- * * This file defines the routines for both creating and handling Window * Manager class events for Tk. * * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 2015 Kevin Walzer/WordTech Communications LLC. * Copyright © 2015 Marc Culler. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXWm.h" |
︙ | ︙ | |||
48 49 50 51 52 53 54 | @implementation TKApplication(TKWindowEvent) - (void) windowActivation: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif | < < > > > > > > > > > > > > > > > > > > > > > > | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | @implementation TKApplication(TKWindowEvent) - (void) windowActivation: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); NSString *name = [notification name]; Bool flag = [name isEqualToString:NSWindowDidBecomeKeyNotification]; if (winPtr && flag) { NSPoint location = [NSEvent mouseLocation]; int x = location.x; int y = floor(TkMacOSXZeroScreenHeight() - location.y); /* * The Tk event target persists when there is no key window but * gets reset when a new window becomes the key window. */ [NSApp setTkEventTarget: winPtr]; /* * Call Tk_UpdatePointer if the pointer is in the window. */ NSView *view = [w contentView]; NSPoint viewLocation = [view convertPoint:location fromView:nil]; if (NSPointInRect(viewLocation, NSInsetRect([view bounds], 2, 2))) { Tk_UpdatePointer((Tk_Window) winPtr, x, y, [NSApp tkButtonState]); } } if (winPtr && Tk_IsMapped(winPtr)) { GenerateActivateEvents(winPtr, flag); } } - (void) windowBoundsChanged: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); |
︙ | ︙ | |||
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | } - (void) windowEnteredFullScreen: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif [(TKWindow *)[notification object] tkLayoutChanged]; } - (void) windowExitedFullScreen: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif [(TKWindow *)[notification object] tkLayoutChanged]; } - (void) windowCollapsed: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { Tk_UnmapWindow((Tk_Window)winPtr); } } - (BOOL) windowShouldClose: (NSWindow *) w { #ifdef TK_MAC_DEBUG_NOTIFICATIONS | > > > > > > > | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | } - (void) windowEnteredFullScreen: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif if (![[notification object] respondsToSelector: @selector (tkLayoutChanged)]) { return; } [(TKWindow *)[notification object] tkLayoutChanged]; } - (void) windowExitedFullScreen: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif if (![[notification object] respondsToSelector: @selector (tkLayoutChanged)]) { return; } [(TKWindow *)[notification object] tkLayoutChanged]; } - (void) windowCollapsed: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { winPtr->wmInfoPtr->hints.initial_state = IconicState; Tk_UnmapWindow((Tk_Window)winPtr); } } - (BOOL) windowShouldClose: (NSWindow *) w { #ifdef TK_MAC_DEBUG_NOTIFICATIONS |
︙ | ︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } } #ifdef TK_MAC_DEBUG_NOTIFICATIONS - (void) windowDragStart: (NSNotification *) notification { TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); } | > > > > > > > > > > > < < < < < < | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } } - (void) windowLiveResize: (NSNotification *) notification { NSString *name = [notification name]; if ([name isEqualToString:NSWindowWillStartLiveResizeNotification]) { // printf("Starting live resize.\n"); } else if ([name isEqualToString:NSWindowDidEndLiveResizeNotification]) { [self setTkLiveResizeEnded:YES]; // printf("Ending live resize\n"); } } #ifdef TK_MAC_DEBUG_NOTIFICATIONS - (void) windowDragStart: (NSNotification *) notification { TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); } - (void) windowUnmapped: (NSNotification *) notification { TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { |
︙ | ︙ | |||
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | observe(NSWindowDidResignKeyNotification, windowActivation:); observe(NSWindowDidMoveNotification, windowBoundsChanged:); observe(NSWindowDidResizeNotification, windowBoundsChanged:); observe(NSWindowDidDeminiaturizeNotification, windowExpanded:); observe(NSWindowDidMiniaturizeNotification, windowCollapsed:); observe(NSWindowWillOrderOnScreenNotification, windowMapped:); observe(NSWindowDidOrderOnScreenNotification, windowBecameVisible:); #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) observe(NSWindowDidEnterFullScreenNotification, windowEnteredFullScreen:); observe(NSWindowDidExitFullScreenNotification, windowExitedFullScreen:); #endif #ifdef TK_MAC_DEBUG_NOTIFICATIONS observe(NSWindowWillMoveNotification, windowDragStart:); | > > < < > > > > > > > > > > > > > > | > > > > > | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | observe(NSWindowDidResignKeyNotification, windowActivation:); observe(NSWindowDidMoveNotification, windowBoundsChanged:); observe(NSWindowDidResizeNotification, windowBoundsChanged:); observe(NSWindowDidDeminiaturizeNotification, windowExpanded:); observe(NSWindowDidMiniaturizeNotification, windowCollapsed:); observe(NSWindowWillOrderOnScreenNotification, windowMapped:); observe(NSWindowDidOrderOnScreenNotification, windowBecameVisible:); observe(NSWindowWillStartLiveResizeNotification, windowLiveResize:); observe(NSWindowDidEndLiveResizeNotification, windowLiveResize:); #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) observe(NSWindowDidEnterFullScreenNotification, windowEnteredFullScreen:); observe(NSWindowDidExitFullScreenNotification, windowExitedFullScreen:); #endif #ifdef TK_MAC_DEBUG_NOTIFICATIONS observe(NSWindowWillMoveNotification, windowDragStart:); observe(NSWindowDidOrderOffScreenNotification, windowUnmapped:); #endif #undef observe } @end /* * Idle task which forces focus to a particular window. */ static void RefocusGrabWindow(void *data) { TkWindow *winPtr = (TkWindow *) data; TkpChangeFocus(winPtr, 1); } #pragma mark TKApplication(TKApplicationEvent) @implementation TKApplication(TKApplicationEvent) - (void) applicationActivate: (NSNotification *) notification { (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif [NSApp tkCheckPasteboard]; /* * When the application is activated with Command-Tab it will create a * zombie window for every Tk window which has been withdrawn. So iterate * through the list of windows and order out any withdrawn window. * If one of the windows is the grab window for its display we focus * it. This is done as at idle, in case the app was reactivated by * clicking a different window. In that case we need to wait until the * mouse event has been processed before focusing the grab window. */ for (NSWindow *win in [NSApp windows]) { TkWindow *winPtr = TkMacOSXGetTkWindow(win); if (!winPtr || !winPtr->wmInfoPtr) { continue; } if (winPtr->wmInfoPtr->hints.initial_state == WithdrawnState) { [win orderOut:NSApp]; } if (winPtr->dispPtr->grabWinPtr == winPtr) { Tcl_DoWhenIdle(RefocusGrabWindow, winPtr); } else { [[self keyWindow] orderFront: self]; } } } - (void) applicationDeactivate: (NSNotification *) notification { (void)notification; |
︙ | ︙ | |||
402 403 404 405 406 407 408 | * * TkpWillDrawWidget -- * * A widget display procedure can call this to determine whether it is * being run inside of the drawRect method. If not, it may be desirable * for the display procedure to simply clear the REDRAW_PENDING flag * and return. The widget can be recorded in order to schedule a | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | * * TkpWillDrawWidget -- * * A widget display procedure can call this to determine whether it is * being run inside of the drawRect method. If not, it may be desirable * for the display procedure to simply clear the REDRAW_PENDING flag * and return. The widget can be recorded in order to schedule a * redraw, via an Expose event, from within drawRect. * * This is also needed for some tests, especially of the Text widget, * which record data in a global Tcl variable and assume that display * procedures will be run in a predictable sequence as Tcl idle tasks. * * Results: * True if called from the drawRect method of a TKContentView with |
︙ | ︙ | |||
517 518 519 520 521 522 523 | } /* * Generate updates for any contained windows */ if (Tk_IsContainer(winPtr)) { | | | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | } /* * Generate updates for any contained windows */ if (Tk_IsContainer(winPtr)) { childPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (childPtr != NULL && Tk_IsMapped(childPtr)) { GenerateUpdates(updateBounds, childPtr); } /* * TODO: Here we should handle out of process embedding. */ |
︙ | ︙ | |||
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | TCL_UNUSED(void *), XEvent *eventPtr) { return (eventPtr->type==ConfigureNotify ? TK_PROCESS_EVENT : TK_DEFER_EVENT); } @implementation TKContentView(TKWindowEvent) - (void) addTkDirtyRect: (NSRect) rect { _tkNeedsDisplay = YES; _tkDirtyRect = NSUnionRect(_tkDirtyRect, rect); [NSApp setNeedsToDraw:YES]; } - (void) clearTkDirtyRect { _tkNeedsDisplay = NO; _tkDirtyRect = NSZeroRect; [NSApp setNeedsToDraw:NO]; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | TCL_UNUSED(void *), XEvent *eventPtr) { return (eventPtr->type==ConfigureNotify ? TK_PROCESS_EVENT : TK_DEFER_EVENT); } @implementation TKContentView(TKWindowEvent) - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { /* * The layer must exist before we set wantsLayer to YES. */ self.layer = [CALayer layer]; self.wantsLayer = YES; self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawOnSetNeedsDisplay; self.layer.contentsGravity = self.layer.contentsAreFlipped ? kCAGravityTopLeft : kCAGravityBottomLeft; /* * Nothing gets drawn at all if the layer does not have a delegate. * Currently, we do not implement any methods of the delegate, however. */ self.layer.delegate = (id) self; trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] options:(NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingEnabledDuringMouseDrag | NSTrackingInVisibleRect | NSTrackingActiveAlways) owner:self userInfo:nil]; [self addTrackingArea:trackingArea]; } return self; } /* * We will just use drawRect. */ - (BOOL) wantsUpdateLayer { return NO; } - (void) viewDidChangeBackingProperties { /* * Make sure that the layer uses a contentScale that matches the * backing scale factor of the screen. This avoids blurry text when * the view is on a Retina display, as well as incorrect size when * the view is on a normal display. */ self.layer.contentsScale = self.window.screen.backingScaleFactor; } - (void) addTkDirtyRect: (NSRect) rect { _tkNeedsDisplay = YES; _tkDirtyRect = NSUnionRect(_tkDirtyRect, rect); [NSApp setNeedsToDraw:YES]; [self setNeedsDisplay:YES]; [[self layer] setNeedsDisplay]; } - (void) clearTkDirtyRect { _tkNeedsDisplay = NO; _tkDirtyRect = NSZeroRect; [NSApp setNeedsToDraw:NO]; |
︙ | ︙ | |||
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; if (object == preferences && [keyPath isEqualToString:@"AppleHighlightColor"]) { if (@available(macOS 10.14, *)) { [self viewDidChangeEffectiveAppearance]; } } } #endif /* * This is no-op on 10.7 and up because Apple has removed this widget, but we * are leaving it here for backwards compatibility. */ - (void) tkToolbarButton: (id) sender { #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd); #endif | > > | | | | | | | | | | | | | | | | 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 | } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { (void) change; (void) context; NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; if (object == preferences && [keyPath isEqualToString:@"AppleHighlightColor"]) { if (@available(macOS 10.14, *)) { [self viewDidChangeEffectiveAppearance]; } } } #endif /* * This is no-op on 10.7 and up because Apple has removed this widget, but we * are leaving it here for backwards compatibility. */ - (void) tkToolbarButton: (id) sender { #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd); #endif union {XEvent general; XVirtualEvent virt;} event; int x, y; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); Tk_Window tkwin = (Tk_Window)winPtr; (void)sender; if (!winPtr){ return; } bzero(&event, sizeof(event)); event.virt.type = VirtualEvent; event.virt.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); event.virt.send_event = false; event.virt.display = Tk_Display(tkwin); event.virt.event = Tk_WindowId(tkwin); event.virt.root = XRootWindow(Tk_Display(tkwin), 0); event.virt.subwindow = None; event.virt.time = TkpGetMS(); XQueryPointer(NULL, winPtr->window, NULL, NULL, &event.virt.x_root, &event.virt.y_root, &x, &y, &event.virt.state); Tk_TopCoordsToWindow(tkwin, x, y, &event.virt.x, &event.virt.y); event.virt.same_screen = true; event.virt.name = Tk_GetUid("ToolbarButton"); Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } /* * On Catalina this is never called and drawRect clips to the rect that * is passed to it by AppKit. */ |
︙ | ︙ |
Changes to macosx/tkMacOSXWm.c.
1 2 3 4 5 6 7 | /* * tkMacOSXWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window manager. * | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tkMacOSXWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window manager. * * Copyright © 1994-1997 Sun Microsystems, Inc. * Copyright © 2001-2009, Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2010 Kevin Walzer/WordTech Communications LLC. * Copyright © 2017-2019 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkScrollbar.h" |
︙ | ︙ | |||
238 239 240 241 242 243 244 245 246 247 248 249 250 251 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); | > > > | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbadgeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); |
︙ | ︙ | |||
293 294 295 296 297 298 299 300 301 302 303 304 305 306 | Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); | > > > | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTouchCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); |
︙ | ︙ | |||
358 359 360 361 362 363 364 | @end @implementation TKDrawerWindow: NSWindow @synthesize tkWindow = _tkWindow; @end @implementation TKWindow: NSWindow | < | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | @end @implementation TKDrawerWindow: NSWindow @synthesize tkWindow = _tkWindow; @end @implementation TKWindow: NSWindow @synthesize tkWindow = _tkWindow; @end #pragma mark TKWindow(TKWm) @implementation TKWindow(TKWm) |
︙ | ︙ | |||
742 743 744 745 746 747 748 | Tk_ManageGeometry((Tk_Window)winPtr, &wmMgrType, NULL); } /* *---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | Tk_ManageGeometry((Tk_Window)winPtr, &wmMgrType, NULL); } /* *---------------------------------------------------------------------- * * TkWmMapWindow -- * * This procedure is invoked to map a top-level window. This module gets * a chance to update all window-manager-related information in * properties before the window manager sees the map event and checks the * properties. It also gets to decide whether or not to even map the * window after all. |
︙ | ︙ | |||
913 914 915 916 917 918 919 | event.xany.serial = LastKnownRequestProcessed(winPtr->display); event.xany.send_event = False; event.xany.display = winPtr->display; event.xmap.window = winPtr->window; event.xmap.type = MapNotify; event.xmap.event = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; | | | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | event.xany.serial = LastKnownRequestProcessed(winPtr->display); event.xany.send_event = False; event.xany.display = winPtr->display; event.xmap.window = winPtr->window; event.xmap.type = MapNotify; event.xmap.event = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; Tk_HandleEvent(&event); } /* *---------------------------------------------------------------------- * * TkWmUnmapWindow -- * |
︙ | ︙ | |||
949 950 951 952 953 954 955 | event.xany.display = winPtr->display; event.xunmap.type = UnmapNotify; event.xunmap.window = winPtr->window; event.xunmap.event = winPtr->window; event.xunmap.from_configure = false; winPtr->flags &= ~TK_MAPPED; XUnmapWindow(winPtr->display, winPtr->window); | | | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | event.xany.display = winPtr->display; event.xunmap.type = UnmapNotify; event.xunmap.window = winPtr->window; event.xunmap.event = winPtr->window; event.xunmap.from_configure = false; winPtr->flags &= ~TK_MAPPED; XUnmapWindow(winPtr->display, winPtr->window); Tk_HandleEvent(&event); } /* *---------------------------------------------------------------------- * * TkWmDeadWindow -- * |
︙ | ︙ | |||
975 976 977 978 979 980 981 982 983 984 985 986 987 988 | void TkWmDeadWindow( TkWindow *winPtr) /* Top-level window that's being deleted. */ { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; TKWindow *deadNSWindow; if (wmPtr == NULL) { return; } /* *If the dead window is a transient, remove it from the container's list. | > | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | void TkWmDeadWindow( TkWindow *winPtr) /* Top-level window that's being deleted. */ { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; TKWindow *deadNSWindow; TkWindow *dragTarget = [NSApp tkDragTarget]; if (wmPtr == NULL) { return; } /* *If the dead window is a transient, remove it from the container's list. |
︙ | ︙ | |||
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | while (wmPtr->transientPtr != NULL) { Transient *transientPtr = wmPtr->transientPtr; wmPtr->transientPtr = transientPtr->nextPtr; ckfree(transientPtr); } /* * Unregister the NSWindow and remove all references to it from the Tk * data structures. If the NSWindow is a child, disassociate it from * the parent. Then close and release the NSWindow. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 | while (wmPtr->transientPtr != NULL) { Transient *transientPtr = wmPtr->transientPtr; wmPtr->transientPtr = transientPtr->nextPtr; ckfree(transientPtr); } deadNSWindow = (TKWindow *)wmPtr->window; /* * Remove references to the Tk window from the mouse event processing * state which is recorded in the NSApplication object. */ if (dragTarget && winPtr == TkMacOSXGetHostToplevel(dragTarget)->winPtr) { [NSApp setTkDragTarget:nil]; } if (winPtr == [NSApp tkPointerWindow]) { NSWindow *w; NSPoint mouse = [NSEvent mouseLocation]; [NSApp setTkPointerWindow:nil]; for (w in [NSApp orderedWindows]) { if (w == deadNSWindow) { continue; } if (NSPointInRect(mouse, [w frame])) { TkWindow *winPtr2 = TkMacOSXGetTkWindow(w); int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y; [NSApp setTkPointerWindow:winPtr2]; Tk_UpdatePointer((Tk_Window) winPtr2, x, y, [NSApp tkButtonState]); break; } } } /* * Unregister the NSWindow and remove all references to it from the Tk * data structures. If the NSWindow is a child, disassociate it from * the parent. Then close and release the NSWindow. */ if (deadNSWindow && !Tk_IsEmbedded(winPtr)) { NSWindow *parent = [deadNSWindow parentWindow]; [deadNSWindow setTkWindow:None]; if (winPtr->window) { ((MacDrawable *)winPtr->window)->view = nil; } wmPtr->window = NULL; |
︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | * there is no choice for a new key window. Moreover, if the host * computer has a TouchBar then the TouchBar holds a reference to the * key window which prevents it from being deallocated until it stops * being the key window. On these systems the only option for * preventing zombies is to set the key window to nil. */ for (NSWindow *w in [NSApp orderedWindows]) { TkWindow *winPtr2 = TkMacOSXGetTkWindow(w); BOOL isOnScreen; if (!winPtr2 || !winPtr2->wmInfoPtr) { continue; } wmPtr2 = winPtr2->wmInfoPtr; isOnScreen = (wmPtr2->hints.initial_state != IconicState && wmPtr2->hints.initial_state != WithdrawnState); if (w != deadNSWindow && isOnScreen && [w canBecomeKeyWindow]) { [w makeKeyAndOrderFront:NSApp]; break; } } /* * Prevent zombies on systems with a TouchBar. */ if (deadNSWindow == [NSApp keyWindow]) { [NSApp _setKeyWindow:nil]; [NSApp _setMainWindow:nil]; } [deadNSWindow close]; [deadNSWindow release]; | > > > > > > > > > > < | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | * there is no choice for a new key window. Moreover, if the host * computer has a TouchBar then the TouchBar holds a reference to the * key window which prevents it from being deallocated until it stops * being the key window. On these systems the only option for * preventing zombies is to set the key window to nil. */ /* * Fix bug 5692042764: * set tkEventTarget to NULL when there is no window to send Tk events to. */ TkWindow *newTkEventTarget = NULL; for (NSWindow *w in [NSApp orderedWindows]) { TkWindow *winPtr2 = TkMacOSXGetTkWindow(w); BOOL isOnScreen; if (!winPtr2 || !winPtr2->wmInfoPtr) { continue; } wmPtr2 = winPtr2->wmInfoPtr; isOnScreen = (wmPtr2->hints.initial_state != IconicState && wmPtr2->hints.initial_state != WithdrawnState); if (w != deadNSWindow && isOnScreen && [w canBecomeKeyWindow]) { [w makeKeyAndOrderFront:NSApp]; newTkEventTarget = TkMacOSXGetTkWindow(w); break; } } [NSApp setTkEventTarget:newTkEventTarget]; /* * Prevent zombies on systems with a TouchBar. */ if (deadNSWindow == [NSApp keyWindow]) { [NSApp _setKeyWindow:nil]; [NSApp _setMainWindow:nil]; } [deadNSWindow close]; [deadNSWindow release]; #if DEBUG_ZOMBIES > 1 fprintf(stderr, "================= Pool dump ===================\n"); [NSAutoreleasePool showPools]; #endif } |
︙ | ︙ | |||
1187 1188 1189 1190 1191 1192 1193 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", | | | | | | | | | 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", "frame", "geometry", "grid", "group", "iconbadge", "iconbitmap", "iconify", "iconmask", "iconname", "iconphoto", "iconposition", "iconwindow", "manage", "maxsize", "minsize", "overrideredirect", "positionfrom", "protocol", "resizable", "sizefrom", "stackorder", "state", "title", "touch", "transient", "withdraw", NULL }; enum options { WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS, WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FORGET, WMOPT_FRAME, WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBADGE, WMOPT_ICONBITMAP, WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME, WMOPT_ICONPHOTO, WMOPT_ICONPOSITION, WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TOUCH, WMOPT_TRANSIENT, WMOPT_WITHDRAW }; int index, length; char *argv1; TkWindow *winPtr; if (objc < 2) { wrongNumArgs: Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } argv1 = Tcl_GetStringFromObj(objv[1], &length); if ((argv1[0] == 't') && (strncmp(argv1, "tracing", length) == 0) && (length >= 3)) { if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 2, objv, "?boolean?"); return TCL_ERROR; } if (objc == 2) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(wmTracing)); return TCL_OK; } return Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing); } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } if (objc < 3) { goto wrongNumArgs; } if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr) != TCL_OK) { return TCL_ERROR; } if (!Tk_IsTopLevel(winPtr) && (index != WMOPT_MANAGE) && (index != WMOPT_TOUCH) && (index != WMOPT_FORGET)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't a top-level window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TOPLEVEL", winPtr->pathName, NULL); return TCL_ERROR; } |
︙ | ︙ | |||
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 | return WmFrameCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GEOMETRY: return WmGeometryCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GRID: return WmGridCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GROUP: return WmGroupCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBITMAP: return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONIFY: return WmIconifyCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONMASK: return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONNAME: | > > | 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | return WmFrameCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GEOMETRY: return WmGeometryCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GRID: return WmGridCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GROUP: return WmGroupCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBADGE: return WmIconbadgeCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBITMAP: return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONIFY: return WmIconifyCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONMASK: return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONNAME: |
︙ | ︙ | |||
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 | return WmSizefromCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STACKORDER: return WmStackorderCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STATE: return WmStateCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TITLE: return WmTitleCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TRANSIENT: return WmTransientCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_WITHDRAW: return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv); } /* This should not happen */ | > > | 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | return WmSizefromCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STACKORDER: return WmStackorderCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STATE: return WmStateCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TITLE: return WmTitleCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TOUCH: return WmTouchCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TRANSIENT: return WmTransientCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_WITHDRAW: return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv); } /* This should not happen */ |
︙ | ︙ | |||
1478 1479 1480 1481 1482 1483 1484 | if (boolean) { request = [NSApp requestUserAttention:NSCriticalRequest]; } tkMacOSXWmAttrNotifyVal = boolean; } break; case WMATT_TITLEPATH: { | | | 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 | if (boolean) { request = [NSApp requestUserAttention:NSCriticalRequest]; } tkMacOSXWmAttrNotifyVal = boolean; } break; case WMATT_TITLEPATH: { const char *path = (const char *)Tcl_FSGetNativePath(value); NSString *filename = @""; if (path && *path) { filename = [NSString stringWithUTF8String:path]; } [macWindow setRepresentedFilename:filename]; break; |
︙ | ︙ | |||
1564 1565 1566 1567 1568 1569 1570 | case WMATT_ALPHA: result = Tcl_NewDoubleObj([macWindow alphaValue]); break; case WMATT_FULLSCREEN: result = Tcl_NewBooleanObj([macWindow styleMask] & NSFullScreenWindowMask); break; case WMATT_MODIFIED: | | | | | | 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | case WMATT_ALPHA: result = Tcl_NewDoubleObj([macWindow alphaValue]); break; case WMATT_FULLSCREEN: result = Tcl_NewBooleanObj([macWindow styleMask] & NSFullScreenWindowMask); break; case WMATT_MODIFIED: result = Tcl_NewBooleanObj([macWindow isDocumentEdited]); break; case WMATT_NOTIFY: result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal); break; case WMATT_TITLEPATH: result = Tcl_NewStringObj([[macWindow representedFilename] UTF8String], -1); break; case WMATT_TOPMOST: result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST); break; case WMATT_TRANSPARENT: result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT); break; case WMATT_TYPE: result = Tcl_NewStringObj("unsupported", -1); break; case _WMATT_LAST_ATTRIBUTE: default: break; |
︙ | ︙ | |||
1632 1633 1634 1635 1636 1637 1638 | if (objc == 3) { /* wm attributes $win */ Tcl_Obj *result = Tcl_NewObj(); for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) { Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(WmAttributeNames[attribute], -1)); Tcl_ListObjAppendElement(NULL, result, | | | | | 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | if (objc == 3) { /* wm attributes $win */ Tcl_Obj *result = Tcl_NewObj(); for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) { Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(WmAttributeNames[attribute], -1)); Tcl_ListObjAppendElement(NULL, result, WmGetAttribute(winPtr, macWindow, (WmAttribute)attribute)); } Tcl_SetObjResult(interp, result); } else if (objc == 4) { /* wm attributes $win -attribute */ if (Tcl_GetIndexFromObjStruct(interp, objv[3], WmAttributeNames, sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } Tcl_SetObjResult(interp, WmGetAttribute(winPtr, macWindow, (WmAttribute)attribute)); } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */ int i; for (i = 3; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], WmAttributeNames, sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } if (WmSetAttribute(winPtr, macWindow, interp, (WmAttribute)attribute, objv[i+1]) != TCL_OK) { return TCL_ERROR; } } } else { Tcl_WrongNumArgs(interp, 2, objv, "window ?-attribute ?value ...??"); return TCL_ERROR; |
︙ | ︙ | |||
1799 1800 1801 1802 1803 1804 1805 | if (wmPtr->cmapList != NULL) { ckfree(wmPtr->cmapList); } wmPtr->cmapList = cmapList; wmPtr->cmapCount = windowObjc; /* | | | 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 | if (wmPtr->cmapList != NULL) { ckfree(wmPtr->cmapList); } wmPtr->cmapList = cmapList; wmPtr->cmapCount = windowObjc; /* * 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; } /* |
︙ | ︙ | |||
1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 | ((transientPtr->flags & WITHDRAWN_BY_CONTAINER) != 0)) { TkpWmSetState(winPtr2, NormalState); transientPtr->flags &= ~WITHDRAWN_BY_CONTAINER; } } } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmFocusmodelCmd -- | > > | 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 | ((transientPtr->flags & WITHDRAWN_BY_CONTAINER) != 0)) { TkpWmSetState(winPtr2, NormalState); transientPtr->flags &= ~WITHDRAWN_BY_CONTAINER; } } } [[win contentView] setNeedsDisplay:YES]; Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * WmFocusmodelCmd -- |
︙ | ︙ | |||
2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 | wmPtr->hints.window_group = Tk_WindowId(tkwin2); wmPtr->hints.flags |= WindowGroupHint; wmPtr->leaderName = (char *)ckalloc(length + 1); strcpy(wmPtr->leaderName, argv3); } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconbitmapCmd -- * * This procedure is invoked to process the "wm iconbitmap" Tcl command. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 | wmPtr->hints.window_group = Tk_WindowId(tkwin2); wmPtr->hints.flags |= WindowGroupHint; wmPtr->leaderName = (char *)ckalloc(length + 1); strcpy(wmPtr->leaderName, argv3); } return TCL_OK; } /*---------------------------------------------------------------------- * * WmIconbadgeCmd -- * * This procedure is invoked to process the "wm iconbadge" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconbadgeCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { (void) winPtr; NSString *label; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv,"window badge"); return TCL_ERROR; } label = [NSString stringWithUTF8String:Tcl_GetString(objv[3])]; int number = [label intValue]; NSDockTile *dockicon = [NSApp dockTile]; /* * First, check that the label is not a decimal. If it is, * return an error. */ if ([label containsString:@"."]) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use \"%s\" as icon badge", Tcl_GetString(objv[3]))); return TCL_ERROR; } /* * Next, check that label is an int, empty string, or exclamation * point. If so, set the icon badge on the Dock icon. Otherwise, * return an error. */ NSArray *array = @[@"", @"!"]; if ([array containsObject: label]) { [dockicon setBadgeLabel:label]; } else if (number > 0) { NSString *str = [@(number) stringValue]; [dockicon setBadgeLabel:str]; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use \"%s\" as icon badge", Tcl_GetString(objv[3]))); return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconbitmapCmd -- * * This procedure is invoked to process the "wm iconbitmap" Tcl command. |
︙ | ︙ | |||
2621 2622 2623 2624 2625 2626 2627 | Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Image tk_icon; | | < | 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 | Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Image tk_icon; int width, height; NSImage *newIcon = NULL; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } /* * Parse args. */ if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) { if (objc == 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } } |
︙ | ︙ | |||
2821 2822 2823 2824 2825 2826 2827 | NSWindow *win = TkMacOSXGetNSWindowForDrawable(oldIcon->window); /* * The old icon should be withdrawn. */ TkpWmSetState(oldIcon, WithdrawnState); | | | 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 | NSWindow *win = TkMacOSXGetNSWindowForDrawable(oldIcon->window); /* * The old icon should be withdrawn. */ TkpWmSetState(oldIcon, WithdrawnState); [win orderOut:NSApp]; [win setExcludedFromWindowsMenu:YES]; wmPtr3->iconFor = NULL; } Tk_MakeWindowExist(tkwin2); wmPtr->hints.icon_window = Tk_WindowId(tkwin2); wmPtr->hints.flags |= IconWindowHint; wmPtr->icon = tkwin2; |
︙ | ︙ | |||
2864 2865 2866 2867 2868 2869 2870 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmManageCmd( | | | | > > > > > > > > > > > > | 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmManageCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window)winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { MacDrawable *macWin = (MacDrawable *)winPtr->window; if (!Tk_IsManageable(frameWin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" is not manageable: must be a" " frame, labelframe or toplevel", Tk_PathName(frameWin))); Tcl_SetErrorCode(interp, "TK", "WM", "MANAGE", NULL); return TCL_ERROR; } /* * Draw the managed widget at the top left corner of its toplevel. * See [4a40c6cace]. */ if (macWin) { winPtr->changes.x -= macWin->xOff; winPtr->changes.y -= macWin->yOff; XMoveWindow(winPtr->display, winPtr->window, 0, 0); } TkFocusSplit(winPtr); Tk_UnmapWindow(frameWin); if (wmPtr == NULL) { TkWmNewWindow(winPtr); if (winPtr->window == None) { Tk_MakeWindowExist((Tk_Window)winPtr); macWin = (MacDrawable *)winPtr->window; |
︙ | ︙ | |||
3053 3054 3055 3056 3057 3058 3059 | if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( | | | 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 | if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( Tk_Attributes((Tk_Window)winPtr)->override_redirect)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &flag) != TCL_OK) { return TCL_ERROR; } atts.override_redirect = flag ? True : False; |
︙ | ︙ | |||
3271 3272 3273 3274 3275 3276 3277 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; | < | < | | 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; results[0] = Tcl_NewBooleanObj(!(wmPtr->flags & WM_WIDTH_NOT_RESIZABLE)); results[1] = Tcl_NewBooleanObj(!(wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetBooleanFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetBooleanFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; |
︙ | ︙ | |||
3499 3500 3501 3502 3503 3504 3505 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } | | | 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result)); return TCL_OK; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3531 3532 3533 3534 3535 3536 3537 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { | | | | 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "iconic", "normal", "withdrawn", "zoomed", NULL }; enum options { OPT_ICONIC, OPT_NORMAL, OPT_WITHDRAWN, OPT_ZOOMED }; int index; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); return TCL_ERROR; } |
︙ | ︙ | |||
3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmTransientCmd -- * * This procedure is invoked to process the "wm transient" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmTouchCmd -- * * This function is invoked to process the "wm touch" Tcl command. See * the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmTouchCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { (void)winPtr; (void)interp; (void)objc; (void)objv; /* TODO: to be implemented yet */ return TCL_ERROR; } /* *---------------------------------------------------------------------- * * WmTransientCmd -- * * This procedure is invoked to process the "wm transient" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. |
︙ | ︙ | |||
3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 | } if (*Tcl_GetString(objv[3]) == '\0') { RemoveTransient(winPtr); } else { if (TkGetWindowFromObj(interp, tkwin, objv[3], &container) != TCL_OK) { return TCL_ERROR; } containerPtr = (TkWindow*) container; while (!Tk_TopWinHierarchy(containerPtr)) { /* * Ensure that the container window is actually a Tk toplevel. */ containerPtr = containerPtr->parentPtr; | > | 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 | } if (*Tcl_GetString(objv[3]) == '\0') { RemoveTransient(winPtr); } else { if (TkGetWindowFromObj(interp, tkwin, objv[3], &container) != TCL_OK) { return TCL_ERROR; } RemoveTransient(winPtr); containerPtr = (TkWindow*) container; while (!Tk_TopWinHierarchy(containerPtr)) { /* * Ensure that the container window is actually a Tk toplevel. */ containerPtr = containerPtr->parentPtr; |
︙ | ︙ | |||
3753 3754 3755 3756 3757 3758 3759 | "can't make \"%s\" a container: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; | | | 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 | "can't make \"%s\" a container: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; w = (TkWindow *)w->wmInfoPtr->container) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't set \"%s\" as container: would cause management loop", Tk_PathName(containerPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
4114 4115 4116 4117 4118 4119 4120 | */ static void TopLevelEventProc( ClientData clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { | | | 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 | */ static void TopLevelEventProc( ClientData clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { TkWindow *winPtr = (TkWindow *)clientData; winPtr->wmInfoPtr->flags |= WM_VROOT_OFFSET_STALE; if (eventPtr->type == DestroyNotify) { if (!(winPtr->flags & TK_ALREADY_DEAD)) { /* * A top-level window was deleted externally (e.g., by the window * manager). This is probably not a good thing, but cleanup as |
︙ | ︙ | |||
4200 4201 4202 4203 4204 4205 4206 | *---------------------------------------------------------------------- */ static void UpdateGeometryInfo( ClientData clientData) /* Pointer to the window's record. */ { | | | 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 | *---------------------------------------------------------------------- */ static void UpdateGeometryInfo( ClientData clientData) /* Pointer to the window's record. */ { TkWindow *winPtr = (TkWindow *)clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; wmPtr->flags &= ~WM_UPDATE_PENDING; if (wmPtr->flags & WM_FULLSCREEN) { return; |
︙ | ︙ | |||
4327 4328 4329 4330 4331 4332 4333 | * This is because of "features" in some window managers (e.g. twm, as * of 4/24/91) where they don't interpret coordinates according to * ICCCM. Moving a window to its current location may cause it to shift * position on the screen. */ if (Tk_IsEmbedded(winPtr)) { | | | | 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 | * This is because of "features" in some window managers (e.g. twm, as * of 4/24/91) where they don't interpret coordinates according to * ICCCM. Moving a window to its current location may cause it to shift * position on the screen. */ if (Tk_IsEmbedded(winPtr)) { Tk_Window contWinPtr = Tk_GetOtherWindow((Tk_Window)winPtr); /* * TODO: Here we should handle out of process embedding. */ if (contWinPtr != NULL) { /* * This window is embedded and the container is also in this * process, so we don't need to do anything special about the * geometry, except to make sure that the desired size is known by * the container. Also, zero out any position information, since * embedded windows are not allowed to move. */ wmPtr->x = wmPtr->y = 0; wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y); Tk_GeometryRequest(contWinPtr, width, height); } return; } if (wmPtr->flags & WM_MOVE_PENDING) { wmPtr->configWidth = width; wmPtr->configHeight = height; if (wmTracing) { |
︙ | ︙ | |||
4617 4618 4619 4620 4621 4622 4623 | if (!(Tk_IsEmbedded(winPtr))) { x += winPtr->wmInfoPtr->xInParent; y += winPtr->wmInfoPtr->yInParent; break; } | | | 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 | if (!(Tk_IsEmbedded(winPtr))) { x += winPtr->wmInfoPtr->xInParent; y += winPtr->wmInfoPtr->yInParent; break; } otherPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (otherPtr == NULL) { break; } /* * The container window is in the same application. Query its * coordinates. |
︙ | ︙ | |||
4700 4701 4702 4703 4704 4705 4706 | /* * Container windows cannot have children. So if it is a container, * look there, otherwise inspect the children. */ if (Tk_IsContainer(winPtr)) { | | | 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 | /* * Container windows cannot have children. So if it is a container, * look there, otherwise inspect the children. */ if (Tk_IsContainer(winPtr)) { childPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (childPtr != NULL) { if (Tk_IsMapped(childPtr)) { tmpx = x - childPtr->changes.x; tmpy = y - childPtr->changes.y; bd = childPtr->changes.border_width; if ((tmpx >= -bd) && (tmpy >= -bd) |
︙ | ︙ | |||
4781 4782 4783 4784 4785 4786 4787 | int *newX, int *newY) /* Coordinates of point in the upperMost child * of tkWin containing (rootX,rootY) */ { TkWindow *winPtr, *childPtr; TkWindow *nextPtr; /* Coordinates of highest child found so far * that contains point. */ int x, y; /* Coordinates in winPtr. */ | < < | | 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 | int *newX, int *newY) /* Coordinates of point in the upperMost child * of tkWin containing (rootX,rootY) */ { TkWindow *winPtr, *childPtr; TkWindow *nextPtr; /* Coordinates of highest child found so far * that contains point. */ int x, y; /* Coordinates in winPtr. */ winPtr = (TkWindow *)tkwin; x = rootX; y = rootY; while (1) { nextPtr = NULL; /* * Container windows cannot have children. So if it is a container, * look there, otherwise inspect the children. */ if (Tk_IsContainer(winPtr)) { childPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (childPtr != NULL) { if (Tk_IsMapped(childPtr) && x > childPtr->changes.x && x < childPtr->changes.x + childPtr->changes.width && y > childPtr->changes.y && y < childPtr->changes.y + childPtr->changes.height) { nextPtr = childPtr; |
︙ | ︙ | |||
5180 5181 5182 5183 5184 5185 5186 | ckfree(oldPtr); } topPtr->wmInfoPtr->cmapList = newPtr; topPtr->wmInfoPtr->cmapCount = count+1; /* | | | 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 | ckfree(oldPtr); } topPtr->wmInfoPtr->cmapList = newPtr; topPtr->wmInfoPtr->cmapCount = count+1; /* * 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. */ } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
5415 5416 5417 5418 5419 5420 5421 | TkWindow *winPtr, Tk_Uid titleUid) { if (Tk_IsEmbedded(winPtr)) { return; } | | | 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 | TkWindow *winPtr, Tk_Uid titleUid) { if (Tk_IsEmbedded(winPtr)) { return; } NSString *title = [[TKNSString alloc] initWithTclUtfBytes:titleUid length:-1]; [TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title]; [title release]; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
5500 5501 5502 5503 5504 5505 5506 | */ Tk_Window Tk_MacOSXGetTkWindow( void *w) { Window window = None; | < | > | > > > | 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 | */ Tk_Window Tk_MacOSXGetTkWindow( void *w) { Window window = None; if ([(NSWindow *)w respondsToSelector: @selector (tkWindow)]) { window = [(TKWindow *)w tkWindow]; } if (window) { TkDisplay *dispPtr = TkGetDisplayList(); return Tk_IdToWindow(dispPtr->display, window); } else { return NULL; } } /* *---------------------------------------------------------------------- * * TkMacOSXIsWindowZoomed -- * |
︙ | ︙ | |||
5558 5559 5560 5561 5562 5563 5564 | */ int TkMacOSXZoomToplevel( void *whichWindow, /* The Macintosh window to zoom. */ short zoomPart) /* Either inZoomIn or inZoomOut */ { | | | | 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 | */ int TkMacOSXZoomToplevel( void *whichWindow, /* The Macintosh window to zoom. */ short zoomPart) /* Either inZoomIn or inZoomOut */ { NSWindow *window = (NSWindow *)whichWindow; TkWindow *winPtr = (TkWindow *)TkMacOSXGetTkWindow(window); WmInfo *wmPtr; if (!winPtr || !winPtr->wmInfoPtr) { return false; } wmPtr = winPtr->wmInfoPtr; if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) && |
︙ | ︙ | |||
5611 5612 5613 5614 5615 5616 5617 | TkUnsupported1ObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const subcmds[] = { | | | | | 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 | TkUnsupported1ObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const subcmds[] = { "appearance", "isdark", "style", "tabbingid", NULL }; enum SubCmds { TKMWS_APPEARANCE, TKMWS_ISDARK, TKMWS_STYLE, TKMWS_TABID }; Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr; int index; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
5909 5910 5911 5912 5913 5914 5915 | static int WmWinTabbingId( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { | | > > > > > > > | 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 | static int WmWinTabbingId( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 (void) interp; (void) winPtr; (void) objc; (void) objv; return TCL_OK; #endif #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 Tcl_Obj *result = NULL; NSString *idString; NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (win) { idString = win.tabbingIdentifier; result = Tcl_NewStringObj(idString.UTF8String, [idString length]); } |
︙ | ︙ | |||
5960 5961 5962 5963 5964 5965 5966 | * WmWinAppearance -- * * This procedure is invoked to process the * "::tk::unsupported::MacWindowStyle appearance" subcommand. The command * allows you to get or set the appearance for the NSWindow associated * with a Tk Window. The syntax is: * | | | 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 | * WmWinAppearance -- * * This procedure is invoked to process the * "::tk::unsupported::MacWindowStyle appearance" subcommand. The command * allows you to get or set the appearance for the NSWindow associated * with a Tk Window. The syntax is: * * tk::unsupported::MacWindowStyle appearance window ?newAppearance? * * Allowed appearance names are "aqua", "darkaqua", and "auto". * * Results: * Returns the appearance setting of the window prior to calling this * function. * |
︙ | ︙ | |||
5988 5989 5990 5991 5992 5993 5994 5995 5996 | static int WmWinAppearance( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { #if MAC_OS_X_VERSION_MAX_ALLOWED > 1090 static const char *const appearanceStrings[] = { | > > > > > > > | | | 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 | static int WmWinAppearance( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1090 (void) interp; (void) winPtr; (void) objc; (void) objv; return TCL_OK; #endif #if MAC_OS_X_VERSION_MAX_ALLOWED > 1090 static const char *const appearanceStrings[] = { "aqua", "auto", "darkaqua", NULL }; enum appearances { APPEARANCE_AQUA, APPEARANCE_AUTO, APPEARANCE_DARKAQUA }; Tcl_Obj *result = NULL; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 NSAppearanceName appearance; #else NSString *appearance; #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 |
︙ | ︙ | |||
6026 6027 6028 6029 6030 6031 6032 | if (result == NULL) { NSLog(@"Failed to read appearance name; try calling update idletasks before getting/setting the appearance of the window."); return TCL_OK; } if (objc == 4) { int index; if (Tcl_GetIndexFromObjStruct(interp, objv[3], appearanceStrings, | | | | | 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 | if (result == NULL) { NSLog(@"Failed to read appearance name; try calling update idletasks before getting/setting the appearance of the window."); return TCL_OK; } if (objc == 4) { int index; if (Tcl_GetIndexFromObjStruct(interp, objv[3], appearanceStrings, sizeof(char *), "appearancename", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum appearances) index) { case APPEARANCE_AQUA: win.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua]; break; case APPEARANCE_DARKAQUA: #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 |
︙ | ︙ | |||
6129 6130 6131 6132 6133 6134 6135 | /* * If this is embedded, make sure its container's toplevel exists, then * return... */ if (Tk_IsEmbedded(winPtr)) { | | | 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 | /* * If this is embedded, make sure its container's toplevel exists, then * return... */ if (Tk_IsEmbedded(winPtr)) { TkWindow *contWinPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)winPtr); if (contWinPtr != NULL) { TkMacOSXMakeRealWindowExist( contWinPtr->privatePtr->toplevel->winPtr); macWin->flags |= TK_HOST_EXISTS; return; } |
︙ | ︙ | |||
6196 6197 6198 6199 6200 6201 6202 | Tcl_Panic("couldn't allocate new Mac window"); } TKContentView *contentView = [[TKContentView alloc] initWithFrame:NSZeroRect]; [window setContentView:contentView]; [contentView release]; [window setDelegate:NSApp]; | | | 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 | Tcl_Panic("couldn't allocate new Mac window"); } TKContentView *contentView = [[TKContentView alloc] initWithFrame:NSZeroRect]; [window setContentView:contentView]; [contentView release]; [window setDelegate:NSApp]; [window setAcceptsMouseMovedEvents:NO]; [window setReleasedWhenClosed:NO]; if (styleMask & NSUtilityWindowMask) { [(TKPanel*)window setFloatingPanel:YES]; } if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) && !(styleMask & NSDocModalWindowMask)) { /* |
︙ | ︙ | |||
6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 | if (overrideRedirect) { XSetWindowAttributes atts; atts.override_redirect = True; Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); ApplyContainerOverrideChanges(winPtr, NULL); } } /* *---------------------------------------------------------------------- * * TkpRedrawWidget -- * | > | 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 | if (overrideRedirect) { XSetWindowAttributes atts; atts.override_redirect = True; Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); ApplyContainerOverrideChanges(winPtr, NULL); } [window display]; } /* *---------------------------------------------------------------------- * * TkpRedrawWidget -- * |
︙ | ︙ | |||
6267 6268 6269 6270 6271 6272 6273 | if (w) { TKContentView *view = [w contentView]; TkMacOSXWinBounds(winPtr, &tkBounds); bounds = NSMakeRect(tkBounds.left, [view bounds].size.height - tkBounds.bottom, tkBounds.right - tkBounds.left, tkBounds.bottom - tkBounds.top); | < | | 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 | if (w) { TKContentView *view = [w contentView]; TkMacOSXWinBounds(winPtr, &tkBounds); bounds = NSMakeRect(tkBounds.left, [view bounds].size.height - tkBounds.bottom, tkBounds.right - tkBounds.left, tkBounds.bottom - tkBounds.top); [view addTkDirtyRect:bounds]; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 | wmPtr->hints.initial_state = state; if (wmPtr->flags & WM_NEVER_MAPPED) { return; } macWin = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (state == WithdrawnState) { Tk_UnmapWindow((Tk_Window)winPtr); } else if (state == IconicState) { /* * The window always gets unmapped. If we can show the icon version of * the window we also collapse it. */ if (macWin && ([macWin styleMask] & NSMiniaturizableWindowMask) && ![macWin isMiniaturized]) { [macWin miniaturize:NSApp]; } Tk_UnmapWindow((Tk_Window)winPtr); } else if (state == NormalState || state == ZoomState) { Tk_MapWindow((Tk_Window)winPtr); [macWin deminiaturize:NSApp]; [macWin orderFront:NSApp]; TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn : inZoomOut); } /* | > > > > > > > > > > > > > > | | 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 | wmPtr->hints.initial_state = state; if (wmPtr->flags & WM_NEVER_MAPPED) { return; } macWin = TkMacOSXGetNSWindowForDrawable(winPtr->window); /* * Make sure windows are updated before the state change. As an exception, * do not process idle tasks before withdrawing a window. The purpose of * this is to support the common paradigm of immediately withdrawing the * root window. Processing idle tasks before changing the state causes the * root to briefly flash on the screen, which users of this paradigm find * annoying. Not processing the events does not guarantee that the window * will not appear but makes it more likely. */ if (state != WithdrawnState) { while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}; } if (state == WithdrawnState) { Tk_UnmapWindow((Tk_Window)winPtr); } else if (state == IconicState) { /* * The window always gets unmapped. If we can show the icon version of * the window we also collapse it. */ if (macWin && ([macWin styleMask] & NSMiniaturizableWindowMask) && ![macWin isMiniaturized]) { [macWin miniaturize:NSApp]; } Tk_UnmapWindow((Tk_Window)winPtr); } else if (state == NormalState || state == ZoomState) { Tk_MapWindow((Tk_Window)winPtr); [macWin deminiaturize:NSApp]; [macWin orderFront:NSApp]; TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn : inZoomOut); } /* * Make sure windows are updated after the state change too. */ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)){} } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 | TkWmRestackToplevel(winPtr, Above, NULL); if (force) { [NSApp activateIgnoringOtherApps:YES]; } if (win && [win canBecomeKeyWindow]) { [win makeKeyAndOrderFront:NSApp]; } } /* * Remember the current serial number for the X server and issue a dummy * server request. This marks the position at which we changed the focus, * so we can distinguish FocusIn and FocusOut events on either side of the | > | 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 | TkWmRestackToplevel(winPtr, Above, NULL); if (force) { [NSApp activateIgnoringOtherApps:YES]; } if (win && [win canBecomeKeyWindow]) { [win makeKeyAndOrderFront:NSApp]; [NSApp setTkEventTarget:TkMacOSXGetTkWindow(win)]; } } /* * Remember the current serial number for the X server and issue a dummy * server request. This marks the position at which we changed the focus, * so we can distinguish FocusIn and FocusOut events on either side of the |
︙ | ︙ | |||
6675 6676 6677 6678 6679 6680 6681 | windows = windowPtr = (TkWindow **)ckalloc((windowCount + 1) * sizeof(TkWindow *)); if (windows != NULL) { Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); for (NSWindow *w in backToFront) { hPtr = Tcl_FindHashEntry(&table, (char*) w); if (hPtr != NULL) { | | | 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 | windows = windowPtr = (TkWindow **)ckalloc((windowCount + 1) * sizeof(TkWindow *)); if (windows != NULL) { Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); for (NSWindow *w in backToFront) { hPtr = Tcl_FindHashEntry(&table, (char*) w); if (hPtr != NULL) { childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); *windowPtr++ = childWinPtr; } } *windowPtr = NULL; Tcl_DeleteHashTable(&table); } return windows; |
︙ | ︙ | |||
6858 6859 6860 6861 6862 6863 6864 | * The default max size has height less than the screen * height. This causes the window manager to refuse to * allow the window to be resized when it is a split * window. To work around this we make the max size equal * to the screen size. (For 10.11 and up, only) */ | | | 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 | * The default max size has height less than the screen * height. This causes the window manager to refuse to * allow the window to be resized when it is a split * window. To work around this we make the max size equal * to the screen size. (For 10.11 and up, only) */ if ([NSApp macOSVersion] >= 101100) { NSSize screenSize = [[macWindow screen] frame].size; [macWindow setMaxFullScreenContentSize:screenSize]; } } } #endif |
︙ | ︙ | |||
7000 7001 7002 7003 7004 7005 7006 | title = winPtr->nameUid; } [macWindow setStyleMask:styleMask]; [macWindow setTitle:[NSString stringWithUTF8String:title]]; [macWindow setExcludedFromWindowsMenu:NO]; wmPtr->flags &= ~WM_TOPMOST; } | | | 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 | title = winPtr->nameUid; } [macWindow setStyleMask:styleMask]; [macWindow setTitle:[NSString stringWithUTF8String:title]]; [macWindow setExcludedFromWindowsMenu:NO]; wmPtr->flags &= ~WM_TOPMOST; } if (wmPtr->container != NULL) { TkWindow *containerWinPtr = (TkWindow *)wmPtr->container; if (containerWinPtr && (containerWinPtr->window != None) && TkMacOSXHostToplevelExists(containerWinPtr)) { NSWindow *containerMacWin = TkMacOSXGetNSWindowForDrawable( containerWinPtr->window); |
︙ | ︙ |
Changes to macosx/tkMacOSXWm.h.
1 2 3 4 5 | /* * tkMacOSXWm.h -- * * Declarations of Macintosh specific window manager structures. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkMacOSXWm.h -- * * Declarations of Macintosh specific window manager structures. * * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKMACWM #define _TKMACWM |
︙ | ︙ |
Changes to macosx/tkMacOSXXCursors.h.
1 2 3 4 5 6 7 | /* * tkMacOSXXCursors.h -- * * This file defines a set of Macintosh cursors that * emulate the X cursor set. All of these cursors were * constructed and donated by Grant Neufeld. ([email protected]) * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMacOSXXCursors.h -- * * This file defines a set of Macintosh cursors that * emulate the X cursor set. All of these cursors were * constructed and donated by Grant Neufeld. ([email protected]) * * Copyright © 1995-1996 Sun Microsystems, Inc. * Copyright © 2008-2009 Apple Inc. * Copyright © 2008-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ static const unsigned char tkMacOSXXCursors[][68] = { |
︙ | ︙ |
Changes to macosx/tkMacOSXXStubs.c.
1 2 3 4 5 6 7 8 | /* * tkMacOSXXStubs.c -- * * This file contains most of the X calls called by Tk. Many of these * calls are just stubs and either don't make sense on the Macintosh or * their implementation just doesn't do anything. Other calls will * eventually be moved into other files. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tkMacOSXXStubs.c -- * * This file contains most of the X calls called by Tk. Many of these * calls are just stubs and either don't make sense on the Macintosh or * their implementation just doesn't do anything. Other calls will * eventually be moved into other files. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009, Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 2014 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXInt.h" |
︙ | ︙ | |||
873 874 875 876 877 878 879 | * However, there is no real way to do this on a Mac. Let me know if there * is! */ display->request++; return Success; } | | | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | * However, there is no real way to do this on a Mac. Let me know if there * is! */ display->request++; return Success; } int XSetClipRectangles( Display *d, GC gc, int clip_x_origin, int clip_y_origin, XRectangle* rectangles, |
︙ | ︙ |
Changes to macosx/ttkMacOSXTheme.c.
1 2 3 4 5 6 7 8 | /* * ttkMacOSXTheme.c -- * * Tk theme engine for Mac OSX, using the Appearance Manager API. * * Copyright (c) 2004 Joe English * Copyright (c) 2005 Neil Madden * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * ttkMacOSXTheme.c -- * * Tk theme engine for Mac OSX, using the Appearance Manager API. * * Copyright (c) 2004 Joe English * Copyright (c) 2005 Neil Madden * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2008-2009 Apple Inc. * Copyright (c) 2009 Kevin Walzer/WordTech Communications LLC. * Copyright (c) 2019 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * See also: * * <URL: http://developer.apple.com/documentation/Carbon/Reference/ |
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 | * * The QuickDraw/Carbon coordinate system is relative to the top-level * window, not to the Tk_Window. BoxToRect() accounts for this. */ #include "tkMacOSXPrivate.h" #include "ttk/ttkTheme.h" #include <math.h> /* | > > > > > > > > > > > > > | < < < < < | | < < < < < < > > | < | < | < | > | < < | > > > > > > | > > | > | > > > > > > | < > | | < | < < > > > | | < > | > | < | < < > > | | | < > | > | < > | < | | | < < < < < < < < < | < < | > | > > > > > > > > | | | > > | > > | | > > > > > > > > | > | | < < > > | < < > > > > > | < < < < | | > | > | > > > > | > | > | | > > | < | | > | < < < < < | < < < < < | | > > | > > | | < < > > > > > > > > > | | | | | | < > | > < > | > | | > > > > > > > > > > | > > | > > > > > > > > > > | | < | < < < | | | > > > | > | | | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < | > | > > > > > > > > | > > > > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | * * The QuickDraw/Carbon coordinate system is relative to the top-level * window, not to the Tk_Window. BoxToRect() accounts for this. */ #include "tkMacOSXPrivate.h" #include "ttk/ttkTheme.h" #include "ttkMacOSXTheme.h" #include "tkColor.h" #include <math.h> MODULE_SCOPE NSColor *controlAccentColor(void) { static int accentPixel = -1; if (accentPixel == -1) { TkColor *temp = TkpGetColor(NULL, "systemControlAccentColor"); accentPixel = temp->color.pixel; ckfree(temp); } return TkMacOSXGetNSColor(NULL, accentPixel); } /* * Values which depend on the OS version. These are initialized * in Ttk_MacOSXInit. */ static Ttk_Padding entryElementPadding; static CGFloat Ttk_ContrastDelta; /*---------------------------------------------------------------------- * +++ ComputeButtonDrawInfo -- * * Fill in an appearance manager HIThemeButtonDrawInfo record * from a Ttk state and the ThemeButtonParams used as the * clientData. */ static inline HIThemeButtonDrawInfo ComputeButtonDrawInfo( ThemeButtonParams *params, Ttk_State state, TCL_UNUSED(Tk_Window)) { /* * See ButtonElementDraw for the explanation of why we always draw * some buttons in the active state. */ SInt32 HIThemeState; int adornment = 0; HIThemeState = Ttk_StateTableLookup(ThemeStateTable, state); /* * HITheme uses the adornment to decide the direction of the * arrow on a Disclosure Button. Also HITheme draws inactive * (TTK_STATE_BACKGROUND) buttons in a gray color but macOS * no longer does that. So we adjust the HIThemeState. */ switch (params->kind) { case kThemeArrowButton: adornment = kThemeAdornmentDrawIndicatorOnly; if (state & TTK_STATE_SELECTED) { adornment |= kThemeAdornmentArrowUpArrow; } /* Fall through. */ case kThemeRadioButton: /* * The gray color is better than the blue color for a * background selected Radio Button. */ if (state & TTK_STATE_SELECTED) { break; } default: if (state & TTK_STATE_BACKGROUND) { HIThemeState |= kThemeStateActive; } break; } const HIThemeButtonDrawInfo info = { .version = 0, .state = HIThemeState, .kind = params ? params->kind : 0, .value = Ttk_StateTableLookup(ButtonValueTable, state), .adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state) | adornment, }; return info; } /* * When we draw simulated Apple widgets we use the Core Graphics framework. * Core Graphics uses CGColorRefs, not NSColors. A CGColorRef must be retained * and released explicitly while an NSColor is autoreleased. In version 10.8 * of macOS Apple introduced a CGColor property of an NSColor which is guaranteed * to be a valid CGColorRef for (approximately) the same color and is released * when the NSColor is autoreleased. * * When building on systems earlier than 10.8 there is no painless way to * convert an NSColor to a CGColor. On the other hand, on those systems we use * the HIToolbox to draw all widgets, so we never need to call Core Graphics * drawing routines directly. This means that the functions and macros below * which construct CGColorRefs can be defined to return nil on systems before * 10.8. * * Similarly, those older systems did not have CGPathCreateWithRoundedRect, but * since we never need to draw rounded rectangles on those systems we can just * define it to return nil. */ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 static CGColorRef CGColorFromRGBA( CGFloat *rgba) { NSColorSpace *colorSpace = [NSColorSpace sRGBColorSpace]; NSColor *nscolor = [NSColor colorWithColorSpace: colorSpace components: rgba count: 4]; return nscolor.CGColor; } static CGColorRef CGColorFromGray( GrayColor g) { CGFloat rgba[4] = {g.grayscale, g.grayscale, g.grayscale, g.alpha}; NSColorSpace *colorSpace = [NSColorSpace sRGBColorSpace]; NSColor *nscolor = [NSColor colorWithColorSpace: colorSpace components: rgba count: 4]; return nscolor.CGColor; } #define CGCOLOR(nscolor) (nscolor).CGColor #else #define CGCOLOR(nscolor) NULL #define CGColorFromRGBA(rgba) NULL #define CGColorFromGray(gray) NULL #define CGPathCreateWithRoundedRect(w, x, y, z) NULL #endif /*---------------------------------------------------------------------- * +++ Utilities. */ /*---------------------------------------------------------------------- * BoxToRect -- * * Convert a Ttk_Box in Tk coordinates relative to the given Drawable to a * native CGRect relative to the containing NSView. (The coordinate system * is the one used by CGContextRef, which has origin at the upper left * corner, and y increasing downward.) */ static inline CGRect BoxToRect( Drawable d, Ttk_Box b) { MacDrawable *md = (MacDrawable *)d; CGRect rect; rect.origin.y = b.y + md->yOff; rect.origin.x = b.x + md->xOff; rect.size.height = b.height; rect.size.width = b.width; return rect; } /*---------------------------------------------------------------------- * LookupGrayPalette * * Retrieves the palette of grayscale colors needed to draw a particular * type of button, in a particular state, in light or dark mode. * */ static GrayPalette LookupGrayPalette( const ButtonDesign *design, unsigned int state, int isDark) { const PaletteStateTable *entry = design->palettes; while ((state & entry->onBits) != entry->onBits || (~state & entry->offBits) != entry->offBits) { ++entry; } return isDark ? entry->dark : entry->light; } /*---------------------------------------------------------------------- * NormalizeButtonBounds -- * * This function returns the actual bounding rectangle that will be used * in drawing the button. * * Apple only allows three specific heights for most buttons: regular, * small and mini. We always use the regular size. However, Ttk may * provide a bounding rectangle with arbitrary height. We draw the Mac * button centered vertically in the Ttk rectangle, with the same width as * the rectangle. (But we take care to produce an integer y coordinate, * to avoid unexpected anti-aliasing.) * * In addition, the button types which are not known to HIToolbox need some * adjustments to their bounds. * */ static CGRect NormalizeButtonBounds( ThemeButtonParams *params, CGRect bounds, int isDark) { SInt32 height; if (params->heightMetric != NoThemeMetric) { ChkErr(GetThemeMetric, params->heightMetric, &height); height += 2; bounds.origin.y += round(1 + (bounds.size.height - height) / 2); bounds.size.height = height; } switch (params->kind) { case TkRoundedRectButton: bounds.size.height -= 1; break; case TkInlineButton: bounds.size.height -= 4; bounds.origin.y += 1; break; case TkRecessedButton: bounds.size.height -= 2; break; case kThemeRoundButtonHelp: if (isDark) { bounds.size.height = bounds.size.width = 22; } else { bounds.size.height = bounds.size.width = 22; } break; default: break; } return bounds; } /*---------------------------------------------------------------------- * +++ Background Colors * * Support for contrasting background colors when GroupBoxes or Tabbed * panes are nested inside each other. Early versions of macOS used ridged * borders, so do not need contrasting backgrounds. */ /* * For systems older than 10.14, [NSColor windowBackgroundColor] generates * garbage when called from this function. In 10.14 it works correctly, and * must be used in order to have a background color which responds to Dark * Mode. So we use this hard-wired RGBA color on the older systems which don't * support Dark Mode anyway. */ RGBACOLOR windowBackground[4] = RGBA256(235.0, 235.0, 235.0, 1.0); /*---------------------------------------------------------------------- * GetBackgroundColor -- * * Fills the array rgba with the color coordinates for a background color. * Start with the background color of a window's container, or the * standard ttk window background if there is no container. If the * contrast parameter is nonzero, modify this color to be darker, for the * aqua appearance, or lighter for the DarkAqua appearance. This is * primarily used by the Fill and Background elements. The save parameter * is normally YES, so the contrasting color is saved in the private * data of the widget. This behavior can be disabled in special cases, * such as when drawing notebook tabs in macOS 11. */ static void GetBackgroundColorRGBA( TCL_UNUSED(CGContextRef), Tk_Window tkwin, int contrast, Bool save, CGFloat *rgba) { TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *containerPtr = (TkWindow *) TkGetContainer(tkwin); while (containerPtr && containerPtr->privatePtr) { if (containerPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { break; } containerPtr = (TkWindow *)TkGetContainer(containerPtr); } if (containerPtr && containerPtr->privatePtr) { for (int i = 0; i < 4; i++) { rgba[i] = containerPtr->privatePtr->fillRGBA[i]; } } else { if ([NSApp macOSVersion] > 101300) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *windowColor = [[NSColor windowBackgroundColor] colorUsingColorSpace: deviceRGB]; [windowColor getComponents: rgba]; } else { for (int i = 0; i < 4; i++) { rgba[i] = windowBackground[i]; } } } if (contrast) { int isDark = (rgba[0] + rgba[1] + rgba[2] < 1.5); if (isDark) { for (int i = 0; i < 3; i++) { rgba[i] += Ttk_ContrastDelta*contrast / 255.0; } } else { for (int i = 0; i < 3; i++) { rgba[i] -= Ttk_ContrastDelta*contrast / 255.0; } } if (save && winPtr->privatePtr) { winPtr->privatePtr->flags |= TTK_HAS_CONTRASTING_BG; for (int i = 0; i < 4; i++) { winPtr->privatePtr->fillRGBA[i] = rgba[i]; } } } } static CGColorRef GetBackgroundCGColor( CGContextRef context, Tk_Window tkwin, int contrast, Bool save) { CGFloat rgba[4]; GetBackgroundColorRGBA(context, tkwin, contrast, save, rgba); return CGColorFromRGBA(rgba); } /*---------------------------------------------------------------------- * +++ Buttons */ /*---------------------------------------------------------------------- * FillRoundedRectangle -- * * Fill a rounded rectangle with a specified solid color. */ static void FillRoundedRectangle( CGContextRef context, CGRect bounds, CGFloat radius, CGColorRef color) { CGPathRef path; CHECK_RADIUS(radius, bounds) path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL); if (!path) { return; } CGContextSetFillColorWithColor(context, color); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextFillPath(context); CFRelease(path); } /*---------------------------------------------------------------------- * FillBorder -- * * Draw a 1-pixel border around a rounded rectangle using a 3-step * gradient of shades of gray. */ static void FillBorder( CGContextRef context, CGRect bounds, GrayPalette palette, CGFloat radius) { if (bounds.size.width < 2) { return; } NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; CGPoint end = CGPointMake(bounds.origin.x, bounds.origin.y + bounds.size.height); CGFloat corner = (radius > 0 ? radius : 2.0) / bounds.size.height; CGFloat locations[4] = {0.0, corner, 1.0 - corner, 1.0}; CGPathRef path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL); CGFloat colors[16]; colors[0] = colors[1] = colors[2] = palette.top / 255.0; colors[4] = colors[5] = colors[6] = palette.side / 255.0; colors[8] = colors[9] = colors[10] = palette.side / 255.0; colors[12] = colors[13] = colors[14] = palette.bottom / 255.0; colors[3] = colors[7] = colors[11] = colors[15] = 1.0; CGGradientRef gradient = CGGradientCreateWithColorComponents( sRGB.CGColorSpace, colors, locations, 4); if (!gradient) { return; } CGContextSaveGState(context); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextClip(context); CGContextDrawLinearGradient(context, gradient, bounds.origin, end, 0.0); CGContextRestoreGState(context); CFRelease(path); CFRelease(gradient); } /*---------------------------------------------------------------------- * DrawFocusRing -- * * Draw a 4-pixel wide rounded focus ring enclosing a rounded * rectangle, using the current system accent color. */ static void DrawFocusRing( CGContextRef context, CGRect bounds, const ButtonDesign *design) { CGColorRef highlightColor; CGFloat highlight[4] = {1.0, 1.0, 1.0, 0.2}; CGColorRef focusColor; focusColor = CGCOLOR([controlAccentColor() colorWithAlphaComponent:0.6]); FillRoundedRectangle(context, bounds, design->radius, focusColor); bounds = CGRectInset(bounds, 3, 3); highlightColor = CGColorFromRGBA(highlight); CGContextSetFillColorWithColor(context, highlightColor); CGContextFillRect(context, bounds); } /*---------------------------------------------------------------------- * DrawGrayButton -- * * Draw a button in normal gray colors. * * Aqua buttons are normally drawn in a grayscale color. The buttons, * which are shaped as rounded rectangles have a 1-pixel border which is * drawn in a 3-step gradient and a solid gray face. * * Note that this will produce a round button if length = width = * 2*radius. */ static void DrawGrayButton( CGContextRef context, CGRect bounds, const ButtonDesign *design, unsigned int state, Tk_Window tkwin) { int isDark = TkMacOSXInDarkMode(tkwin); GrayPalette palette = LookupGrayPalette(design, state, isDark); GrayColor faceGray = {.grayscale = 0.0, .alpha = 1.0}; CGFloat radius = 2 * design->radius <= bounds.size.height ? design->radius : bounds.size.height / 2; if (palette.top <= 255.0) { FillBorder(context, bounds, palette, radius); } if (palette.face <= 255.0) { faceGray.grayscale = palette.face / 255.0; } else { /* * Color values > 255 are "transparent" which really means that we * fill with the background color. */ CGFloat rgba[4], gray; GetBackgroundColorRGBA(context, tkwin, 0, NO, rgba); gray = (rgba[0] + rgba[1] + rgba[2]) / 3.0; faceGray.grayscale = gray; } FillRoundedRectangle(context, CGRectInset(bounds, 1, 1), radius - 1, CGColorFromGray(faceGray)); } /*---------------------------------------------------------------------- * DrawAccentedButton -- * * The accent color is only used when drawing buttons in the active * window. Push Buttons and segmented Arrow Buttons are drawn in color * when in the pressed state. Selected Check Buttons, Radio Buttons and * notebook Tabs are also drawn in color. The color is based on the * user's current choice for the controlAccentColor, but is actually a * linear gradient with a 1-pixel darker line at the top and otherwise * changing from lighter at the top to darker at the bottom. This * function draws a colored rounded rectangular button. */ static void DrawAccentedButton( CGContextRef context, CGRect bounds, const ButtonDesign *design, int state, int isDark) { NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; CGColorRef faceColor = CGCOLOR(controlAccentColor()); CGFloat radius = design->radius; CGPathRef path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL); // This gradient should only be used for PushButtons and Tabs, and it needs // to be lighter at the top. static CGFloat components[12] = {1.0, 1.0, 1.0, 0.05, 1.0, 1.0, 1.0, 0.2, 1.0, 1.0, 1.0, 0.0}; CGFloat locations[3] = {0.0, 0.05, 1.0}; CGGradientRef gradient = CGGradientCreateWithColorComponents( sRGB.CGColorSpace, components, locations, 3); CGPoint end; if (bounds.size.height > 2*radius) { bounds.size.height -= 1; } end = CGPointMake(bounds.origin.x, bounds.origin.y + bounds.size.height); CGContextSaveGState(context); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextClip(context); FillRoundedRectangle(context, bounds, radius, faceColor); CGContextDrawLinearGradient(context, gradient, bounds.origin, end, 0.0); if (state & TTK_STATE_PRESSED && state & TTK_STATE_ALTERNATE) { CGColorRef color = isDark ? CGColorFromGray(darkPressedDefaultButton) : CGColorFromGray(pressedDefaultButton); FillRoundedRectangle(context, bounds, radius, color); } CGContextRestoreGState(context); CFRelease(path); CFRelease(gradient); } /*---------------------------------------------------------------------- * DrawAccentedSegment -- * * Draw the colored ends of widgets like popup buttons and combo buttons. */ static void DrawAccentedSegment( CGContextRef context, CGRect bounds, const ButtonDesign *design, unsigned int state, Tk_Window tkwin) { /* * Clip to the bounds and then draw an accented button which is extended so * that the rounded corners on the left will be clipped off. This assumes * that the bounds include room for the focus ring. */ int isDark = TkMacOSXInDarkMode(tkwin); GrayColor sepGray = isDark ? darkComboSeparator : lightComboSeparator; CGColorRef sepColor = CGColorFromGray(sepGray); CGRect clip = bounds; clip.size.height += 10; bounds.origin.x -= 10; bounds.size.width += 10; CGPoint separator[2] = { CGPointMake(clip.origin.x - 1, bounds.origin.y + 5), CGPointMake(clip.origin.x - 1, bounds.origin.y + bounds.size.height - 3)}; CGContextSaveGState(context); CGContextSetStrokeColorWithColor(context, sepColor); CGContextSetShouldAntialias(context, false); CGContextSetLineWidth(context, 0.5); CGContextAddLines(context, separator, 2); CGContextStrokePath(context); CGContextSetShouldAntialias(context, true); if (state & TTK_STATE_FOCUS) { CGRect focusClip = clip; clip.size.width += 4; CGContextClipToRect(context, focusClip); bounds = CGRectInset(bounds, 0, 1); DrawFocusRing(context, bounds, design); } bounds = CGRectInset(bounds, 4, 4); if (state & TTK_STATE_BACKGROUND) { bounds.size.height += 2; } else { bounds.size.height += 1; } CGContextClipToRect(context, clip); if ((state & TTK_STATE_BACKGROUND) || (state & TTK_STATE_DISABLED)) { DrawGrayButton(context, bounds, design, state, tkwin); } else { DrawAccentedButton(context, bounds, design, state | TTK_STATE_ALTERNATE, isDark); } CGContextRestoreGState(context); } /*---------------------------------------------------------------------- * +++ Entry boxes */ static void DrawEntry( CGContextRef context, CGRect bounds, const ButtonDesign *design, int state, Tk_Window tkwin) { int isDark = TkMacOSXInDarkMode(tkwin); GrayPalette palette = LookupGrayPalette(design, state, isDark); CGColorRef backgroundColor; CGFloat bgRGBA[4]; if (isDark) { GetBackgroundColorRGBA(context, tkwin, 0, NO, bgRGBA); /* * Lighten the entry background to provide contrast. */ for (int i = 0; i < 3; i++) { bgRGBA[i] += 8.0 / 255.0; } backgroundColor = CGColorFromRGBA(bgRGBA); } else { backgroundColor = CG_WHITE; } if (state & TTK_STATE_FOCUS) { DrawFocusRing(context, bounds, design); } else { FillBorder(context, CGRectInset(bounds,3,3), palette, design->radius); } bounds = CGRectInset(bounds, 4, 4); FillRoundedRectangle(context, bounds, design->radius, backgroundColor); } /*---------------------------------------------------------------------- * +++ Chevrons, CheckMarks, etc. -- */ static void DrawDownArrow( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, int state) { CGColorRef strokeColor; CGFloat x, y; if (state & TTK_STATE_DISABLED) { strokeColor = CGCOLOR([NSColor disabledControlTextColor]); } else if (state & TTK_STATE_IS_ACCENTED) { strokeColor = CG_WHITE; } else { strokeColor = CGCOLOR([NSColor controlTextColor]); } CGContextSetStrokeColorWithColor(context, strokeColor); CGContextSetLineWidth(context, 1.5); x = bounds.origin.x + inset; y = bounds.origin.y + trunc(bounds.size.height / 2) + 1; CGContextBeginPath(context); CGPoint arrow[3] = { {x, y - size / 4}, {x + size / 2, y + size / 4}, {x + size, y - size / 4} }; CGContextAddLines(context, arrow, 3); CGContextStrokePath(context); } /*---------------------------------------------------------------------- * DrawUpArrow -- * * Draws a single upward pointing arrow for ListHeaders and Disclosure Buttons. */ static void DrawUpArrow( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, int state) { NSColor *strokeColor; CGFloat x, y; if (state & TTK_STATE_DISABLED) { strokeColor = [NSColor disabledControlTextColor]; } else { strokeColor = [NSColor controlTextColor]; } CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor)); CGContextSetLineWidth(context, 1.5); x = bounds.origin.x + inset; y = bounds.origin.y + trunc(bounds.size.height / 2); CGContextBeginPath(context); CGPoint arrow[3] = { {x, y + size / 4}, {x + size / 2, y - size / 4}, {x + size, y + size / 4} }; CGContextAddLines(context, arrow, 3); CGContextStrokePath(context); } /*---------------------------------------------------------------------- * DrawUpDownArrows -- * * Draws the double arrows used in menu buttons and spin buttons. */ static void DrawUpDownArrows( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, CGFloat gap, int state, ThemeDrawState drawState) { CGFloat x, y; NSColor *topStrokeColor, *bottomStrokeColor; if (drawState == BOTH_ARROWS && !(state & TTK_STATE_BACKGROUND)) { topStrokeColor = bottomStrokeColor = [NSColor whiteColor]; } else if (drawState == kThemeStatePressedDown) { topStrokeColor = [NSColor controlTextColor]; bottomStrokeColor = [NSColor whiteColor]; } else if (drawState == kThemeStatePressedUp) { topStrokeColor = [NSColor whiteColor]; bottomStrokeColor = [NSColor controlTextColor]; } else if (state & TTK_STATE_DISABLED) { topStrokeColor = bottomStrokeColor = [NSColor disabledControlTextColor]; } else { topStrokeColor = bottomStrokeColor = [NSColor controlTextColor]; } CGContextSetLineWidth(context, 1.5); x = bounds.origin.x + inset; y = bounds.origin.y + trunc(bounds.size.height / 2); CGContextBeginPath(context); CGPoint bottomArrow[3] = {{x, y + gap}, {x + size / 2, y + gap + size / 2}, {x + size, y + gap}}; CGContextAddLines(context, bottomArrow, 3); CGContextSetStrokeColorWithColor(context, CGCOLOR(bottomStrokeColor)); CGContextStrokePath(context); CGContextBeginPath(context); CGPoint topArrow[3] = {{x, y - gap}, {x + size / 2, y - gap - size / 2}, {x + size, y - gap}}; CGContextAddLines(context, topArrow, 3); CGContextSetStrokeColorWithColor(context, CGCOLOR(topStrokeColor)); CGContextStrokePath(context); } /*---------------------------------------------------------------------- * DrawClosedDisclosure -- * * Draws a disclosure chevron in the Big Sur style, for Treeviews. */ static void DrawClosedDisclosure( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, CGFloat *rgba) |
︙ | ︙ | |||
369 370 371 372 373 374 375 376 377 378 379 380 381 382 | CGContextBeginPath(context); CGPoint arrow[3] = { {x, y - size / 4 - 1}, {x + size / 2, y}, {x, y + size / 4 + 1} }; CGContextAddLines(context, arrow, 3); CGContextStrokePath(context); } static void DrawOpenDisclosure( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, CGFloat *rgba) | > > > > > > | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | CGContextBeginPath(context); CGPoint arrow[3] = { {x, y - size / 4 - 1}, {x + size / 2, y}, {x, y + size / 4 + 1} }; CGContextAddLines(context, arrow, 3); CGContextStrokePath(context); } /*---------------------------------------------------------------------- * DrawOpenDisclosure -- * * Draws an open disclosure chevron in the Big Sur style, for Treeviews. */ static void DrawOpenDisclosure( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, CGFloat *rgba) |
︙ | ︙ | |||
392 393 394 395 396 397 398 | {x, y - size / 4}, {x + size / 2, y + size / 2}, {x + size, y - size / 4} }; CGContextAddLines(context, arrow, 3); CGContextStrokePath(context); } /*---------------------------------------------------------------------- | > > > | > | > > > > > > > > > > > > > > > | > > > > | < | | | > > > > > > > > > > > > > > > | > | > > > > > | > > > > > > | > | > > > > > > > > | > > | < > > | > | < > > > > > > > > > > > > > > > > > | > > > | > > > > > | > > | > > > > | < > | > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > > > > > > > | < | | > > > > | | < > > > | > > > > | > > | > > > | | > | > | | | > | > > | > > > | > > > > > > > > | | | > | > > > > > > > > > > > > > > > > > > > > < > | | > | > > | > > > > > > > > > > > > | > > > > > > > > > > > | < > | > > > | < < < < < | > > > > > > | < > > | > > > > > > > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > > | > > | < < | < | | < < | | < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | < < < < < < < < < < < < < < | < < < < < < < < > > > > > > | > > | > > > | < < > | | | | > | > | < | | > | < | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < | > | < < < < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < > | > > > | | | | < | | | | | | < < < < < < < < < < | < < | < | | | | | | | < > > > > | > > > > > > > | > > > | > > > > > | > > > > > > > > > | > > | | | < < | < < | | | | | | < < < | < | < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | < | < < | < < | < < < < < < < < | < < < < < < | < < < < < < < < < < < < < < < < < < < < > | < | < < < < < < | | < < < < < < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < | < < < | < < < < | | < | < < < < < < < < < < < | < < < < < | < < < < | < < < < < < < < < | < < < < < | < < < < < | < < < < | < | < < < < < < < < < | < < < < < < < | > < < | < | > > > > > | > | | | | | > > | > > > > > > > > > > > > > | > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | < | | | | | | | | | | | > > > | | < | | | | 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | {x, y - size / 4}, {x + size / 2, y + size / 2}, {x + size, y - size / 4} }; CGContextAddLines(context, arrow, 3); CGContextStrokePath(context); } /*---------------------------------------------------------------------- * IndicatorColor -- * * Returns a CGColorRef of the appropriate shade for a check button or * radio button in a given state. */ static CGColorRef IndicatorColor( int state, int isDark) { if (state & TTK_STATE_DISABLED) { return isDark ? CGColorFromGray(darkDisabledIndicator) : CGColorFromGray(lightDisabledIndicator); } else if ((state & TTK_STATE_SELECTED || state & TTK_STATE_ALTERNATE) && !(state & TTK_STATE_BACKGROUND)) { return CG_WHITE; } else { return CGCOLOR([NSColor controlTextColor]); } } /*---------------------------------------------------------------------- * DrawCheckIndicator -- * * Draws the checkmark or horizontal bar in a check box. */ static void DrawCheckIndicator( CGContextRef context, CGRect bounds, int state, int isDark) { CGFloat x = bounds.origin.x, y = bounds.origin.y; CGColorRef strokeColor = IndicatorColor(state, isDark); CGContextSetStrokeColorWithColor(context, strokeColor); if (state & TTK_STATE_SELECTED) { CGContextSetLineWidth(context, 1.5); CGContextBeginPath(context); CGPoint check[3] = {{x + 3, y + 7}, {x + 6, y + 10}, {x + 10, y + 3}}; CGContextAddLines(context, check, 3); CGContextStrokePath(context); } else if (state & TTK_STATE_ALTERNATE) { CGContextSetLineWidth(context, 2.0); CGContextBeginPath(context); CGPoint bar[2] = {{x + 3, y + 7}, {x + 11, y + 7}}; CGContextAddLines(context, bar, 2); CGContextStrokePath(context); } } /*---------------------------------------------------------------------- * DrawRadioIndicator -- * * Draws the dot in the middle of a selected radio button. */ static void DrawRadioIndicator( CGContextRef context, CGRect bounds, int state, int isDark) { CGFloat x = bounds.origin.x, y = bounds.origin.y; CGColorRef fillColor = IndicatorColor(state, isDark); CGContextSetFillColorWithColor(context, fillColor); if (state & TTK_STATE_SELECTED) { CGContextBeginPath(context); CGRect dot = {{x + 5, y + 5}, {6, 6}}; CGContextAddEllipseInRect(context, dot); CGContextFillPath(context); } else if (state & TTK_STATE_ALTERNATE) { CGRect bar = {{x + 4, y + 7}, {8, 2}}; CGContextFillRect(context, bar); } } static void DrawHelpSymbol( CGContextRef context, CGRect bounds, int state) { NSFont *font = [NSFont controlContentFontOfSize:15]; NSColor *foreground = state & TTK_STATE_DISABLED ? [NSColor disabledControlTextColor] : [NSColor controlTextColor]; NSDictionary *attrs = @{ NSForegroundColorAttributeName : foreground, NSFontAttributeName : font }; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:@"?" attributes:attrs]; CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedString( (CFAttributedStringRef)attributedString); CTLineRef line = CTTypesetterCreateLine(typesetter, CFRangeMake(0, 1)); CGAffineTransform t = CGAffineTransformMake( 1.0, 0.0, 0.0, -1.0, 0.0, bounds.size.height); CGContextSaveGState(context); CGContextSetTextMatrix(context, t); CGContextSetTextPosition(context, bounds.origin.x + 6.5, bounds.origin.y + bounds.size.height - 5); CTLineDraw(line, context); CGContextRestoreGState(context); CFRelease(line); CFRelease(typesetter); [attributedString release]; } /*---------------------------------------------------------------------- * +++ Progress bars. */ /*---------------------------------------------------------------------- * DrawProgressBar -- * * Draws a progress bar, with parameters supplied by a HIThemeTrackDrawInfo * struct. Draws a rounded rectangular track overlayed by a colored * rounded rectangular indicator. An indeterminate progress bar is * animated. */ static void DrawProgressBar( CGContextRef context, CGRect bounds, HIThemeTrackDrawInfo info, int state, Tk_Window tkwin) { CGRect colorBounds; CGFloat rgba[4]; CGColorRef trackColor, highlightColor, fillColor; NSColor *accent; CGFloat ratio = (CGFloat) info.value / (CGFloat) (info.max - info.min); GetBackgroundColorRGBA(context, tkwin, 0, NO, rgba); /* * Compute the bounds for the track and indicator. The track is 6 pixels * wide in the center of the widget bounds. */ if (info.attributes & kThemeTrackHorizontal) { bounds = CGRectInset(bounds, 1, bounds.size.height / 2 - 3); colorBounds = bounds; if (info.kind == kThemeIndeterminateBar) { CGFloat width = 0.25*bounds.size.width; CGFloat travel = 0.75*bounds.size.width; CGFloat center = bounds.origin.x + (width / 2) + ratio*travel; colorBounds.origin.x = center - width / 2; colorBounds.size.width = width; } else { colorBounds.size.width = ratio*bounds.size.width; } if (colorBounds.size.width > 0 && colorBounds.size.width < 6) { colorBounds.size.width = 6; } } else { bounds = CGRectInset(bounds, bounds.size.width / 2 - 3, 1); colorBounds = bounds; if (info.kind == kThemeIndeterminateBar) { CGFloat height = 0.25*bounds.size.height; CGFloat travel = 0.75*bounds.size.height; CGFloat center = bounds.origin.y + (height / 2) + ratio*travel; colorBounds.origin.y = center - height / 2; colorBounds.size.height = height; } else { colorBounds.size.height = ratio*(bounds.size.height); } if (colorBounds.size.height > 0 && colorBounds.size.height < 6) { colorBounds.size.height = 6; } colorBounds.origin.y += bounds.size.height - colorBounds.size.height; } /* * Compute the colors for the track and indicator. */ if (TkMacOSXInDarkMode(tkwin)) { for(int i=0; i < 3; i++) { rgba[i] += 30.0 / 255.0; } trackColor = CGColorFromRGBA(rgba); for(int i=0; i < 3; i++) { rgba[i] -= 5.0 / 255.0; } highlightColor = CGColorFromRGBA(rgba); FillRoundedRectangle(context, bounds, 3, trackColor); } else { for(int i=0; i < 3; i++) { rgba[i] -= 14.0 / 255.0; } trackColor = CGColorFromRGBA(rgba); for(int i=0; i < 3; i++) { rgba[i] += 3.0 / 255.0; } highlightColor = CGColorFromRGBA(rgba); bounds.size.height -= 1; bounds = CGRectInset(bounds, 0, -1); } if (state & TTK_STATE_BACKGROUND) { accent = [NSColor colorWithRed:0.72 green:0.72 blue:0.72 alpha:0.72]; } else { accent = controlAccentColor(); } /* * Draw the track, with highlighting around the edge. */ FillRoundedRectangle(context, bounds, 3, trackColor); bounds = CGRectInset(bounds, 0, 0.5); FillRoundedRectangle(context, bounds, 2.5, highlightColor); bounds = CGRectInset(bounds, 0.5, 0.5); FillRoundedRectangle(context, bounds, 2, trackColor); bounds = CGRectInset(bounds, -0.5, -1); /* * Draw the indicator. Make it slightly transparent around the * edge so the highlightng shows through. */ if (info.kind == kThemeIndeterminateBar && (state & TTK_STATE_SELECTED) == 0) { return; } fillColor = CGCOLOR([accent colorWithAlphaComponent:0.9]); FillRoundedRectangle(context, colorBounds, 3, fillColor); colorBounds = CGRectInset(colorBounds, 1, 1); fillColor = CGCOLOR([accent colorWithAlphaComponent:1.0]); FillRoundedRectangle(context, colorBounds, 2.5, fillColor); } /*---------------------------------------------------------------------- * +++ Sliders. */ /*---------------------------------------------------------------------- * DrawSlider -- * * Draws a slider track and round thumb for a Ttk scale widget. The accent * color is used on the left or top part of the track, so the fraction of * the track which is colored is equal to (value - from) / (to - from). * */ static void DrawSlider( CGContextRef context, CGRect bounds, HIThemeTrackDrawInfo info, int state, Tk_Window tkwin) { CGColorRef trackColor; CGRect clipBounds, trackBounds, thumbBounds; CGPoint thumbPoint; CGFloat position; CGColorRef accentColor; Bool fromIsSmaller = info.reserved; double from = info.min, to = fabs((double) info.max), value = info.value; /* * info.min, info.max and info.value are integers. When this is called * we will have arranged that min = 0 and max is a large positive integer. */ double fraction = (from < to) ? (value - from) / (to - from) : 0.5; int isDark = TkMacOSXInDarkMode(tkwin); if (info.attributes & kThemeTrackHorizontal) { trackBounds = CGRectInset(bounds, 0, bounds.size.height / 2 - 3); trackBounds.size.height = 3; position = 8 + fraction * (trackBounds.size.width - 16); clipBounds = trackBounds; if (fromIsSmaller) { clipBounds.size.width = position; } else { clipBounds.origin.x += position; clipBounds.size.width -= position; } thumbPoint = CGPointMake(trackBounds.origin.x + position, trackBounds.origin.y + 1); } else { trackBounds = CGRectInset(bounds, bounds.size.width / 2 - 3, 0); trackBounds.size.width = 3; position = 8 + fraction * (trackBounds.size.height - 16); clipBounds = trackBounds; if (fromIsSmaller) { clipBounds.size.height = position; } else { clipBounds.origin.y += position; clipBounds.size.height -= position; } thumbPoint = CGPointMake(trackBounds.origin.x + 1, trackBounds.origin.y + position); } trackColor = isDark ? CGColorFromGray(darkTrack): CGColorFromGray(lightTrack); thumbBounds = CGRectMake(thumbPoint.x - 8, thumbPoint.y - 8, 17, 17); CGContextSaveGState(context); FillRoundedRectangle(context, trackBounds, 1.5, trackColor); CGContextClipToRect(context, clipBounds); if (state & (TTK_STATE_BACKGROUND | TTK_STATE_DISABLED)) { accentColor = isDark ? CGColorFromGray(darkInactiveTrack) : CGColorFromGray(lightInactiveTrack); } else { accentColor = CGCOLOR(controlAccentColor()); } FillRoundedRectangle(context, trackBounds, 1.5, accentColor); CGContextRestoreGState(context); DrawGrayButton(context, thumbBounds, &sliderDesign, state, tkwin); } /*---------------------------------------------------------------------- * +++ Drawing procedures for native widgets. * * The HIToolbox does not support Dark Mode, and apparently never will. * It also draws some widgets in discontinued older styles even when used * on new OS releases. So to make widgets look "native" we have to provide * analogues of the HIToolbox drawing functions to be used on newer systems. * We continue to use NIToolbox for older versions of the OS. * * Drawing the dark widgets requires NSColors that were introduced in OSX * 10.14, so we make some of these functions be no-ops when building on * systems older than 10.14. */ /*---------------------------------------------------------------------- * DrawButton -- * * This is a standalone drawing procedure which draws most types of macOS * buttons for newer OS releases. The button style is specified in the * "kind" field of a HIThemeButtonDrawInfo struct, although some of the * identifiers are not recognized by HIToolbox. */ static void DrawButton( CGRect bounds, HIThemeButtonDrawInfo info, Ttk_State state, CGContextRef context, Tk_Window tkwin) { ThemeButtonKind kind = info.kind; ThemeDrawState drawState = info.state; CGRect arrowBounds = bounds = CGRectInset(bounds, 1, 1); int hasIndicator, isDark = TkMacOSXInDarkMode(tkwin); switch (kind) { case TkRoundedRectButton: DrawGrayButton(context, bounds, &roundedrectDesign, state, tkwin); break; case TkInlineButton: DrawGrayButton(context, bounds, &inlineDesign, state, tkwin); break; case TkRecessedButton: DrawGrayButton(context, bounds, &recessedDesign, state, tkwin); break; case kThemeRoundedBevelButton: DrawGrayButton(context, bounds, &bevelDesign, state, tkwin); break; case kThemePushButton: /* * The TTK_STATE_ALTERNATE bit means -default active. Apple only * indicates the default state (which means that the key equivalent is * "\n") for Push Buttons. */ if ((state & TTK_STATE_PRESSED || state & TTK_STATE_ALTERNATE) && !(state & TTK_STATE_BACKGROUND)) { DrawAccentedButton(context, bounds, &pushbuttonDesign, state, isDark); } else { DrawGrayButton(context, bounds, &pushbuttonDesign, state, tkwin); } break; case kThemeRoundButtonHelp: DrawGrayButton(context, bounds, &helpDesign, state, tkwin); DrawHelpSymbol(context, bounds, state); break; case kThemePopupButton: drawState = 0; DrawGrayButton(context, bounds, &popupDesign, state, tkwin); arrowBounds.size.width = 17; arrowBounds.origin.x += bounds.size.width - 17; if (!(state & TTK_STATE_BACKGROUND) && !(state & TTK_STATE_DISABLED)) { CGRect popupBounds = arrowBounds; /* * Allow room for nonexistent focus ring. */ popupBounds.size.width += 4; popupBounds.origin.y -= 4; popupBounds.size.height += 8; DrawAccentedSegment(context, popupBounds, &popupDesign, state, tkwin); drawState = BOTH_ARROWS; } arrowBounds.origin.x += 2; DrawUpDownArrows(context, arrowBounds, 3, 7, 2, state, drawState); break; case kThemeComboBox: if (state & TTK_STATE_DISABLED) { // Need to add the disabled case to entryDesign. DrawEntry(context, bounds, &entryDesign, state, tkwin); } else { DrawEntry(context, bounds, &entryDesign, state, tkwin); } arrowBounds.size.width = 17; if (state & TTK_STATE_BACKGROUND) { arrowBounds.origin.x += bounds.size.width - 20; arrowBounds.size.width += 4; arrowBounds.origin.y -= 1; } else { arrowBounds.origin.y -= 1; arrowBounds.origin.x += bounds.size.width - 20; arrowBounds.size.width += 4; arrowBounds.size.height += 2; } DrawAccentedSegment(context, arrowBounds, &comboDesign, state, tkwin); if (!(state & TTK_STATE_BACKGROUND)) { state |= TTK_STATE_IS_ACCENTED; } DrawDownArrow(context, arrowBounds, 6, 6, state); break; case kThemeCheckBox: bounds = CGRectOffset(CGRectMake(0, bounds.size.height / 2 - 8, 16, 16), bounds.origin.x, bounds.origin.y); bounds = CGRectInset(bounds, 1, 1); hasIndicator = state & TTK_STATE_SELECTED || state & TTK_STATE_ALTERNATE; if (hasIndicator && !(state & TTK_STATE_BACKGROUND) && !(state & TTK_STATE_DISABLED)) { DrawAccentedButton(context, bounds, &checkDesign, 0, isDark); } else { DrawGrayButton(context, bounds, &checkDesign, state, tkwin); } if (hasIndicator) { DrawCheckIndicator(context, bounds, state, isDark); } break; case kThemeRadioButton: bounds = CGRectOffset(CGRectMake(0, bounds.size.height / 2 - 9, 18, 18), bounds.origin.x, bounds.origin.y); bounds = CGRectInset(bounds, 1, 1); hasIndicator = state & TTK_STATE_SELECTED || state & TTK_STATE_ALTERNATE; if (hasIndicator && !(state & TTK_STATE_BACKGROUND) && !(state & TTK_STATE_DISABLED)) { DrawAccentedButton(context, bounds, &radioDesign, 0, isDark); } else { DrawGrayButton(context, bounds, &radioDesign, state, tkwin); } if (hasIndicator) { DrawRadioIndicator(context, bounds, state, isDark); } break; case kThemeArrowButton: DrawGrayButton(context, bounds, &pushbuttonDesign, state, tkwin); arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 17; arrowBounds.size.width = 16; arrowBounds.origin.y -= 1; if (state & TTK_STATE_SELECTED) { DrawUpArrow(context, arrowBounds, 5, 6, state); } else { DrawDownArrow(context, arrowBounds, 5, 6, state); } break; case kThemeIncDecButton: DrawGrayButton(context, bounds, &incdecDesign, state, tkwin); if (state & TTK_STATE_PRESSED) { CGRect clip; if (drawState == kThemeStatePressedDown) { clip = bounds; clip.size.height /= 2; clip.origin.y += clip.size.height; bounds.size.height += 1; clip.size.height += 1; } else { clip = bounds; clip.size.height /= 2; } CGContextSaveGState(context); CGContextClipToRect(context, clip); DrawAccentedButton(context, bounds, &incdecDesign, 0, isDark); CGContextRestoreGState(context); } { CGFloat inset = (bounds.size.width - 5) / 2; DrawUpDownArrows(context, bounds, inset, 5, 3, state, drawState); } break; default: break; } } /*---------------------------------------------------------------------- * DrawGroupBox -- * * This is a standalone drawing procedure which draws the contrasting rounded * rectangular box for LabelFrames and Notebook panes used in more recent * versions of macOS. Normally the contrast is set to one, since the nesting * level of the Group Box is higher by 1 compared to its container. But we * allow higher contrast for special cases, notably notebook tabs in macOS 11. * The save parameter is passed to GetBackgroundColor and should probably be * NO in such special cases. */ static void DrawGroupBox( CGRect bounds, CGContextRef context, Tk_Window tkwin, int contrast, Bool save) { CHECK_RADIUS(5, bounds) CGPathRef path; CGColorRef backgroundColor, borderColor; backgroundColor = GetBackgroundCGColor(context, tkwin, contrast, save); borderColor = CGColorFromGray(boxBorder); CGContextSetFillColorWithColor(context, backgroundColor); path = CGPathCreateWithRoundedRect(bounds, 5, 5, NULL); CGContextClipToRect(context, bounds); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextFillPath(context); CGContextSetFillColorWithColor(context, borderColor); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextReplacePathWithStrokedPath(context); CGContextFillPath(context); CFRelease(path); } /*---------------------------------------------------------------------- * DrawListHeader -- * * This is a standalone drawing procedure which draws column headers for a * Treeview in the Aqua appearance. (The HIToolbox headers have not matched the * native ones since OSX 10.8) Note that the header image is ignored, but we * draw arrows according to the state. */ static void DrawListHeader( CGRect bounds, CGContextRef context, Tk_Window tkwin, int state) { int isDark = TkMacOSXInDarkMode(tkwin); CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; CGPoint top[2] = {{x, y + 1}, {x + w, y + 1}}; CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; CGPoint separator[2] = {{x + w - 1, y + 3}, {x + w - 1, y + h - 3}}; CGColorRef strokeColor, backgroundColor; /* * Apple changes the background color of a list header when the window is * not active. But Ttk does not indicate that in the state of a * TreeHeader. So we have to query the Apple window manager. */ NSWindow *win = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin)); if (!isDark) { GrayColor bgGray = [win isKeyWindow] ? listheaderActiveBG : listheaderInactiveBG; backgroundColor = CGColorFromGray(bgGray); } CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); if (!isDark) { CGContextBeginPath(context); CGContextSetFillColorWithColor(context, backgroundColor); CGContextAddRect(context, bounds); CGContextFillPath(context); } strokeColor = isDark ? CGColorFromGray(darkListheaderBorder) : CGColorFromGray(listheaderSeparator); CGContextSetStrokeColorWithColor(context, strokeColor); CGContextAddLines(context, separator, 2); CGContextStrokePath(context); strokeColor = isDark ? CGColorFromGray(darkListheaderBorder) : CGColorFromGray(lightListheaderBorder); CGContextSetStrokeColorWithColor(context, strokeColor); CGContextAddLines(context, top, 2); CGContextStrokePath(context); CGContextAddLines(context, bottom, 2); CGContextStrokePath(context); CGContextRestoreGState(context); if (state & TTK_TREEVIEW_STATE_SORTARROW) { CGRect arrowBounds = bounds; arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { DrawUpArrow(context, arrowBounds, 3, 8, state); } else if (state & TTK_STATE_SELECTED) { DrawDownArrow(context, arrowBounds, 3, 8, state); } } } /*---------------------------------------------------------------------- * DrawTab -- * * This is a standalone drawing procedure which draws Tabbed Pane Tabs for the * notebook widget. */ static void DrawTab( CGRect bounds, Ttk_State state, CGContextRef context, Tk_Window tkwin) { CGRect originalBounds = bounds; CGColorRef strokeColor; int OSVersion = [NSApp macOSVersion]; /* * Extend the bounds to one or both sides so the rounded part will be * clipped off if the right of the left tab, the left of the right tab, * and both sides of the middle tabs. */ CGContextClipToRect(context, bounds); if (OSVersion < 110000 || !(state & TTK_STATE_SELECTED)) { if (!(state & TTK_STATE_FIRST_TAB)) { bounds.origin.x -= 10; bounds.size.width += 10; } if (!(state & TTK_STATE_LAST_TAB)) { bounds.size.width += 10; } } /* * Fill the tab face with the appropriate color or gradient. Use a solid * color if the tab is not selected, otherwise use the accent color with * highlights */ if (!(state & TTK_STATE_SELECTED)) { DrawGrayButton(context, bounds, &tabDesign, state, tkwin); /* * Draw a separator line on the left side of the tab if it * not first. */ if (!(state & TTK_STATE_FIRST_TAB)) { CGContextSaveGState(context); strokeColor = CGColorFromGray(darkTabSeparator); CGContextSetStrokeColorWithColor(context, strokeColor); CGContextBeginPath(context); CGContextMoveToPoint(context, originalBounds.origin.x, originalBounds.origin.y + 1); CGContextAddLineToPoint(context, originalBounds.origin.x, originalBounds.origin.y + originalBounds.size.height - 1); CGContextStrokePath(context); CGContextRestoreGState(context); } } else { /* * This is the selected tab; paint it with the current accent color. * If it is first, cover up the separator line drawn by the second one. * (The selected tab is always drawn last.) */ if ((state & TTK_STATE_FIRST_TAB) && !(state & TTK_STATE_LAST_TAB)) { bounds.size.width += 1; } if (!(state & TTK_STATE_BACKGROUND)) { DrawAccentedButton(context, bounds, &tabDesign, 0, 0); } else { DrawGrayButton(context, bounds, &tabDesign, state, tkwin); } } } static void DrawTab11( CGRect bounds, Ttk_State state, CGContextRef context, Tk_Window tkwin) { if (state & TTK_STATE_SELECTED) { DrawGrayButton(context, bounds, &pushbuttonDesign, state, tkwin); } else { CGRect clipRect = bounds; /* * Draw a segment of a Group Box as a background for non-selected tabs. * Clip the Group Box so that the segments fit together to form a long * rounded rectangle behind the entire tab bar. */ if (!(state & TTK_STATE_FIRST_TAB)) { clipRect.origin.x -= 5; bounds.origin.x -= 5; bounds.size.width += 5; } if (!(state & TTK_STATE_LAST_TAB)) { clipRect.size.width += 5; bounds.size.width += 5; } CGContextSaveGState(context); CGContextClipToRect(context, clipRect); DrawGroupBox(bounds, context, tkwin, 3, NO); CGContextRestoreGState(context); } } /*---------------------------------------------------------------------- * DrawDarkSeparator -- * * This is a standalone drawing procedure which draws a separator widget * in Dark Mode. HIToolbox is used in light mode. */ static void DrawDarkSeparator( CGRect bounds, CGContextRef context, TCL_UNUSED(Tk_Window)) { CGColorRef sepColor = CGColorFromGray(darkSeparator); CGContextSetFillColorWithColor(context, sepColor); CGContextFillRect(context, bounds); } /*---------------------------------------------------------------------- * +++ DrawGradientButton -- * * This is a standalone drawing procedure which draws a * a Gradient Button. */ static void DrawGradientBorder( CGRect bounds, CGContextRef context, Tk_Window tkwin, Ttk_State state) { CGColorRef faceColor, borderColor; GrayColor faceGray, borderGray; CGRect inside = CGRectInset(bounds, 1, 1); if (TkMacOSXInDarkMode(tkwin)) { if (state & TTK_STATE_DISABLED) { faceGray = darkGradientDisabled; borderGray = darkGradientBorderDisabled; } else { faceGray = state & TTK_STATE_PRESSED ? darkGradientPressed : darkGradientNormal; borderGray = darkGradientBorder; } } else { if (state & TTK_STATE_DISABLED) { faceGray = lightGradientDisabled; borderGray = lightGradientBorderDisabled; } else { faceGray = state & TTK_STATE_PRESSED ? lightGradientPressed : lightGradientNormal; borderGray = lightGradientBorder; } } faceColor = CGColorFromGray(faceGray); borderColor = CGColorFromGray(borderGray); CGContextSetFillColorWithColor(context, faceColor); CGContextFillRect(context, inside); CGContextSetFillColorWithColor(context, borderColor); CGContextAddRect(context, bounds); CGContextAddRect(context, inside); CGContextEOFillPath(context); } /*---------------------------------------------------------------------- * +++ Button elements. */ static void ButtonElementMinSize( void *clientData, int *minWidth, int *minHeight) { ThemeButtonParams *params = (ThemeButtonParams *)clientData; if (params->heightMetric != NoThemeMetric) { ChkErr(GetThemeMetric, params->heightMetric, minHeight); /* * The theme height does not include the 1-pixel border around * the button, although it does include the 1-pixel shadow at * the bottom. */ *minHeight += 2; /* * For buttons with labels the minwidth must be 0 to force the * correct text layout. For example, a non-zero value will cause the * text to be left justified, no matter what -anchor setting is used in * the style. */ if (params->widthMetric != NoThemeMetric) { ChkErr(GetThemeMetric, params->widthMetric, minWidth); *minWidth += 2; *minHeight += 2; } else { *minWidth = 0; } } } static void ButtonElementSize( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { ThemeButtonParams *params = (ThemeButtonParams *)clientData; HIThemeButtonDrawInfo info = ComputeButtonDrawInfo(params, 0, tkwin); static const CGRect scratchBounds = {{0, 0}, {100, 100}}; CGRect contentBounds, backgroundBounds; int verticalPad; ButtonElementMinSize(clientData, minWidth, minHeight); switch (info.kind) { case TkGradientButton: *paddingPtr = Ttk_MakePadding(1, 1, 1, 1); /* Fall through. */ case kThemeArrowButton: case kThemeRoundButtonHelp: return; /* Buttons which are sized like PushButtons but unknown to HITheme. */ case TkRoundedRectButton: case TkRecessedButton: case TkInlineButton: info.kind = kThemePushButton; break; default: break; } /* * Given a hypothetical bounding rectangle for a button, HIToolbox will * compute a bounding rectangle for the button contents and a bounding * rectangle for the button background. The background bounds are large * enough to contain the image of the button in any state, which might * include highlight borders, shadows, etc. The content rectangle is not * centered vertically within the background rectangle, presumably because * shadows only appear on the bottom. Nonetheless, when HIToolbox is asked * to draw a button with a certain bounding rectangle it draws the button * centered within the rectangle. * * To compute the effective padding around a button we request the * content and bounding rectangles for a 100x100 button and use the * padding between those. However, we symmetrize the padding on the * top and bottom, because that is how the button will be drawn. */ ChkErr(HIThemeGetButtonContentBounds, &scratchBounds, &info, &contentBounds); ChkErr(HIThemeGetButtonBackgroundBounds, &scratchBounds, &info, &backgroundBounds); paddingPtr->left = contentBounds.origin.x - backgroundBounds.origin.x; paddingPtr->right = CGRectGetMaxX(backgroundBounds) - CGRectGetMaxX(contentBounds); verticalPad = backgroundBounds.size.height - contentBounds.size.height; paddingPtr->top = paddingPtr->bottom = verticalPad / 2; if (info.kind == kThemePopupButton) { paddingPtr->top += 1; paddingPtr->bottom -= 1; } } static void ButtonElementDraw( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeButtonParams *params = (ThemeButtonParams *)clientData; CGRect bounds = BoxToRect(d, b); HIThemeButtonDrawInfo info = ComputeButtonDrawInfo(params, state, tkwin); int isDark = TkMacOSXInDarkMode(tkwin); switch (info.kind) { /* * A Gradient Button should have an image and no text. The size is set to * that of the image. All we need to do is draw a 1-pixel border. */ case TkGradientButton: BEGIN_DRAWING(d) DrawGradientBorder(bounds, dc.context, tkwin, state); END_DRAWING return; /* * Buttons with no height restrictions are ready to draw. */ case kThemeArrowButton: case kThemeCheckBox: case kThemeRadioButton: break; /* * Other buttons have a maximum height. We have to deal with that. */ default: bounds = NormalizeButtonBounds(params, bounds, isDark); break; } /* We do our own drawing on new systems.*/ if ([NSApp macOSVersion] > 100800) { BEGIN_DRAWING(d) DrawButton(bounds, info, state, dc.context, tkwin); END_DRAWING return; } /* * If execution reaches here it means we should use HIToolbox to draw the * button. Buttons that HIToolbox doesn't know are rendered as * PushButtons. */ switch (info.kind) { case TkRoundedRectButton: case TkRecessedButton: info.kind = kThemePushButton; break; default: break; } /* * Apple's PushButton and PopupButton do not change their fill color * when the window is inactive. However, except in 10.7 (Lion), the * color of the arrow button on a PopupButton does change. For some * reason HITheme fills inactive buttons with a transparent color that * allows the window background to show through, leading to * inconsistent behavior. We work around this by filling behind an * inactive PopupButton with a text background color before asking * HIToolbox to draw it. For PushButtons, we simply draw them in the * active state. */ BEGIN_DRAWING(d) if (info.kind == kThemePopupButton && (state & TTK_STATE_BACKGROUND)) { CGRect innerBounds = CGRectInset(bounds, 1, 1); FillRoundedRectangle(dc.context, innerBounds, 4, CG_WHITE); } /* * A BevelButton with mixed value is drawn borderless, which does make * much sense for us. */ if (info.kind == kThemeRoundedBevelButton && info.value == kThemeButtonMixed) { info.value = kThemeButtonOff; info.state = kThemeStateInactive; } if (info.kind == kThemePushButton) { bounds.origin.y -= 2; } ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); END_DRAWING } static Ttk_ElementSpec ButtonElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, ButtonElementSize, ButtonElementDraw }; /*---------------------------------------------------------------------- * +++ Notebook elements. */ /* Tab position logic, c.f. ttkNotebook.c TabState() */ static const Ttk_StateTable TabStyleTable[] = { {kThemeTabFrontInactive, TTK_STATE_SELECTED | TTK_STATE_BACKGROUND, 0}, {kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND, 0}, {kThemeTabFrontUnavailable, TTK_STATE_DISABLED | TTK_STATE_SELECTED, 0}, {kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED, 0}, {kThemeTabFront, TTK_STATE_SELECTED, 0}, {kThemeTabNonFrontPressed, TTK_STATE_PRESSED, 0}, {kThemeTabNonFront, 0, 0} }; static const Ttk_StateTable TabAdornmentTable[] = { {kHIThemeTabAdornmentNone, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB, 0}, {kHIThemeTabAdornmentTrailingSeparator, TTK_STATE_FIRST_TAB, 0}, {kHIThemeTabAdornmentNone, TTK_STATE_LAST_TAB, 0}, {kHIThemeTabAdornmentTrailingSeparator, 0, 0}, }; static const Ttk_StateTable TabPositionTable[] = { {kHIThemeTabPositionOnly, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB, 0}, {kHIThemeTabPositionFirst, TTK_STATE_FIRST_TAB, 0}, {kHIThemeTabPositionLast, TTK_STATE_LAST_TAB, 0}, {kHIThemeTabPositionMiddle, 0, 0}, }; /* |
︙ | ︙ | |||
1568 1569 1570 1571 1572 1573 1574 | * * <URL: http://developer.apple.com/documentation/userexperience/Conceptual/ * AppleHIGuidelines/XHIGControls/XHIGControls.html#//apple_ref/doc/uid/ * TP30000359-TPXREF116> */ static void TabElementSize( | | | | | | < | < | | > > > > > > | | | | | | | | | < < < < < | | | | | | | | | 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 | * * <URL: http://developer.apple.com/documentation/userexperience/Conceptual/ * AppleHIGuidelines/XHIGControls/XHIGControls.html#//apple_ref/doc/uid/ * TP30000359-TPXREF116> */ static void TabElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ TCL_UNUSED(int *), /* minWidth */ TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(0, -2, 0, 1); } static void TabElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); BEGIN_DRAWING(d) if ([NSApp macOSVersion] >= 110000) { DrawTab11(bounds, state, dc.context, tkwin); } else if ([NSApp macOSVersion] > 100800) { DrawTab(bounds, state, dc.context, tkwin); } else { HIThemeTabDrawInfo info = { .version = 1, .style = Ttk_StateTableLookup(TabStyleTable, state), .direction = kThemeTabNorth, .size = kHIThemeTabSizeNormal, .adornment = Ttk_StateTableLookup(TabAdornmentTable, state), .kind = kHIThemeTabKindNormal, .position = Ttk_StateTableLookup(TabPositionTable, state), }; ChkErr(HIThemeDrawTab, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TabElementSize, TabElementDraw }; /* * Notebook panes: */ static void PaneElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ TCL_UNUSED(int *), /* minWidth */ TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(9, 5, 9, 9); } static void PaneElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); bounds.origin.y -= kThemeMetricTabFrameOverlap; bounds.size.height += kThemeMetricTabFrameOverlap; BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { DrawGroupBox(bounds, dc.context, tkwin, 1, YES); } else { HIThemeTabPaneDrawInfo info = { .version = 1, .state = Ttk_StateTableLookup(ThemeStateTable, state), .direction = kThemeTabNorth, .size = kHIThemeTabSizeNormal, .kind = kHIThemeTabKindNormal, |
︙ | ︙ | |||
1678 1679 1680 1681 1682 1683 1684 | /*---------------------------------------------------------------------- * +++ Labelframe elements -- * * Labelframe borders: Use "primary group box ..." Quoth * DrawThemePrimaryGroup reference: "The primary group box frame is drawn * inside the specified rectangle and is a maximum of 2 pixels thick." * | < < | | | | | | | | | | 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 | /*---------------------------------------------------------------------- * +++ Labelframe elements -- * * Labelframe borders: Use "primary group box ..." Quoth * DrawThemePrimaryGroup reference: "The primary group box frame is drawn * inside the specified rectangle and is a maximum of 2 pixels thick." * */ static void GroupElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ TCL_UNUSED(int *), /* minWidth */ TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(0, 0, 0, 0); } static void GroupElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { DrawGroupBox(bounds, dc.context, tkwin, 1, YES); } else { const HIThemeGroupBoxDrawInfo info = { .version = 0, .state = Ttk_StateTableLookup(ThemeStateTable, state), .kind = kHIThemeGroupBoxKindPrimaryOpaque, }; ChkErr(HIThemeDrawGroupBox, &bounds, &info, dc.context, HIOrientation); |
︙ | ︙ | |||
1748 1749 1750 1751 1752 1753 1754 | offsetof(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND}, {"-fieldbackground", TK_OPTION_BORDER, offsetof(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void EntryElementSize( | | | | | | | | | | > > | | | < < < | < < < | < < < < < < < | < < | | > > > > | | | 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 | offsetof(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND}, {"-fieldbackground", TK_OPTION_BORDER, offsetof(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void EntryElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ TCL_UNUSED(int *), /* minWidth */ TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { *paddingPtr = entryElementPadding; } static void EntryElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { EntryElement *e = (EntryElement *)elementRecord; ThemeFrameParams *params = (ThemeFrameParams *)clientData; HIThemeFrameKind kind = params ? params->kind : kHIThemeFrameTextFieldSquare; CGRect bounds = BoxToRect(d, b); CGColorRef background; Tk_3DBorder backgroundPtr = NULL; static const char *defaultBG = ENTRY_DEFAULT_BACKGROUND; if ([NSApp macOSVersion] > 100800) { BEGIN_DRAWING(d) switch(kind) { case kHIThemeFrameTextFieldRound: DrawEntry(dc.context, bounds, &searchDesign, state, tkwin); break; case kHIThemeFrameTextFieldSquare: DrawEntry(dc.context, bounds, &entryDesign, state, tkwin); break; default: return; } END_DRAWING } else { const HIThemeFrameDrawInfo info = { .version = 0, .kind = params->kind, .state = Ttk_StateTableLookup(ThemeStateTable, state), .isFocused = state & TTK_STATE_FOCUS, }; /* * Earlier versions of the Aqua theme ignored the -fieldbackground * option and used the -background as if it were -fieldbackground. |
︙ | ︙ | |||
1823 1824 1825 1826 1827 1828 1829 | Tk_Get3DBorderFromObj(tkwin, e->fieldbackgroundObj); } else if (0 != strcmp(Tcl_GetString(e->backgroundObj), defaultBG)) { backgroundPtr = Tk_Get3DBorderFromObj(tkwin, e->backgroundObj); } if (backgroundPtr != NULL) { XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), | | | | | 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 | Tk_Get3DBorderFromObj(tkwin, e->fieldbackgroundObj); } else if (0 != strcmp(Tcl_GetString(e->backgroundObj), defaultBG)) { backgroundPtr = Tk_Get3DBorderFromObj(tkwin, e->backgroundObj); } if (backgroundPtr != NULL) { XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), b.x, b.y, b.width, b.height); } BEGIN_DRAWING(d) if (backgroundPtr == NULL) { if ([NSApp macOSVersion] > 100800) { background = CGCOLOR([NSColor textBackgroundColor]); CGContextSetFillColorWithColor(dc.context, background); } else { CGContextSetRGBFillColor(dc.context, 1.0, 1.0, 1.0, 1.0); } CGContextFillRect(dc.context, bounds); } ChkErr(HIThemeDrawFrame, &bounds, &info, dc.context, HIOrientation); END_DRAWING |
︙ | ︙ | |||
1868 1869 1870 1871 1872 1873 1874 | * rectangle. Measurement indicates that the arrow button has width 18. * * With no help available from HIToolbox, we have to use hard-wired * constants for the padding. We shift the bounding rectangle downward by * 1 pixel to account for the fact that the button is not centered. */ | > | | | | | | | < < < < | < < < | | | > > > < | 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 | * rectangle. Measurement indicates that the arrow button has width 18. * * With no help available from HIToolbox, we have to use hard-wired * constants for the padding. We shift the bounding rectangle downward by * 1 pixel to account for the fact that the button is not centered. */ // OS dependent ??? static Ttk_Padding ComboboxPadding = {7, 5, 24, 5}; static void ComboboxElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *minWidth = 24; *minHeight = 0; *paddingPtr = ComboboxPadding; } static void ComboboxElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); const HIThemeButtonDrawInfo info = { .version = 0, .state = Ttk_StateTableLookup(ThemeStateTable, state), .kind = kThemeComboBox, .value = Ttk_StateTableLookup(ButtonValueTable, state), .adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state), }; BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { bounds = CGRectInset(bounds, -1, -1); DrawButton(bounds, info, state, dc.context, tkwin); } else { bounds.origin.y += 1; ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec ComboboxElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, |
︙ | ︙ | |||
1946 1947 1948 1949 1950 1951 1952 | * pressed draws the IncDecButton in its "pressed up" state. NOTE: This * means that when the down button is pressed the IncDecButton will be * drawn twice, first in unpressed state by the up arrow and then in * "pressed down" state by the down button. The drawing must be done in * that order. So the up button must be listed first in the layout. */ | | | > > > > > > > > > > > > > > > | | | | | | | > | | | < < < < < < < | < < < < < < < < | | > | | | | | | 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 | * pressed draws the IncDecButton in its "pressed up" state. NOTE: This * means that when the down button is pressed the IncDecButton will be * drawn twice, first in unpressed state by the up arrow and then in * "pressed down" state by the down button. The drawing must be done in * that order. So the up button must be listed first in the layout. */ static Ttk_Padding SpinbuttonMargins = {2, 0, 0, 0}; static void SpinButtonReBounds( Tk_Window tkwin, CGRect *bounds) { if (TkMacOSXInDarkMode(tkwin)) { bounds->origin.x -= 2; bounds->origin.y += 1; bounds->size.height -= 0.5; } else { bounds->origin.x -= 3; bounds->origin.y += 1; bounds->size.width += 1; } } static void SpinButtonElementSize( TCL_UNUSED(void *), /* clientdata */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* PaddingPtr */ { SInt32 s; ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s); *minWidth = s + Ttk_PaddingWidth(SpinbuttonMargins); ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s); *minHeight = 2 + (s + Ttk_PaddingHeight(SpinbuttonMargins)) / 2; } static void SpinButtonUpElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, Ttk_PadBox(b, SpinbuttonMargins)); int infoState; SpinButtonReBounds(tkwin, &bounds); bounds.size.height *= 2; if (state & TTK_STATE_PRESSED) { infoState = kThemeStatePressedUp; } else { infoState = Ttk_StateTableLookup(ThemeStateTable, state); } const HIThemeButtonDrawInfo info = { .version = 0, .state = infoState, .kind = kThemeIncDecButton, .value = Ttk_StateTableLookup(ButtonValueTable, state), .adornment = kThemeAdornmentNone, }; BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { DrawButton(bounds, info, state, dc.context, tkwin); } else { ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec SpinButtonUpElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SpinButtonElementSize, SpinButtonUpElementDraw }; static void SpinButtonDownElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, Ttk_PadBox(b, SpinbuttonMargins)); int infoState = 0; SpinButtonReBounds(tkwin, &bounds); bounds.origin.y -= bounds.size.height; bounds.size.height += bounds.size.height; if (state & TTK_STATE_PRESSED) { infoState = kThemeStatePressedDown; } else { return; } const HIThemeButtonDrawInfo info = { .version = 0, .state = infoState, .kind = kThemeIncDecButton, .value = Ttk_StateTableLookup(ButtonValueTable, state), .adornment = kThemeAdornmentNone, }; BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { DrawButton(bounds, info, state, dc.context, tkwin); } else { ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec SpinButtonDownElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SpinButtonElementSize, SpinButtonDownElementDraw }; /*---------------------------------------------------------------------- * +++ DrawThemeTrack-based elements -- * * Progress bars and scales. (See also: <<NOTE-TRACKS>>) */ /* * Apple does not change the appearance of a slider when the window becomes * inactive. So we shouldn't either. */ static const Ttk_StateTable ThemeTrackEnableTable[] = { {kThemeTrackDisabled, TTK_STATE_DISABLED, 0}, {kThemeTrackActive, TTK_STATE_BACKGROUND, 0}, {kThemeTrackActive, 0, 0} /* { kThemeTrackNothingToScroll, ?, ? }, */ }; typedef struct { /* TrackElement client data */ |
︙ | ︙ | |||
2108 2109 2110 2111 2112 2113 2114 | {"-to", TK_OPTION_DOUBLE, offsetof(TrackElement, toObj), NULL}, {"-value", TK_OPTION_DOUBLE, offsetof(TrackElement, valueObj), NULL}, {"-orient", TK_OPTION_STRING, offsetof(TrackElement, orientObj), NULL}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TrackElementSize( void *clientData, | | | | | | | | < < < < < | | | | | | | | < > | | < < < | < > | > | | | > | 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 | {"-to", TK_OPTION_DOUBLE, offsetof(TrackElement, toObj), NULL}, {"-value", TK_OPTION_DOUBLE, offsetof(TrackElement, valueObj), NULL}, {"-orient", TK_OPTION_STRING, offsetof(TrackElement, orientObj), NULL}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TrackElementSize( void *clientData, TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { TrackElementData *data = (TrackElementData *)clientData; SInt32 size = 24; /* reasonable default ... */ ChkErr(GetThemeMetric, data->thicknessMetric, &size); *minWidth = *minHeight = size; } static void TrackElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TrackElementData *data = (TrackElementData *)clientData; TrackElement *elem = (TrackElement *)elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; double from = 0, to = 100, value = 0, fraction, max; CGRect bounds = BoxToRect(d, b); TtkGetOrientFromObj(NULL, elem->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); Tcl_GetDoubleFromObj(NULL, elem->toObj, &to); Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value); fraction = (value - from) / (to - from); max = RangeToFactor(fabs(to - from)); HIThemeTrackDrawInfo info = { .version = 0, .kind = data->kind, .bounds = bounds, .min = 0, .max = max, .value = fraction * max, .attributes = kThemeTrackShowThumb | (orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0), .enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state), .trackInfo.progress.phase = 0 }; if (info.kind == kThemeSlider) { info.trackInfo.slider.pressState = state & TTK_STATE_PRESSED ? kThemeThumbPressed : 0; if (state & TTK_STATE_ALTERNATE) { info.trackInfo.slider.thumbDir = kThemeThumbDownward; } else { info.trackInfo.slider.thumbDir = kThemeThumbPlain; } } BEGIN_DRAWING(d) if (([NSApp macOSVersion] > 100800) && !(state & TTK_STATE_ALTERNATE)) { /* * We use the reserved field to indicate whether "from" is less than * "to". It should be 0 if passing the info to HIThemeDrawInfo, but * we aren't doing that. */ info.reserved = (from < to); DrawSlider(dc.context, bounds, info, state, tkwin); } else { ChkErr(HIThemeDrawTrack, &info, NULL, dc.context, HIOrientation); } END_DRAWING } static Ttk_ElementSpec TrackElementSpec = { TK_STYLE_VERSION_2, sizeof(TrackElement), TrackElementOptions, |
︙ | ︙ | |||
2206 2207 2208 2209 2210 2211 2212 | * Has geometry only. The Scale widget adjusts the position of this element, * and uses it for hit detection. In the Aqua theme, the slider is actually * drawn as part of the trough element. * */ static void SliderElementSize( | | | | | | 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 | * Has geometry only. The Scale widget adjusts the position of this element, * and uses it for hit detection. In the Aqua theme, the slider is actually * drawn as part of the trough element. * */ static void SliderElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { *minWidth = *minHeight = 24; } static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), |
︙ | ︙ | |||
2254 2255 2256 2257 2258 2259 2260 | {"-phase", TK_OPTION_INT, offsetof(PbarElement, phaseObj), "0"}, {"-mode", TK_OPTION_STRING, offsetof(PbarElement, modeObj), "determinate"}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void PbarElementSize( | | | | | | | | | > > | > | < | > > > | > > > | < < < | | | < < < < < < | < < | < | 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 | {"-phase", TK_OPTION_INT, offsetof(PbarElement, phaseObj), "0"}, {"-mode", TK_OPTION_STRING, offsetof(PbarElement, modeObj), "determinate"}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void PbarElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { SInt32 size = 24; /* @@@ Check HIG for correct default */ ChkErr(GetThemeMetric, kThemeMetricLargeProgressBarThickness, &size); *minWidth = *minHeight = size; } static void PbarElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { PbarElement *pbar = (PbarElement *)elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; int phase; double value = 0, maximum = 100, factor; CGRect bounds = BoxToRect(d, b); int isIndeterminate = !strcmp("indeterminate", Tcl_GetString(pbar->modeObj)); TtkGetOrientFromObj(NULL, pbar->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); if (isIndeterminate) { /* * When an indeterminate progress bar is animated the phase is * (currently) always 0 and the value increases from min to max * and then decreases back to min. We scale the value by 3 to * speed the animation up a bit. */ double remainder = fmod(3*value, 2*maximum); value = remainder > maximum ? 2*maximum - remainder : remainder; } factor = RangeToFactor(maximum); HIThemeTrackDrawInfo info = { .version = 0, .kind = isIndeterminate? kThemeIndeterminateBar : kThemeProgressBar, .bounds = bounds, .min = 0, .max = maximum * factor, .value = value * factor, .attributes = kThemeTrackShowThumb | (orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0), .enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state), .trackInfo.progress.phase = phase, }; BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { DrawProgressBar(dc.context, bounds, info, state, tkwin); } else { ChkErr(HIThemeDrawTrack, &info, NULL, dc.context, HIOrientation); } END_DRAWING } static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, sizeof(PbarElement), PbarElementOptions, |
︙ | ︙ | |||
2351 2352 2353 2354 2355 2356 2357 | static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { {"-orient", TK_OPTION_STRING, offsetof(ScrollbarElement, orientObj), "horizontal"}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TroughElementSize( | | | | < < < < < < < < < < < < < < | | | < | < < < < > | | | | | | | | < | > | > > > > | | | < < | | 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 | static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { {"-orient", TK_OPTION_STRING, offsetof(ScrollbarElement, orientObj), "horizontal"}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TroughElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; SInt32 thickness = 15; TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &thickness); if (orientation == TTK_ORIENT_HORIZONTAL) { *minHeight = thickness; if ([NSApp macOSVersion] > 100700) { *paddingPtr = Ttk_MakePadding(4, 4, 4, 3); } } else { *minWidth = thickness; if ([NSApp macOSVersion] > 100700) { *paddingPtr = Ttk_MakePadding(4, 4, 3, 4); } } } static void TroughElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) /* state */ { ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; CGRect bounds = BoxToRect(d, b); GrayColor bgGray; TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_HORIZONTAL) { bounds = CGRectInset(bounds, 0, 1); } else { bounds = CGRectInset(bounds, 1, 0); } BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { bgGray = TkMacOSXInDarkMode(tkwin) ? darkTrough : lightTrough; CGContextSetFillColorWithColor(dc.context, CGColorFromGray(bgGray)); } else { ChkErr(HIThemeSetFill, kThemeBrushDocumentWindowBackground, NULL, dc.context, HIOrientation); } CGContextFillRect(dc.context, bounds); END_DRAWING } static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, TroughElementSize, TroughElementDraw }; static void ThumbElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_VERTICAL) { *minHeight = 18; *minWidth = 8; } else { *minHeight = 8; *minWidth = 18; } } static void ThumbElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); /* * In order to make ttk scrollbars work correctly it is necessary to be * able to display the thumb element at the size and location which the ttk * scrollbar widget requests. The algorithm that HIToolbox uses to * determine the thumb geometry from the input values of min, max, value * and viewSize is undocumented. A seemingly natural algorithm is * implemented below. This code uses that algorithm for older OS versions, * because using HIToolbox also handles drawing the buttons and 3D thumb used * on those systems. For newer systems the cleanest approach is to just * draw the thumb directly. */ if ([NSApp macOSVersion] > 100800) { CGRect thumbBounds = BoxToRect(d, b); CGColorRef thumbColor; GrayColor bgGray; /* * Apple does not draw the thumb when scrolling is not possible. */ if ((orientation == TTK_ORIENT_HORIZONTAL && thumbBounds.size.width >= Tk_Width(tkwin) - 8) || (orientation == TTK_ORIENT_VERTICAL && thumbBounds.size.height >= Tk_Height(tkwin) - 8)) { return; } int isDark = TkMacOSXInDarkMode(tkwin); if ((state & TTK_STATE_PRESSED) || (state & TTK_STATE_HOVER)) { bgGray = isDark ? darkActiveThumb : lightActiveThumb; } else { bgGray = isDark ? darkInactiveThumb : lightInactiveThumb; } thumbColor = CGColorFromGray(bgGray); BEGIN_DRAWING(d) FillRoundedRectangle(dc.context, thumbBounds, 4, thumbColor); END_DRAWING } else { double thumbSize, trackSize, visibleSize, factor, fraction; MacDrawable *macWin = (MacDrawable *)Tk_WindowId(tkwin); CGRect troughBounds = {{macWin->xOff, macWin->yOff}, {Tk_Width(tkwin), Tk_Height(tkwin)}}; |
︙ | ︙ | |||
2570 2571 2572 2573 2574 2575 2576 | TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, ThumbElementSize, ThumbElementDraw }; static void ArrowElementSize( | | | | | | 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 | TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, ThumbElementSize, ThumbElementDraw }; static void ArrowElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { if ([NSApp macOSVersion] < 100800) { *minHeight = *minWidth = 14; } else { *minHeight = *minWidth = -1; } } |
︙ | ︙ | |||
2601 2602 2603 2604 2605 2606 2607 | * * DrawThemeSeparator() guesses the orientation of the line from the width * and height of the rectangle, so the same element can can be used for * horizontal, vertical, and general separators. */ static void SeparatorElementSize( | | | | | | | | 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 | * * DrawThemeSeparator() guesses the orientation of the line from the width * and height of the rectangle, so the same element can can be used for * horizontal, vertical, and general separators. */ static void SeparatorElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { *minWidth = *minHeight = 1; } static void SeparatorElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { CGRect bounds = BoxToRect(d, b); const HIThemeSeparatorDrawInfo info = { |
︙ | ︙ | |||
2653 2654 2655 2656 2657 2658 2659 | * +++ Size grip elements -- (obsolete) */ static const ThemeGrowDirection sizegripGrowDirection = kThemeGrowRight | kThemeGrowDown; static void SizegripElementSize( | | | | | | | | | 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 | * +++ Size grip elements -- (obsolete) */ static const ThemeGrowDirection sizegripGrowDirection = kThemeGrowRight | kThemeGrowDown; static void SizegripElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { HIThemeGrowBoxDrawInfo info = { .version = 0, .state = kThemeStateActive, .kind = kHIThemeGrowBoxKindNormal, .direction = sizegripGrowDirection, .size = kHIThemeGrowBoxSizeNormal, }; CGRect bounds = CGRectZero; ChkErr(HIThemeGetGrowBoxBounds, &bounds.origin, &info, &bounds); *minWidth = bounds.size.width; *minHeight = bounds.size.height; } static void SizegripElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ Drawable d, Ttk_Box b, unsigned int state) { CGRect bounds = BoxToRect(d, b); HIThemeGrowBoxDrawInfo info = { .version = 0, |
︙ | ︙ | |||
2752 2753 2754 2755 2756 2757 2758 | * the coordinate system of the top-level window. Apparently failing to * do this used to cause graphics anomalies when drawing into an * off-screen graphics port. The code for handling this is currently * commented out. */ static void FillElementDraw( | | | < | < | < < < | < | 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 | * the coordinate system of the top-level window. Apparently failing to * do this used to cause graphics anomalies when drawing into an * off-screen graphics port. The code for handling this is currently * commented out. */ static void FillElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); if ([NSApp macOSVersion] > 100800) { CGColorRef bgColor; BEGIN_DRAWING(d) bgColor = GetBackgroundCGColor(dc.context, tkwin, NO, 0); CGContextSetFillColorWithColor(dc.context, bgColor); CGContextFillRect(dc.context, bounds); END_DRAWING } else { ThemeBrush brush = (state & TTK_STATE_BACKGROUND) ? kThemeBrushModelessDialogBackgroundInactive : kThemeBrushModelessDialogBackgroundActive; BEGIN_DRAWING(d) ChkErr(HIThemeSetFill, brush, NULL, dc.context, HIOrientation); CGContextFillRect(dc.context, bounds); END_DRAWING } } static void BackgroundElementDraw( void *clientData, |
︙ | ︙ | |||
2827 2828 2829 2830 2831 2832 2833 | * <URL: http://developer.apple.com/documentation/Carbon/Reference/ * Appearance_Manager/appearance_manager/constant_7.html#/ * /apple_ref/doc/uid/TP30000243/C005321> * */ static void ToolbarBackgroundElementDraw( | | | | 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 | * <URL: http://developer.apple.com/documentation/Carbon/Reference/ * Appearance_Manager/appearance_manager/constant_7.html#/ * /apple_ref/doc/uid/TP30000243/C005321> * */ static void ToolbarBackgroundElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, TCL_UNUSED(Ttk_Box), TCL_UNUSED(Ttk_State)) { ThemeBrush brush = kThemeBrushToolbarBackground; CGRect bounds = BoxToRect(d, Ttk_WinBox(tkwin)); |
︙ | ︙ | |||
2856 2857 2858 2859 2860 2861 2862 | ToolbarBackgroundElementDraw }; /*---------------------------------------------------------------------- * +++ Field elements -- * * Used for the Treeview widget. This is like the BackgroundElement | | | | | | | | | | | | | | 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 | ToolbarBackgroundElementDraw }; /*---------------------------------------------------------------------- * +++ Field elements -- * * Used for the Treeview widget. This is like the BackgroundElement * except that the fieldbackground color is configurable. */ typedef struct { Tcl_Obj *backgroundObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { {"-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement, backgroundObj), "white"}, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void FieldElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { FieldElement *e = (FieldElement *)elementRecord; Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin, e->backgroundObj); XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), b.x, b.y, b.width, b.height); } static Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, TtkNullElementSize, FieldElementDraw }; /*---------------------------------------------------------------------- * +++ Treeview headers -- * * On systems older than 10.9 the header is a kThemeListHeaderButton drawn * by HIToolbox. On newer systems those buttons do not match the Apple * buttons, so we draw them from scratch. */ static const Ttk_StateTable TreeHeaderValueTable[] = { {kThemeButtonOn, TTK_STATE_ALTERNATE, 0}, {kThemeButtonOn, TTK_STATE_SELECTED, 0}, {kThemeButtonOff, 0, 0} }; static const Ttk_StateTable TreeHeaderAdornmentTable[] = { {kThemeAdornmentHeaderButtonSortUp, TTK_STATE_ALTERNATE | TTK_TREEVIEW_STATE_SORTARROW, 0}, {kThemeAdornmentDefault, TTK_STATE_SELECTED | TTK_TREEVIEW_STATE_SORTARROW, 0}, {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_ALTERNATE, 0}, {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_SELECTED, 0}, {kThemeAdornmentFocus, TTK_STATE_FOCUS, 0}, {kThemeAdornmentNone, 0, 0} }; static void TreeAreaElementSize ( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ TCL_UNUSED(int *), /* minWidth */ TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { /* * Padding is needed to get the heading text to align correctly, since the * widget expects the heading to be the same height as a row. */ if ([NSApp macOSVersion] > 100800) { *paddingPtr = Ttk_MakePadding(0, 4, 0, 0); } } static Ttk_ElementSpec TreeAreaElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, |
︙ | ︙ | |||
2963 2964 2965 2966 2967 2968 2969 | ButtonElementSize(clientData, elementRecord, tkwin, minWidth, minHeight, paddingPtr); } } static void TreeHeaderElementDraw( void *clientData, | | | < < < | < | 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 | ButtonElementSize(clientData, elementRecord, tkwin, minWidth, minHeight, paddingPtr); } } static void TreeHeaderElementDraw( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeButtonParams *params = (ThemeButtonParams *)clientData; CGRect bounds = BoxToRect(d, b); const HIThemeButtonDrawInfo info = { .version = 0, .state = Ttk_StateTableLookup(ThemeStateTable, state), .kind = params->kind, .value = Ttk_StateTableLookup(TreeHeaderValueTable, state), .adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state), }; BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { /* * Compensate for the padding added in TreeHeaderElementSize, so * the larger heading will be drawn at the top of the widget. */ bounds.origin.y -= 4; DrawListHeader(bounds, dc.context, tkwin, state); } else { ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } |
︙ | ︙ | |||
3014 3015 3016 3017 3018 3019 3020 | /*---------------------------------------------------------------------- * +++ Disclosure triangles -- */ #define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1 #define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2 | | | | | | | | | 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 | /*---------------------------------------------------------------------- * +++ Disclosure triangles -- */ #define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1 #define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2 static const Ttk_StateTable DisclosureValueTable[] = { {kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0}, {kThemeDisclosureRight, 0, 0}, }; static void DisclosureElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { SInt32 s; ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s); *minWidth = s; ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s); *minHeight = s; } static void DisclosureElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { if (!(state & TTK_TREEVIEW_STATE_LEAF)) { int triangleState = TkMacOSXInDarkMode(tkwin) ? |
︙ | ︙ | |||
3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 | TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.button", TTK_FILL_BOTH, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))) /* Notebook tabs -- no focus ring */ TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) /* Spinbox -- buttons 2px to the right of the field. */ TTK_LAYOUT("TSpinbox", TTK_GROUP("Spinbox.buttons", TTK_PACK_RIGHT, TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP | TTK_STICK_E) TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM | TTK_STICK_E)) TTK_GROUP("Spinbox.field", TTK_FILL_X, TTK_NODE("Spinbox.textarea", TTK_FILL_X))) /* Progress bars -- track only */ TTK_LAYOUT("TProgressbar", TTK_NODE("Progressbar.track", TTK_FILL_BOTH)) /* Treeview -- no border. */ TTK_LAYOUT("Treeview", TTK_GROUP("Treeview.field", TTK_FILL_BOTH, | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 | TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.button", TTK_FILL_BOTH, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))) /* Image Button - no button */ TTK_LAYOUT("ImageButton", TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH))) /* Inline Button */ TTK_LAYOUT("InlineButton", TTK_GROUP("InlineButton.button", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH)))) /* Rounded Rect Button -- transparent face */ TTK_LAYOUT("RoundedRectButton", TTK_GROUP("RoundedRectButton.button", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH)))) /* Gradient Button */ TTK_LAYOUT("GradientButton", TTK_GROUP("GradientButton.button", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH)))) /* Recessed Button - text only radio button */ TTK_LAYOUT("RecessedButton", TTK_GROUP("RecessedButton.button", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH)))) /* DisclosureButton (not a triangle) -- No label, no border*/ TTK_LAYOUT("DisclosureButton", TTK_NODE("DisclosureButton.button", TTK_FILL_BOTH)) /* HelpButton -- No label, no border*/ TTK_LAYOUT("HelpButton", TTK_NODE("HelpButton.button", TTK_FILL_BOTH)) /* Notebook tabs -- no focus ring */ TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) /* Spinbox -- buttons 2px to the right of the field. */ TTK_LAYOUT("TSpinbox", TTK_GROUP("Spinbox.buttons", TTK_PACK_RIGHT, TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP | TTK_STICK_E) TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM | TTK_STICK_E)) TTK_GROUP("Spinbox.field", TTK_FILL_X, TTK_NODE("Spinbox.textarea", TTK_FILL_X))) TTK_LAYOUT("TEntry", TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH)))) /* Searchbox */ TTK_LAYOUT("Searchbox", TTK_GROUP("Searchbox.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH)))) /* Progress bars -- track only */ TTK_LAYOUT("TProgressbar", TTK_NODE("Progressbar.track", TTK_FILL_BOTH)) /* Treeview -- no border. */ TTK_LAYOUT("Treeview", TTK_GROUP("Treeview.field", TTK_FILL_BOTH, |
︙ | ︙ | |||
3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 | TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_RIGHT))) TTK_END_LAYOUT_TABLE /*---------------------------------------------------------------------- * +++ Initialization -- */ static int AquaTheme_Init( Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_CreateTheme(interp, "aqua", NULL); if (!themePtr) { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 | TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_RIGHT))) TTK_END_LAYOUT_TABLE /*---------------------------------------------------------------------- * +++ Initialization -- */ /*---------------------------------------------------------------------- * +++ Ttk_MacOSXInit -- * * Initialize variables which depend on [NSApp macOSVersion]. Called from * [NSApp applicationDidFinishLaunching]. */ MODULE_SCOPE void Ttk_MacOSXInit( void) { if ([NSApp macOSVersion] < 101400) { entryElementPadding = Ttk_MakePadding(7, 6, 7, 5); } else { entryElementPadding = Ttk_MakePadding(7, 5, 7, 6); } if ([NSApp macOSVersion] < 110000) { Ttk_ContrastDelta = 8.0; } else { /* * The subtle contrast became event more subtle in 11.0. */ Ttk_ContrastDelta = 5.0; } } static int AquaTheme_Init( Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_CreateTheme(interp, "aqua", NULL); if (!themePtr) { |
︙ | ︙ | |||
3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 | Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "field", &FieldElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Toolbar.background", &ToolbarBackgroundElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Button.button", &ButtonElementSpec, &PushButtonParams); Ttk_RegisterElementSpec(themePtr, "Checkbutton.button", &ButtonElementSpec, &CheckBoxParams); Ttk_RegisterElementSpec(themePtr, "Radiobutton.button", &ButtonElementSpec, &RadioButtonParams); Ttk_RegisterElementSpec(themePtr, "Toolbutton.border", &ButtonElementSpec, &BevelButtonParams); Ttk_RegisterElementSpec(themePtr, "Menubutton.button", &ButtonElementSpec, &PopupButtonParams); Ttk_RegisterElementSpec(themePtr, "Spinbox.uparrow", &SpinButtonUpElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Spinbox.downarrow", &SpinButtonDownElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Combobox.button", &ComboboxElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator", &DisclosureElementSpec, &DisclosureParams); Ttk_RegisterElementSpec(themePtr, "Treeheading.cell", &TreeHeaderElementSpec, &ListHeaderParams); Ttk_RegisterElementSpec(themePtr, "Treeview.treearea", &TreeAreaElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Labelframe.border", &GroupElementSpec, 0); | > > > > > > > > > > > > | > > > | > | 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 | Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "field", &FieldElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Toolbar.background", &ToolbarBackgroundElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Button.button", &ButtonElementSpec, &PushButtonParams); Ttk_RegisterElementSpec(themePtr, "InlineButton.button", &ButtonElementSpec, &InlineButtonParams); Ttk_RegisterElementSpec(themePtr, "RoundedRectButton.button", &ButtonElementSpec, &RoundedRectButtonParams); Ttk_RegisterElementSpec(themePtr, "Checkbutton.button", &ButtonElementSpec, &CheckBoxParams); Ttk_RegisterElementSpec(themePtr, "Radiobutton.button", &ButtonElementSpec, &RadioButtonParams); Ttk_RegisterElementSpec(themePtr, "RecessedButton.button", &ButtonElementSpec, &RecessedButtonParams); Ttk_RegisterElementSpec(themePtr, "Toolbutton.border", &ButtonElementSpec, &BevelButtonParams); Ttk_RegisterElementSpec(themePtr, "Menubutton.button", &ButtonElementSpec, &PopupButtonParams); Ttk_RegisterElementSpec(themePtr, "DisclosureButton.button", &ButtonElementSpec, &DisclosureButtonParams); Ttk_RegisterElementSpec(themePtr, "HelpButton.button", &ButtonElementSpec, &HelpButtonParams); Ttk_RegisterElementSpec(themePtr, "GradientButton.button", &ButtonElementSpec, &GradientButtonParams); Ttk_RegisterElementSpec(themePtr, "Spinbox.uparrow", &SpinButtonUpElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Spinbox.downarrow", &SpinButtonDownElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Combobox.button", &ComboboxElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator", &DisclosureElementSpec, &DisclosureParams); Ttk_RegisterElementSpec(themePtr, "Treeheading.cell", &TreeHeaderElementSpec, &ListHeaderParams); Ttk_RegisterElementSpec(themePtr, "Treeview.treearea", &TreeAreaElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Labelframe.border", &GroupElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Entry.field", &EntryElementSpec, &EntryFieldParams); Ttk_RegisterElementSpec(themePtr, "Searchbox.field", &EntryElementSpec, &SearchboxFieldParams); Ttk_RegisterElementSpec(themePtr, "Spinbox.field", &EntryElementSpec, &EntryFieldParams); Ttk_RegisterElementSpec(themePtr, "separator", &SeparatorElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "hseparator", &SeparatorElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "vseparator", &SeparatorElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "sizegrip", &SizegripElementSpec, 0); |
︙ | ︙ |
Added macosx/ttkMacOSXTheme.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | /* * ttkMacOSXTheme.h -- * * Static data and macros used in ttkMacOSXTheme.c * * Copyright 2019 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ /* * Macros for handling drawing contexts. */ #define BEGIN_DRAWING(d) { \ TkMacOSXDrawingContext dc; \ if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) { \ return; \ } \ #define END_DRAWING \ TkMacOSXRestoreDrawingContext(&dc);} #define HIOrientation kHIThemeOrientationNormal #define NoThemeMetric 0xFFFFFFFF /* * A scale factor used to map a range of non-negative doubles into a large * range of non-negative 32-bit integers without losing too much information. * (Use 1073741824 == 2^30 so we don't get surprised by roundoff.) */ #define RangeToFactor(max) ((double) (1073741824.0) / (max < 1.0 ? 1.0 : max)) /* * Meanings of Ttk states represented by User1 and User2. */ #define TTK_STATE_FIRST_TAB TTK_STATE_USER1 #define TTK_STATE_LAST_TAB TTK_STATE_USER2 #define TTK_STATE_IS_ACCENTED TTK_STATE_USER2 #define TTK_TREEVIEW_STATE_SORTARROW TTK_STATE_USER1 /* * Colors and gradients used when drawing buttons. */ typedef struct GrayColor { CGFloat grayscale; CGFloat alpha; } GrayColor; #define RGBACOLOR static CGFloat #define RGBA256(r, g, b, a) {r / 255.0, g / 255.0, b / 255.0, a} #define GRAYCOLOR static GrayColor #define GRAY256(grayscale) {grayscale / 255.0, 1.0} /* * Opaque Grays used for Gradient Buttons, Scrollbars and List Headers */ GRAYCOLOR darkDisabledIndicator = GRAY256(122.0); GRAYCOLOR lightDisabledIndicator = GRAY256(152.0); GRAYCOLOR darkGradientNormal = GRAY256(95.0); GRAYCOLOR darkGradientPressed = GRAY256(118.0); GRAYCOLOR darkGradientDisabled = GRAY256(82.0); GRAYCOLOR darkGradientBorder = GRAY256(118.0); GRAYCOLOR darkGradientBorderDisabled = GRAY256(94.0); GRAYCOLOR lightGradientNormal = GRAY256(244.0); GRAYCOLOR lightGradientPressed = GRAY256(175.0); GRAYCOLOR lightGradientDisabled = GRAY256(235.0); GRAYCOLOR lightGradientBorder = GRAY256(165.0); GRAYCOLOR lightGradientBorderDisabled = GRAY256(204.0); GRAYCOLOR lightTrough = GRAY256(250.0); GRAYCOLOR darkTrough = GRAY256(47.0); GRAYCOLOR lightInactiveThumb = GRAY256(200.0); GRAYCOLOR lightActiveThumb = GRAY256(133.0); GRAYCOLOR darkInactiveThumb = GRAY256(117.0); GRAYCOLOR darkActiveThumb = GRAY256(158.0); GRAYCOLOR lightListheaderBorder = GRAY256(200.0); GRAYCOLOR listheaderSeparator = GRAY256(220.0); GRAYCOLOR listheaderActiveBG = GRAY256(238.0); GRAYCOLOR listheaderInactiveBG = GRAY256(246.0); GRAYCOLOR lightComboSeparator = GRAY256(236.0); GRAYCOLOR darkComboSeparator = GRAY256(66.0); GRAYCOLOR darkTrack = GRAY256(84.0); GRAYCOLOR darkInactiveTrack = GRAY256(107.0); GRAYCOLOR lightTrack = GRAY256(177.0); GRAYCOLOR lightInactiveTrack = GRAY256(139.0); /* * Transparent Grays */ GRAYCOLOR boxBorder = {1.0, 0.20}; GRAYCOLOR darkSeparator = {1.0, 0.3}; GRAYCOLOR darkTabSeparator = {0.0, 0.25}; GRAYCOLOR darkListheaderBorder = {1.0, 0.125}; GRAYCOLOR pressedDefaultButton = {0.0, 0.1}; GRAYCOLOR darkPressedDefaultButton = {1.0, 0.1}; #define CG_WHITE CGColorGetConstantColor(kCGColorWhite) /* * Structures which comprise a database of corner radii and state-dependent * colors used when drawing various types of buttons or entry widgets. */ typedef struct GrayPalette { CGFloat face; CGFloat top; CGFloat side; CGFloat bottom; } GrayPalette; typedef struct PaletteStateTable { GrayPalette light; /* Light palette to use if this entry matches */ GrayPalette dark; /* dark palette to use if this entry matches */ unsigned int onBits; /* Bits which must be set */ unsigned int offBits; /* Bits which must be cleared */ } PaletteStateTable; typedef struct ButtonDesign { CGFloat radius; PaletteStateTable palettes[]; } ButtonDesign; /* * The data. */ static const ButtonDesign pushbuttonDesign = { .radius = 4.0, .palettes = { { .light = {.face = 242.0, .top = 213.0, .side = 210.0, .bottom = 200.0}, .dark = {.face = 94.0, .top = 98.0, .side = 94.0, .bottom = 58.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0}, { .light = {.face = 205.0, .top = 215.0, .side = 211.0, .bottom = 173.0}, .dark = {.face = 140.0, .top = 150.0, .side = 140.0, .bottom = 42.0}, .onBits = TTK_STATE_PRESSED, .offBits = 0 }, { .light = {.face = 255.0, .top = 198.0, .side = 192.0, .bottom = 173.0}, .dark = {.face = 118.0, .top = 132.0, .side = 118.0, .bottom = 48.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign helpDesign = { .radius = 11, .palettes = { { .light = {.face = 241.0, .top = 218.0, .side = 217.0, .bottom = 206.0}, .dark = {.face = 83.0, .top = 89.0, .side = 82.0, .bottom = 82.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0}, { .light = {.face = 240.0, .top = 208.0, .side = 205.0, .bottom = 188.0}, .dark = {.face = 129.0, .top = 121.0, .side = 106.0, .bottom = 106.0}, .onBits = TTK_STATE_PRESSED, .offBits = 0 }, { .light = {.face = 255.0, .top = 208.0, .side = 205.0, .bottom = 188.0}, .dark = {.face = 107.0, .top = 121.0, .side = 106.0, .bottom = 106.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign inlineDesign = { .radius = 8.0, .palettes = { { .light = {.face = 170.0, .top = 170.0, .side = 170.0, .bottom = 170.0}, .dark = {.face = 106.0, .top = 106.0, .side = 106.0, .bottom = 106.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0}, { .light = {.face = 34.0, .top = 34.0, .side = 34.0, .bottom = 34.0}, .dark = {.face = 225.0, .top = 225.0, .side = 225.0, .bottom = 225.0}, .onBits = TTK_STATE_PRESSED, .offBits = 0 }, { .light = {.face = 113.0, .top = 113.0, .side = 113.0, .bottom = 113.0}, .dark = {.face = 165.0, .top = 165.0, .side = 165.0, .bottom = 165.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign roundedrectDesign = { .radius = 3.0, .palettes = { { .light = {.face = 256.0, .top = 192.0, .side = 192.0, .bottom = 192.0}, .dark = {.face = 256.0, .top = 165.0, .side = 163.0, .bottom = 42.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0 }, { .light = {.face = 204.0, .top = 158.0, .side = 158.0, .bottom = 158.0}, .dark = {.face = 85.0, .top = 115.0, .side = 115.0, .bottom = 115.0}, .onBits = TTK_STATE_PRESSED, .offBits = 0 }, { .light = {.face = 205.0, .top = 215.0, .side = 211.0, .bottom = 173.0}, .dark = {.face = 140.0, .top = 150.0, .side = 140.0, .bottom = 42.0}, .onBits = TTK_STATE_ALTERNATE, .offBits = TTK_STATE_BACKGROUND }, /* * Gray values > 255 are replaced by the background color. */ { .light = {.face = 256.0, .top = 158.0, .side = 158.0, .bottom = 158.0}, .dark = {.face = 256.0, .top = 115.0, .side = 115.0, .bottom = 115.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign popupDesign = { .radius = 4.0, .palettes = { { .light = {.face = 242.0, .top = 213.0, .side = 210.0, .bottom = 200.0}, .dark = {.face = 94.0, .top = 98.0, .side = 94.0, .bottom = 58.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0 }, { .light = {.face = 255.0, .top = 198.0, .side = 192.0, .bottom = 173.0}, .dark = {.face = 118.0, .top = 132.0, .side = 118.0, .bottom = 48.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign checkDesign = { .radius = 4.0, .palettes = { { .light = {.face = 242.0, .top = 192.0, .side = 199.0, .bottom = 199.0}, .dark = {.face = 80.0, .top = 90.0, .side = 80.0, .bottom = 49.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0 }, { .light = {.face = 255.0, .top = 165.0, .side = 184.0, .bottom = 184.0}, .dark = {.face = 118.0, .top = 132.0, .side = 118.0, .bottom = 48.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign radioDesign = { .radius = 8.0, .palettes = { { .light = {.face = 242.0, .top = 189.0, .side = 198.0, .bottom = 199.0}, .dark = {.face = 80.0, .top = 84.0, .side = 88.0, .bottom = 60.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0 }, { .light = {.face = 255.0, .top = 165.0, .side = 184.0, .bottom = 184.0}, .dark = {.face = 118.0, .top = 132.0, .side = 118.0, .bottom = 48.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign recessedDesign = { .radius = 4.0, .palettes = { { .light = {.face = 117.0, .top = 117.0, .side = 117.0, .bottom = 117.0}, .dark = {.face = 129.0, .top = 129.0, .side = 129.0, .bottom = 129.0}, .onBits = TTK_STATE_PRESSED, .offBits = 0 }, { .light = {.face = 182.0, .top = 182.0, .side = 182.0, .bottom = 182.0}, .dark = {.face = 105.0, .top = 105.0, .side = 105.0, .bottom = 105.0}, .onBits = TTK_STATE_ACTIVE, .offBits = TTK_STATE_SELECTED }, { .light = {.face = 145.0, .top = 145.0, .side = 145.0, .bottom = 145.0}, .dark = {.face = 166.0, .top = 166.0, .side = 166.0, .bottom = 166.0}, .onBits = TTK_STATE_SELECTED, .offBits = 0 }, { .light = {.face = 256.0, .top = 256.0, .side = 256.0, .bottom = 256.0}, .dark = {.face = 256.0, .top = 256.0, .side = 256.0, .bottom = 256.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign incdecDesign = { .radius = 5.0, .palettes = { { .light = {.face = 246.0, .top = 236.0, .side = 227.0, .bottom = 213.0}, .dark = {.face = 80.0, .top = 90.0, .side = 80.0, .bottom = 49.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0 }, { .light = {.face = 255.0, .top = 198.0, .side = 192.0, .bottom = 173.0}, .dark = {.face = 118.0, .top = 132.0, .side = 118.0, .bottom = 48.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign bevelDesign = { .radius = 4.0, .palettes = { { .light = {.face = 242.0, .top = 213.0, .side = 210.0, .bottom = 200.0}, .dark = {.face = 94.0, .top = 98.0, .side = 94.0, .bottom = 58.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0 }, { .light = {.face = 205.0, .top = 215.0, .side = 211.0, .bottom = 173.0}, .dark = {.face = 140.0, .top = 150.0, .side = 140.0, .bottom = 42.0}, .onBits = TTK_STATE_PRESSED, .offBits = 0 }, { .light = {.face = 228.0, .top = 215.0, .side = 211.0, .bottom = 173.0}, .dark = {.face = 163.0, .top = 150.0, .side = 140.0, .bottom = 42.0}, .onBits = TTK_STATE_SELECTED, .offBits = 0 }, { .light = {.face = 255.0, .top = 198.0, .side = 192.0, .bottom = 173.0}, .dark = {.face = 118.0, .top = 132.0, .side = 118.0, .bottom = 48.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign tabDesign = { .radius = 4.0, .palettes = { /* * Apple does not have such a thing as a disabled tab. If it is * disabled, it should be removed. But we provide one based on the * disabled button. */ { .light = {.face = 229.0, .top = 213.0, .side = 242.0, .bottom = 200.0}, .dark = {.face = 163.0, .top = 90.0, .side = 80.0, .bottom = 49.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0 }, { .light = {.face = 229.0, .top = 205.0, .side = 211.0, .bottom = 183.0}, .dark = {.face = 163.0, .top = 165.0, .side = 163.0, .bottom = 42.0}, .onBits = TTK_STATE_SELECTED, .offBits = 0 }, { .light = {.face = 255.0, .top = 215.0, .side = 211.0, .bottom = 183.0}, .dark = {.face = 108.0, .top = 129.0, .side = 108.0, .bottom = 47.0}, .onBits = 0, .offBits = 0 }, } }; static const ButtonDesign entryDesign = { .radius = 0.0, .palettes = { { .light = {.face = 256.0, .top = 198.0, .side = 198.0, .bottom = 198.0}, .dark = {.face = 256.0, .top = 66.0, .side = 66.0, .bottom = 84.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign searchDesign = { .radius = 3.5, .palettes = { { .light = {.face = 256.0, .top = 198.0, .side = 198.0, .bottom = 198.0}, .dark = {.face = 256.0, .top = 66.0, .side = 66.0, .bottom = 84.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign comboDesign = { .radius = 4.0, .palettes = { { .light = {.face = 256.0, .top = 190.0, .side = 190.0, .bottom = 190.0}, .dark = {.face = 256.0, .top = 66.0, .side = 66.0, .bottom = 90.0}, .onBits = 0, .offBits = 0 } } }; static const ButtonDesign sliderDesign = { .radius = 8.0, .palettes = { { .light = {.face = 242.0, .top = 189.0, .side = 198.0, .bottom = 199.0}, .dark = {.face = 80.0, .top = 84.0, .side = 88.0, .bottom = 60.0}, .onBits = TTK_STATE_DISABLED, .offBits = 0 }, { .light = {.face = 255.0, .top = 165.0, .side = 184.0, .bottom = 184.0}, .dark = {.face = 205.0, .top = 205.0, .side = 205.0, .bottom = 198.0}, .onBits = 0, .offBits = 0 } } }; /* * Table mapping Tk states to Appearance manager ThemeStates */ static const Ttk_StateTable ThemeStateTable[] = { {kThemeStateActive, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeStateUnavailable, TTK_STATE_DISABLED, 0}, {kThemeStatePressed, TTK_STATE_PRESSED, 0}, {kThemeStateInactive, TTK_STATE_BACKGROUND, 0}, {kThemeStateUnavailableInactive, TTK_STATE_DISABLED | TTK_STATE_BACKGROUND, 0}, {kThemeStateActive, 0, 0} /* Others: * The kThemeStatePressedUp and kThemeStatePressedDown bits indicate * which of the two segments of an IncDec button is being pressed. * We don't use these. kThemeStateRollover roughly corresponds to * TTK_STATE_ACTIVE, but does not do what we want with the help button. * * {kThemeStatePressedUp, 0, 0}, * {kThemeStatePressedDown, 0, 0} * {kThemeStateRollover, TTK_STATE_ACTIVE, 0}, */ }; /* * Translation between Ttk and HIToolbox. */ static const Ttk_StateTable ButtonValueTable[] = { {kThemeButtonOff, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeButtonMixed, TTK_STATE_ALTERNATE, 0}, {kThemeButtonOn, TTK_STATE_SELECTED, 0}, {kThemeButtonOff, 0, 0} }; static const Ttk_StateTable ButtonAdornmentTable[] = { {kThemeAdornmentNone, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeAdornmentDefault | kThemeAdornmentFocus, TTK_STATE_ALTERNATE | TTK_STATE_FOCUS, 0}, {kThemeAdornmentFocus, TTK_STATE_FOCUS, 0}, {kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0}, {kThemeAdornmentNone, 0, 0} }; /* * Our enums for button styles not known to HIToolbox. */ #define TkGradientButton 0x8001 #define TkRoundedRectButton 0x8002 #define TkRecessedButton 0x8003 #define TkInlineButton 0x8004 /* * The struct passed as clientData when drawing Ttk buttons. */ typedef struct { ThemeButtonKind kind; ThemeMetric heightMetric; ThemeMetric widthMetric; } ThemeButtonParams; static ThemeButtonParams PushButtonParams = {kThemePushButton, kThemeMetricPushButtonHeight, NoThemeMetric}, CheckBoxParams = {kThemeCheckBox, kThemeMetricCheckBoxHeight, NoThemeMetric}, RadioButtonParams = {kThemeRadioButton, kThemeMetricRadioButtonHeight, NoThemeMetric}, BevelButtonParams = {kThemeRoundedBevelButton, NoThemeMetric, NoThemeMetric}, PopupButtonParams = {kThemePopupButton, kThemeMetricPopupButtonHeight, NoThemeMetric}, DisclosureParams = {kThemeDisclosureButton, kThemeMetricDisclosureTriangleHeight, kThemeMetricDisclosureTriangleWidth}, DisclosureButtonParams = {kThemeArrowButton, kThemeMetricSmallDisclosureButtonHeight, kThemeMetricSmallDisclosureButtonWidth}, HelpButtonParams = {kThemeRoundButtonHelp, kThemeMetricRoundButtonSize, kThemeMetricRoundButtonSize}, ListHeaderParams = {kThemeListHeaderButton, kThemeMetricListHeaderHeight, NoThemeMetric}, GradientButtonParams = {TkGradientButton, NoThemeMetric, NoThemeMetric}, RoundedRectButtonParams = {TkRoundedRectButton, kThemeMetricPushButtonHeight, NoThemeMetric}, RecessedButtonParams = {TkRecessedButton, kThemeMetricPushButtonHeight, NoThemeMetric}, InlineButtonParams = {TkInlineButton, kThemeMetricPushButtonHeight, NoThemeMetric}; /* * Others: kThemeDisclosureRight, kThemeDisclosureDown, * kThemeDisclosureLeft */ /* * The struct passed as clientData when drawing Ttk Entry widgets. */ typedef struct { HIThemeFrameKind kind; ThemeMetric heightMetric; ThemeMetric widthMetric; } ThemeFrameParams; static ThemeFrameParams EntryFieldParams = {kHIThemeFrameTextFieldSquare, NoThemeMetric, NoThemeMetric}, SearchboxFieldParams = {kHIThemeFrameTextFieldRound, NoThemeMetric, NoThemeMetric}; /* * If we try to draw a rounded rectangle with too large of a radius, the Core * Graphics library will sometimes raise a fatal exception. This macro * protects against this by returning if the width or height is less than * twice the radius. Presumably this only happens when a widget has not yet * been configured and has size 1x1, so there is nothing to draw anyway. */ #define CHECK_RADIUS(radius, bounds) \ if ((radius) > (bounds).size.width / 2 || (radius) > (bounds).size.height / 2) { \ return; \ } /* * The spinbox widget needs to draw the two arrows in different colors when * one half or the other is being pressed, but the menubutton always draws * them in the same color. This constant is used to distinguish those two * situations. */ #define BOTH_ARROWS 1 << 30 /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to tests/all.tcl.
1 2 3 4 5 6 | # all.tcl -- # # This file contains a top-level script to run all of the Tk # tests. Execute it by invoking "source all.tcl" when running tktest # in this directory. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # all.tcl -- # # This file contains a top-level script to run all of the Tk # tests. Execute it by invoking "source all.tcl" when running tktest # in this directory. # # Copyright © 1998-1999 Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package require tk ;# This is the Tk test suite; fail early if no Tk! package require tcltest 2.2 tcltest::configure {*}$argv tcltest::configure -testdir [file normalize [file dirname [info script]]] tcltest::configure -loadfile \ [file join [tcltest::testsDirectory] constraints.tcl] tcltest::configure -singleproc 1 set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)] |
︙ | ︙ |
Changes to tests/bell.test.
1 2 3 4 | # This file is a Tcl script to test out Tk's "bell" command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test out Tk's "bell" command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1998-2000 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/bgerror.test.
1 2 3 4 | # This file is a Tcl script to test the bgerror command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test the bgerror command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/bind.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out Tk's "bind" and "bindtags" # commands plus the procedures in tkBind.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # This file is a Tcl script to test out Tk's "bind" and "bindtags" # commands plus the procedures in tkBind.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands tk useinputmethods 0 testConstraint failsOnWindows [expr {![info exists ::env(CI)] || [tk windowingsystem] ne "win32"}] toplevel .t -width 100 -height 50 wm geom .t +0+0 update idletasks foreach p [event info] {event delete $p} |
︙ | ︙ | |||
39 40 41 42 43 44 45 | # move the mouse pointer away of the testing area # otherwise some spurious events may pollute the tests toplevel .top wm geometry .top 50x50-50-50 update event generate .top <Button-1> -warp 1 | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # move the mouse pointer away of the testing area # otherwise some spurious events may pollute the tests toplevel .top wm geometry .top 50x50-50-50 update event generate .top <Button-1> -warp 1 controlPointerWarpTiming destroy .top test bind-1.1 {bind command} -body { bind } -returnCodes error -result {wrong # args: should be "bind window ?pattern? ?command?"} test bind-1.2 {bind command} -body { bind a b c d |
︙ | ︙ | |||
383 384 385 386 387 388 389 | .t.c bind foo a } -cleanup { destroy .t.c } -result {Test} test bind-11.1 {Tk_GetAllBindings procedure} -body { frame .t.f | | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | .t.c bind foo a } -cleanup { destroy .t.c } -result {Test} test bind-11.1 {Tk_GetAllBindings procedure} -body { frame .t.f foreach i "! a \\\{ ~ <Delete> <space> <<Paste>> <Tab> <Linefeed> <Key-<> <Meta-a> <Â>" { bind .t.f $i Test } lsort [bind .t.f] } -cleanup { destroy .t.f } -result "! <<Paste>> <Key-<> <Key-Delete> <Key-Linefeed> <Key-Tab> <Key-space> <Key-Â> <Meta-Key-a> a \\\{ ~" test bind-11.2 {Tk_GetAllBindings procedure} -body { frame .t.f foreach i "<Double-Button-1> <Triple-Button-1> <Meta-Control-a> <Double-Alt-Enter> <Button-1>" { bind .t.f $i Test } lsort [bind .t.f] } -cleanup { |
︙ | ︙ | |||
435 436 437 438 439 440 441 | } -body { bind Test <Key> {lappend x "%W %K Test Key"} bind all <Key> {lappend x "%W %K all Key"} bind Test : {lappend x "%W %K Test :"} bind all _ {lappend x "%W %K all _"} bind .t.f : {lappend x "%W %K .t.f :"} | | | | | | | | | | | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | } -body { bind Test <Key> {lappend x "%W %K Test Key"} bind all <Key> {lappend x "%W %K all Key"} bind Test : {lappend x "%W %K Test :"} bind all _ {lappend x "%W %K all _"} bind .t.f : {lappend x "%W %K .t.f :"} event generate .t.f <:> event generate .t.f <+> event generate .t.f <_> return $x } -cleanup { destroy .t.f bind all <Key> {} bind Test <Key> {} bind all _ {} bind Test : {} } -result {{.t.f : .t.f :} {.t.f : Test :} {.t.f : all Key} {.t.f + Test Key} {.t.f + all Key} {.t.f _ Test Key} {.t.f _ all _}} test bind-13.2 {Tk_BindEvent procedure} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind Test <Key> {lappend x "%W %K Test press any"; break} bind all <Key> {continue; lappend x "%W %K all press any"} bind .t.f : {lappend x "%W %K .t.f pressed colon"} event generate .t.f <:> return $x } -cleanup { destroy .t.f bind all <Key> {} bind Test <Key> {} } -result {{.t.f : .t.f pressed colon} {.t.f : Test press any}} test bind-13.3 {Tk_BindEvent procedure} -setup { proc bgerror args {} frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind Test <Key> {lappend x "%W %K Test press any"; error Test} bind .t.f : {lappend x "%W %K .t.f pressed colon"} event generate .t.f <:> update list $x $errorInfo } -cleanup { destroy .t.f bind Test <Key> {} rename bgerror {} } -result {{{.t.f : .t.f pressed colon} {.t.f : Test press any}} {Test while executing "error Test" (command bound to event)}} test bind-13.4 {Tk_BindEvent procedure} -setup { proc foo {} { set x 44 event generate .t.f <:> } frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind Test : {lappend x "%W %K Test"} bind .t.f : {lappend x "%W %K .t.f"} foo return $x } -cleanup { destroy .t.f bind Test : {} } -result {{.t.f : .t.f} {.t.f : Test}} test bind-13.5 {Tk_BindEvent procedure} -body { bind all <Destroy> {lappend x "%W destroyed"} set x {} frame .t.g -gorp foo } -cleanup { bind all <Destroy> {} |
︙ | ︙ | |||
533 534 535 536 537 538 539 | focus -force .t.f update set x {} } -body { bind .t.f : {lappend x "%W (.t.f binding)"} bind Test : {lappend x "%W (Test binding)"} bind all : {bind .t.f : {}; lappend x "%W (all binding)"} | | | | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | focus -force .t.f update set x {} } -body { bind .t.f : {lappend x "%W (.t.f binding)"} bind Test : {lappend x "%W (Test binding)"} bind all : {bind .t.f : {}; lappend x "%W (all binding)"} event generate .t.f <:> return $x } -cleanup { bind Test : {} bind all : {} destroy .t.f } -result {{.t.f (.t.f binding)} {.t.f (Test binding)} {.t.f (all binding)}} test bind-13.8 {Tk_BindEvent procedure} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind .t.f : {lappend x "%W (.t.f binding)"} bind Test : {lappend x "%W (Test binding)"} bind all : {destroy .t.f; lappend x "%W (all binding)"} event generate .t.f <:> return $x } -cleanup { bind Test : {} bind all : {} destroy .t.f } -result {{.t.f (.t.f binding)} {.t.f (Test binding)} {.t.f (all binding)}} |
︙ | ︙ | |||
632 633 634 635 636 637 638 | pack .t.f focus -force .t.f update set x {} } -body { bind .t.f <Key> "lappend x Key%K" bind .t.f <KeyRelease> "lappend x Release%K" | | | | | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | pack .t.f focus -force .t.f update set x {} } -body { bind .t.f <Key> "lappend x Key%K" bind .t.f <KeyRelease> "lappend x Release%K" event generate .t.f <Key> -keysym : event generate .t.f <KeyRelease> -keysym : return $x } -cleanup { destroy .t.f } -result {Key: Release:} test bind-13.14 {Tk_BindEvent procedure: invalid key detail} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { |
︙ | ︙ | |||
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | bind Test <Button-2> {} proc bgerror args {} } -result {b1 {invalid command name "blap"}} test bind-15.1 {MatchPatterns procedure, ignoring type mismatches} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f 12 {set x 1} set x 0 event generate .t.f <Key-1> event generate .t.f <KeyRelease-1> event generate .t.f <Key-2> event generate .t.f <KeyRelease-2> return $x } -cleanup { destroy .t.f } -result 1 test bind-15.2 {MatchPatterns procedure, ignoring type mismatches} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f 12 {set x 1} set x 0 event generate .t.f <Key-1> event generate .t.f <Enter> | > > | 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | bind Test <Button-2> {} proc bgerror args {} } -result {b1 {invalid command name "blap"}} test bind-15.1 {MatchPatterns procedure, ignoring type mismatches} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f update idletasks focus -force .t.f update } -body { bind .t.f 12 {set x 1} set x 0 event generate .t.f <Key-1> event generate .t.f <KeyRelease-1> event generate .t.f <Key-2> event generate .t.f <KeyRelease-2> return $x } -cleanup { destroy .t.f } -result 1 test bind-15.2 {MatchPatterns procedure, ignoring type mismatches} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f update idletasks focus -force .t.f update } -body { bind .t.f 12 {set x 1} set x 0 event generate .t.f <Key-1> event generate .t.f <Enter> |
︙ | ︙ | |||
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | event delete <<V1>> <Button> event delete <<V2>> <Button-1> event delete <<V3>> <Shift-Button-1> } -result {V2102 V2103 V2105 Shift-Button-1} test bind-15.27 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Key> {set x 0} bind .t.f 1 {set x 1} set x none event generate .t.f <Key-1> return $x } -cleanup { destroy .t.f } -result 1 test bind-15.28 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Key> {set x 0} bind .t.f 1 {set x 1} set x none event generate .t.f <Key-2> return $x } -cleanup { destroy .t.f } -result 0 test bind-15.29 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Key> {lappend x 0} bind .t.f 1 {lappend x 1} bind .t.f 21 {lappend x 2} set x none | > > > | 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | event delete <<V1>> <Button> event delete <<V2>> <Button-1> event delete <<V3>> <Shift-Button-1> } -result {V2102 V2103 V2105 Shift-Button-1} test bind-15.27 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f update idletasks focus -force .t.f update } -body { bind .t.f <Key> {set x 0} bind .t.f 1 {set x 1} set x none event generate .t.f <Key-1> return $x } -cleanup { destroy .t.f } -result 1 test bind-15.28 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f update idletasks focus -force .t.f update } -body { bind .t.f <Key> {set x 0} bind .t.f 1 {set x 1} set x none event generate .t.f <Key-2> return $x } -cleanup { destroy .t.f } -result 0 test bind-15.29 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f update idletasks focus -force .t.f update } -body { bind .t.f <Key> {lappend x 0} bind .t.f 1 {lappend x 1} bind .t.f 21 {lappend x 2} set x none |
︙ | ︙ | |||
2047 2048 2049 2050 2051 2052 2053 | event generate .t.f <braceleft> -state 1 event generate .t.f <Multi_key> event generate .t.f <e> event generate .t.f <apostrophe> set x } -cleanup { destroy .t.f | | | 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 | event generate .t.f <braceleft> -state 1 event generate .t.f <Multi_key> event generate .t.f <e> event generate .t.f <apostrophe> set x } -cleanup { destroy .t.f } -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} é} test bind-16.36 {ExpandPercents procedure} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Configure> {set x "%B"} |
︙ | ︙ | |||
2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 | list $x $y $z } -cleanup { destroy .t.e bind Entry <Key> $savedBind(Entry) bind all <Key> $savedBind(All) unset savedBind } -result {0 1 2} test bind-17.1 {event command} -body { event } -returnCodes error -result {wrong # args: should be "event option ?arg?"} test bind-17.2 {event command} -body { event xyz } -returnCodes error -result {bad option "xyz": must be add, delete, generate, or info} test bind-17.3 {event command: add} -body { event add } -returnCodes error -result {wrong # args: should be "event add virtual sequence ?sequence ...?"} test bind-17.4 {event command: add 1} -body { event delete <<Paste>> event add <<Paste>> <Control-v> event info <<Paste>> } -cleanup { event delete <<Paste>> <Control-v> | > > > > > > > > > > > > > | | 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 | list $x $y $z } -cleanup { destroy .t.e bind Entry <Key> $savedBind(Entry) bind all <Key> $savedBind(All) unset savedBind } -result {0 1 2} test bind-16.47 {ExpandPercents procedure} -constraints {aquaOrWin32 needsTcl87 failsOnWindows} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Key> {set x "%K"} set x none event generate .t.f <Key> -keysym € set x } -cleanup { destroy .t.f } -result € test bind-17.1 {event command} -body { event } -returnCodes error -result {wrong # args: should be "event option ?arg?"} test bind-17.2 {event command} -body { event xyz } -returnCodes error -result {bad option "xyz": must be add, delete, generate, or info} test bind-17.3 {event command: add} -body { event add } -returnCodes error -result {wrong # args: should be "event add virtual sequence ?sequence ...?"} test bind-17.4 {event command: add 1} -body { event delete <<Paste>> event add <<Paste>> <Control-v> event info <<Paste>> } -cleanup { event delete <<Paste>> <Control-v> } -result <Control-Key-v> test bind-17.5 {event command: add 2} -body { event delete <<Paste>> event add <<Paste>> <Control-v> <Button-2> lsort [event info <<Paste>>] } -cleanup { event delete <<Paste>> <Control-v> <Button-2> } -result {<Button-2> <Control-Key-v>} |
︙ | ︙ | |||
2348 2349 2350 2351 2352 2353 2354 | } -returnCodes error -result {bad event type or keysym "Ctrl"} test bind-18.3 {CreateVirtualEvent procedure: new physical} -body { event delete <<xyz>> event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> | | | | 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 | } -returnCodes error -result {bad event type or keysym "Ctrl"} test bind-18.3 {CreateVirtualEvent procedure: new physical} -body { event delete <<xyz>> event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> } -result <Control-Key-v> test bind-18.4 {CreateVirtualEvent procedure: duplicate physical} -body { event delete <<xyz>> event add <<xyz>> <Control-v> event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> } -result <Control-Key-v> test bind-18.5 {CreateVirtualEvent procedure: existing physical} -body { foreach p [event info] {event delete $p} event add <<xyz>> <Control-v> event add <<abc>> <Control-v> list [lsort [event info]] [event info <<xyz>>] [event info <<abc>>] } -cleanup { event delete <<xyz>> |
︙ | ︙ | |||
2405 2406 2407 2408 2409 2410 2411 | } -result {} test bind-19.4 {DeleteVirtualEvent procedure: delete 1, not owned} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> event delete <<xyz>> <Button-1> event info <<xyz>> | | | 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 | } -result {} test bind-19.4 {DeleteVirtualEvent procedure: delete 1, not owned} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> event delete <<xyz>> <Button-1> event info <<xyz>> } -result <Control-Key-v> test bind-19.5 {DeleteVirtualEvent procedure: delete 1, badly formed} -body { event add <<xyz>> <Control-v> event delete <<xyz>> <xyz> } -cleanup { event delete <<xyz>> } -returnCodes error -result {bad event type or keysym "xyz"} test bind-19.6 {DeleteVirtualEvent procedure: delete 1, badly formed} -body { |
︙ | ︙ | |||
2687 2688 2689 2690 2691 2692 2693 | test bind-20.3 {GetVirtualEvent procedure: owns 1} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> | | | | 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 | test bind-20.3 {GetVirtualEvent procedure: owns 1} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> } -result <Control-Key-v> test bind-20.4 {GetVirtualEvent procedure: owns many} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> <Button-2> spack event info <<xyz>> } -cleanup { event delete <<xyz>> } -result {<Control-Key-v> <Button-2> spack} test bind-21.1 {GetAllVirtualEvents procedure: no events} -body { foreach p [event info] {event delete $p} event info } -result {} test bind-21.2 {GetAllVirtualEvents procedure: 1 event} -body { foreach p [event info] {event delete $p} event add <<xyz>> <Control-v> event info } -cleanup { event delete <<xyz>> } -result <<xyz>> test bind-21.3 {GetAllVirtualEvents procedure: many events} -body { foreach p [event info] {event delete $p} event add <<xyz>> <Control-v> event add <<xyz>> <Button-2> event add <<abc>> <Control-v> event add <<def>> <F6> lsort [event info] |
︙ | ︙ | |||
5085 5086 5087 5088 5089 5090 5091 | } -cleanup { destroy .t.f } -result test test bind-25.2 {ParseEventDescription procedure: misinterpreted modifier} -setup { button .b } -body { bind .b <Control-M> a | | | | 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 | } -cleanup { destroy .t.f } -result test test bind-25.2 {ParseEventDescription procedure: misinterpreted modifier} -setup { button .b } -body { bind .b <Control-M> a bind .b <Meta-M> b lsort [bind .b] } -cleanup { destroy .b } -result {<Control-Key-M> <Meta-Key-M>} test bind-25.3 {ParseEventDescription procedure} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <a---> {nothing} bind .t.f } -cleanup { destroy .t.f } -result a test bind-25.4 {ParseEventDescription} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <<Shift-Paste>> {puts hi} bind .t.f } -cleanup { destroy .t.f } -result <<Shift-Paste>> # Assorted error cases in event sequence parsing test bind-25.5 {ParseEventDescription procedure error cases} -body { bind .t \x7 {puts hi} } -returnCodes error -result {bad ASCII character 0x7} test bind-25.6 {ParseEventDescription procedure error cases} -body { bind .t \x7f {puts hi} |
︙ | ︙ | |||
5189 5190 5191 5192 5193 5194 5195 | } -cleanup { destroy .t.f } -result <Meta-Key-a> test bind-25.22 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { | | | 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 | } -cleanup { destroy .t.f } -result <Meta-Key-a> test bind-25.22 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <Meta-a> foo bind .t.f } -cleanup { destroy .t.f } -result <Meta-Key-a> test bind-25.23 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 |
︙ | ︙ | |||
5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 | } -body { bind .t.f <Button9-a> foo bind .t.f } -cleanup { destroy .t.f } -result <B9-Key-a> test bind-26.1 {event names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <FocusIn> {nothing} bind .t.f | > > > > > > > > > > > > > > > > > | 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 | } -body { bind .t.f <Button9-a> foo bind .t.f } -cleanup { destroy .t.f } -result <B9-Key-a> test bind-25.54 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <Num-a> foo bind .t.f } -cleanup { destroy .t.f } -result <Mod3-Key-a> test bind-25.55 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <Fn-a> foo bind .t.f } -cleanup { destroy .t.f } -result <Mod4-Key-a> test bind-26.1 {event names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <FocusIn> {nothing} bind .t.f |
︙ | ︙ | |||
5523 5524 5525 5526 5527 5528 5529 | } -cleanup { destroy .t.f } -result {{event Motion} <Motion>} test bind-26.5 {event names: Button} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f | < < < < < < < < < < < < < < | 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 | } -cleanup { destroy .t.f } -result {{event Motion} <Motion>} test bind-26.5 {event names: Button} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Button> "set x {event Button}" set x xyzzy event generate .t.f <Button> list $x [bind .t.f] |
︙ | ︙ | |||
5632 5633 5634 5635 5636 5637 5638 | set x xyzzy event generate .t.f <Key> list $x [bind .t.f] } -cleanup { destroy .t.f } -result {{event Key} <Key>} | < < < < < < < < < < < < < < | 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 | set x xyzzy event generate .t.f <Key> list $x [bind .t.f] } -cleanup { destroy .t.f } -result {{event Key} <Key>} test bind-26.14 {event names: KeyRelease} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <KeyRelease> "set x {event KeyRelease}" |
︙ | ︙ | |||
5959 5960 5961 5962 5963 5964 5965 | test bind-28.5 {keysym names} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { | | | | | 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 | test bind-28.5 {keysym names} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <:> "lappend x \"keysym received\"" bind .t.f <_> "lappend x {bad binding match}" set x [lsort [bind .t.f]] event generate .t.f <:> ;# -state 0 set x } -cleanup { destroy .t.f } -result {: _ {keysym received}} test bind-28.6 {keysym names} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f |
︙ | ︙ | |||
6009 6010 6011 6012 6013 6014 6015 | bind .t.f <x> "lappend x {bad binding match}" set x [lsort [bind .t.f]] event generate .t.f <X> -state 1 set x } -cleanup { destroy .t.f } -result {X x {keysym X}} | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > | 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 | bind .t.f <x> "lappend x {bad binding match}" set x [lsort [bind .t.f]] event generate .t.f <X> -state 1 set x } -cleanup { destroy .t.f } -result {X x {keysym X}} test bind-28.9 {keysym names, Ð} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <Ð> foo bind .t.f } -cleanup { destroy .t.f } -result <Key-Ð> test bind-28.10 {keysym names, Ø} -constraints deprecated -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <Ø> foo bind .t.f } -cleanup { destroy .t.f } -result <Key-Ø> test bind-28.11 {keysym names, gcedilla} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <gcedilla> foo bind .t.f } -cleanup { destroy .t.f } -result <Key-gcedilla> test bind-28.12 {keysym names, Greek_IOTAdiaeresis -> Greek_IOTAdieresis} -constraints deprecated -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <Greek_IOTAdiaeresis> foo bind .t.f } -cleanup { destroy .t.f } -result <Key-Greek_IOTAdieresis> test bind-28.13 {keysym names, Unicode} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <€> foo bind .t.f } -cleanup { destroy .t.f } -result "<Key-€>" test bind-28.14 {keysym names, Emoji} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <\U1F44D> foo bind .t.f } -cleanup { destroy .t.f } -result "<Key-\U1F44D>" test bind-28.15 {keysym names, Emoji} -constraints needsTcl87 -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <👍> foo bind .t.f } -cleanup { destroy .t.f } -result "<Key-👍>" test bind-29.1 {Tcl_BackgroundError procedure} -setup { proc bgerror msg { global x errorInfo set x [list $msg $errorInfo] } |
︙ | ︙ | |||
6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 | # since DoWarp no longer exist, not even as an idle callback frame .t.f pack .t.f focus -force .t.f update } -body { event generate .t.f <Button-1> -warp 1 event generate .t.f <ButtonRelease-1> destroy .t.f update ; # shall simply not crash } -cleanup { } -result {} test bind-32.2 {detection of double click should not fail} -setup { pack [frame .t.f] | > | 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 | # since DoWarp no longer exist, not even as an idle callback frame .t.f pack .t.f focus -force .t.f update } -body { event generate .t.f <Button-1> -warp 1 controlPointerWarpTiming event generate .t.f <ButtonRelease-1> destroy .t.f update ; # shall simply not crash } -cleanup { } -result {} test bind-32.2 {detection of double click should not fail} -setup { pack [frame .t.f] |
︙ | ︙ | |||
6492 6493 6494 6495 6496 6497 6498 | bind .t.f <Double-Button-1> { lappend x "Double" } bind .t.f <Button-1><Button-1> { lappend x "11" } event generate .t.f <Button-1> event generate .t.f <Button-1> set x } -cleanup { destroy .t.f | | | | 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 | bind .t.f <Double-Button-1> { lappend x "Double" } bind .t.f <Button-1><Button-1> { lappend x "11" } event generate .t.f <Button-1> event generate .t.f <Button-1> set x } -cleanup { destroy .t.f } -result Double test bind-33.3 {prefer most specific event} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <a><Double-Button-1><a> { lappend x "Double" } bind .t.f <a><Button-1><Button-1><a> { lappend x "11" } event generate .t.f <a> event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <a> set x } -cleanup { destroy .t.f } -result Double test bind-33.4 {prefer most specific event} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Button-1><Button-1> { lappend x "11" } |
︙ | ︙ | |||
6600 6601 6602 6603 6604 6605 6606 | event generate .t.f <Button-2> event generate .t.f <Button-2> event generate .t.f <Button-1> event generate .t.f <Button-1> set x } -cleanup { destroy .t.f | | | | | | | | | | | 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 | event generate .t.f <Button-2> event generate .t.f <Button-2> event generate .t.f <Button-1> event generate .t.f <Button-1> set x } -cleanup { destroy .t.f } -result last test bind-33.10 {prefer last in case of homogeneous equal patterns} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Button-1><Double-Button-2><Button-1><Button-1> { lappend x "first" } bind .t.f <Button-1><Button-2><Button-2><Double-Button-1> { lappend x "last" } event generate .t.f <Button-1> event generate .t.f <Button-2> event generate .t.f <Button-2> event generate .t.f <Button-1> event generate .t.f <Button-1> set x } -cleanup { destroy .t.f } -result last test bind-33.11 {should prefer most specific} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Button-2><Double-Button-1><Double-Button-2><Double-Button-1><Button-2><Button-2> { lappend x "first" } bind .t.f <Button-2><Button-1><Button-1><Button-2><Button-2><Double-Button-1><Double-Button-2> { lappend x "last" } event generate .t.f <Button-2> event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <Button-2> event generate .t.f <Button-2> event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <Button-2> event generate .t.f <Button-2> set x } -cleanup { destroy .t.f } -result first test bind-33.12 {prefer last in case of homogeneous equal patterns} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Control-Button-1><Button-1> { lappend x "first" } bind .t.f <Button-1><Control-Button-1> { lappend x "last" } event generate .t.f <Control-Button-1> event generate .t.f <Control-Button-1> set x } -cleanup { destroy .t.f } -result last test bind-33.13 {prefer last in case of homogeneous equal patterns} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Button-1><Control-Button-1> { lappend x "first" } bind .t.f <Control-Button-1><Button-1> { lappend x "last" } event generate .t.f <Control-Button-1> event generate .t.f <Control-Button-1> set x } -cleanup { destroy .t.f # Old implementation failed, and returned "first", but this was wrong, # because both bindings are homogeneous equal, so the most recently defined # must be preferred. } -result last test bind-33.14 {prefer last in case of homogeneous equal patterns} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Button-1><Button><Button-1><Button> { lappend x "first" } bind .t.f <Button><Button-1><Button><Button-1> { lappend x "last" } event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <Button-1> set x } -cleanup { destroy .t.f } -result last test bind-33.15 {prefer last in case of homogeneous equal patterns} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Button><Button-1><Button><Button-1> { lappend x "first" } bind .t.f <Button-1><Button><Button-1><Button> { lappend x "last" } event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <Button-1> set x } -cleanup { destroy .t.f # Old implementation failed, and returned "first", but this was wrong, # because both bindings are homogeneous equal, so the most recently defined # must be preferred. } -result last test bind-33.16 {simulate use of the keyboard to trigger a pattern sequence with modifier - bug [16ef161925]} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Escape><Control-c> { lappend x "Esc_Control-c" } |
︙ | ︙ | |||
6807 6808 6809 6810 6811 6812 6813 | } -cleanup { destroy .t.f } -result {1_Button1 1_Button1_2} test bind-34.1 {-warp works relatively to a window} -setup { toplevel .top wm geometry .top +100+100 | | | > | > > > > > > | 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 | } -cleanup { destroy .t.f } -result {1_Button1 1_Button1_2} test bind-34.1 {-warp works relatively to a window} -setup { toplevel .top wm geometry .top +100+100 after 10 ; update } -body { # In order to avoid platform-dependent coordinate results due to # decorations and borders, this test warps the pointer twice # relatively to a window that moved in the meantime, and checks # how much the pointer moved wm geometry .top +200+200 after 10 ; update event generate .top <Motion> -x 20 -y 20 -warp 1 controlPointerWarpTiming set pointerPos1 [winfo pointerxy .top] wm geometry .top +600+600 after 10 ; update event generate .top <Motion> -x 20 -y 20 -warp 1 controlPointerWarpTiming set pointerPos2 [winfo pointerxy .top] # from the first warped position to the second one, the mouse # pointer should have moved the same amount as the window moved set res 1 foreach pos1 $pointerPos1 pos2 $pointerPos2 { if {$pos1 != [expr {$pos2 - 400}]} { set res [list $pointerPos1 $pointerPos2] } } set res } -cleanup { destroy .top } -result 1 test bind-34.2 {-warp works relatively to the screen} -setup { } -body { # Contrary to bind-34.1, we're directly checking screen coordinates event generate {} <Motion> -x 20 -y 20 -warp 1 controlPointerWarpTiming set res [winfo pointerxy .] event generate {} <Motion> -x 200 -y 200 -warp 1 controlPointerWarpTiming lappend res {*}[winfo pointerxy .] } -cleanup { } -result {20 20 200 200} test bind-34.3 {-warp works with null or negative coordinates} -setup { # On some OS/WM, at least Linux with KDE, the "Screen edges" feature # provides hot spots that can be associated with some action. # When activated, the WM will not allow warping to happen on top of # a hot spot (which would trigger the corresponding action as an # unwanted effect) but will warp the pointer to the hot spot limit only. if {[tk windowingsystem] eq "x11"} { set halo 1 } else { set halo 0 } set res {} } -body { event generate {} <Motion> -x 0 -y 0 -warp 1 controlPointerWarpTiming foreach dim [winfo pointerxy .] { if {$dim <= $halo} { lappend res ok } else { lappend res $dim } } event generate {} <Motion> -x 100 -y 100 -warp 1 controlPointerWarpTiming event generate {} <Motion> -x -1 -y -1 -warp 1 controlPointerWarpTiming foreach dim [winfo pointerxy .] { if {$dim <= $halo} { lappend res ok } else { lappend res $dim } } |
︙ | ︙ | |||
6976 6977 6978 6979 6980 6981 6982 | } -result {F2 F2} test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup { } -body { global keyInfo numericalKeysym set result {} bind . <Key> { | | | | 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 | } -result {F2 F2} test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup { } -body { global keyInfo numericalKeysym set result {} bind . <Key> { set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k] set numericalKeysym [format "0x%x" %N] } foreach event { {<Control_L> -control} {<Control_R> -control} {<Alt_L> -option} {<Alt_R> -option} {<Meta_L> -command} |
︙ | ︙ | |||
7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 | } return pass } -cleanup { } -result pass test bind-36.1 {pointer warp with grab on toplevel, bug [e3888d5820]} -setup { event generate {} <Motion> -warp 1 -x 50 -y 50 toplevel .top grab release .top wm geometry .top 200x200+300+300 label .top.l -height 5 -width 20 -highlightthickness 2 \ -highlightbackground black -bg yellow -text "My label" pack .top.l -side bottom update # On KDE/Plasma _with_the_Aurorae_theme_ (at least), setting up the toplevel # and the label will not be finished after the above 'update'. The WM still # needs some time before the window is fully ready. For me 50 ms is enough, # but let's wait more (it depends on computer performance). after 100 ; update } -body { grab .top event generate .top.l <Motion> -warp 1 -x 10 -y 10 foreach {x1 y1} [winfo pointerxy .top.l] {} event generate {} <Motion> -warp 1 -x 50 -y 50 grab release .top event generate .top.l <Motion> -warp 1 -x 10 -y 10 foreach {x2 y2} [winfo pointerxy .top.l] {} # success if the coords are the same with or without the grab, and if they # are at (10,10) inside the label widget as requested by the warping expr {$x1==$x2 && $y1==$y2 && $x1==[winfo rootx .top.l]+10 \ && $y1==[winfo rooty .top.l]+10} } -cleanup { destroy .top | > > > > | 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 | } return pass } -cleanup { } -result pass test bind-36.1 {pointer warp with grab on toplevel, bug [e3888d5820]} -setup { event generate {} <Motion> -warp 1 -x 50 -y 50 controlPointerWarpTiming toplevel .top grab release .top wm geometry .top 200x200+300+300 label .top.l -height 5 -width 20 -highlightthickness 2 \ -highlightbackground black -bg yellow -text "My label" pack .top.l -side bottom update # On KDE/Plasma _with_the_Aurorae_theme_ (at least), setting up the toplevel # and the label will not be finished after the above 'update'. The WM still # needs some time before the window is fully ready. For me 50 ms is enough, # but let's wait more (it depends on computer performance). after 100 ; update } -body { grab .top event generate .top.l <Motion> -warp 1 -x 10 -y 10 controlPointerWarpTiming foreach {x1 y1} [winfo pointerxy .top.l] {} event generate {} <Motion> -warp 1 -x 50 -y 50 controlPointerWarpTiming grab release .top event generate .top.l <Motion> -warp 1 -x 10 -y 10 controlPointerWarpTiming foreach {x2 y2} [winfo pointerxy .top.l] {} # success if the coords are the same with or without the grab, and if they # are at (10,10) inside the label widget as requested by the warping expr {$x1==$x2 && $y1==$y2 && $x1==[winfo rootx .top.l]+10 \ && $y1==[winfo rooty .top.l]+10} } -cleanup { destroy .top |
︙ | ︙ |
Changes to tests/bitmap.test.
1 2 3 4 5 | # This file is a Tcl script to test out the procedures in the file # tkBitmap.c. It is organized in the standard white-box fashion for # Tcl tests. # # Copyright © 1998 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the procedures in the file # tkBitmap.c. It is organized in the standard white-box fashion for # Tcl tests. # # Copyright © 1998 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/border.test.
1 2 3 4 | # This file is a Tcl script to test out the procedures in the file # tkBorder.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1998 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test out the procedures in the file # tkBorder.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1998 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/busy.test.
1 2 3 4 5 6 | # Tests for the tk busy command. # # This file contains a collection of tests for one or more of the Tk built-in # commands. Sourcing this file runs the tests and generates output for errors. # No output means no errors were found. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Tests for the tk busy command. # # This file contains a collection of tests for one or more of the Tk built-in # commands. Sourcing this file runs the tests and generates output for errors. # No output means no errors were found. # # Copyright © 1998-2000 Jos Decoster. All rights reserved. package require tcltest 2.2 tcltest::configure {*}$argv tcltest::loadTestedCommands namespace import -force tcltest::test # There's currently no way to test the actual grab effect, per se, in an |
︙ | ︙ |
Changes to tests/butGeom2.tcl.
1 2 3 4 5 6 7 8 9 10 | # This file creates a visual test for button layout. It is part of # the Tk visual test suite, which is invoked via the "visual" script. catch {destroy .t} toplevel .t wm title .t "Visual Tests for Button Geometry" wm iconname .t "Button Geometry" wm geom .t +0+0 wm minsize .t 1 1 | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # This file creates a visual test for button layout. It is part of # the Tk visual test suite, which is invoked via the "visual" script. catch {destroy .t} toplevel .t wm title .t "Visual Tests for Button Geometry" wm iconname .t "Button Geometry" wm geom .t +0+0 wm minsize .t 1 1 label .t.l -text {This screen exercises the color options for various flavors of buttons. Select display options below, and they will be applied to the appropriate button widgets.} -wraplength 5i pack .t.l -side top -fill both button .t.quit -text Quit -command {destroy .t} pack .t.quit -side bottom -pady 2m set sepId 1 proc sep {} { |
︙ | ︙ |
Changes to tests/button.test.
1 2 3 4 5 6 | # This file is a Tcl script to test labels, buttons, checkbuttons, and # radiobuttons in Tk (i.e., all the widgets defined in tkButton.c). It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test labels, buttons, checkbuttons, and # radiobuttons in Tk (i.e., all the widgets defined in tkButton.c). It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit |
︙ | ︙ | |||
1740 1741 1742 1743 1744 1745 1746 | update } -body { .b configure -overrelief "" .b cget -overrelief } -cleanup { destroy .b } -result {} | | | | | | | | 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 | update } -body { .b configure -overrelief "" .b cget -overrelief } -cleanup { destroy .b } -result {} test button-1.178 {configuration option: "overrelief" for button} -constraints needsTcl87 -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -overrelief 1.5 } -cleanup { destroy .b } -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, sunken, or ""} test button-1.179 {configuration option: "overrelief" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -overrelief "" .c cget -overrelief } -cleanup { destroy .c } -result {} test button-1.180 {configuration option: "overrelief" for checkbutton} -constraints needsTcl87 -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -overrelief 1.5 } -cleanup { destroy .c } -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, sunken, or ""} test button-1.181 {configuration option: "overrelief" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -overrelief "" .r cget -overrelief } -cleanup { destroy .r } -result {} test button-1.182 {configuration option: "overrelief" for radiobutton} -constraints needsTcl87 -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -overrelief 1.5 } -cleanup { destroy .r } -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, sunken, or ""} test button-1.183 {configuration option: "padx" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -padx 12m |
︙ | ︙ | |||
2410 2411 2412 2413 2414 2415 2416 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -underline 3p } -cleanup { destroy .l | | | | | | 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -underline 3p } -cleanup { destroy .l } -returnCodes {error} -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} test button-1.245 {configuration option: "underline" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -underline 5 .b cget -underline } -cleanup { destroy .b } -result 5 test button-1.246 {configuration option: "underline" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -underline 3p } -cleanup { destroy .b } -returnCodes {error} -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} test button-1.247 {configuration option: "underline" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -underline 5 .c cget -underline } -cleanup { destroy .c } -result 5 test button-1.248 {configuration option: "underline" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -underline 3p } -cleanup { destroy .c } -returnCodes {error} -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} test button-1.249 {configuration option: "underline" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -underline 5 .r cget -underline } -cleanup { destroy .r } -result 5 test button-1.250 {configuration option: "underline" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -underline 3p } -cleanup { destroy .r } -returnCodes {error} -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} test button-1.251 {configuration option: "tristatevalue" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -tristatevalue unknowable |
︙ | ︙ |
Changes to tests/canvImg.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the procedures in tkCanvImg.c, # which implement canvas "image" items. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out the procedures in tkCanvImg.c, # which implement canvas "image" items. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit |
︙ | ︙ | |||
162 163 164 165 166 167 168 | image create test foo -variable x image create test foo2 -variable y foo2 changed 0 0 0 0 80 60 .c create image 50 100 -image foo -tags i1 -anchor nw update set x {} set y {} | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | image create test foo -variable x image create test foo2 -variable y foo2 changed 0 0 0 0 80 60 .c create image 50 100 -image foo -tags i1 -anchor nw update set x {} set y {} set timer [after 500 {lappend y "timed out"}] .c itemconfigure i1 -image foo2 update idletasks update # On MacOS we need to wait for the test image display procedure to run. while {"timed out" ni $y && [lindex $y end 1] ne "display"} { vwait y } |
︙ | ︙ | |||
357 358 359 360 361 362 363 | .c create image 20 30 -image foo -tags i1 -anchor center .c bbox i1 } -cleanup { .c delete all image delete foo } -result {5 23 35 38} | < < < | | | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | .c create image 20 30 -image foo -tags i1 -anchor center .c bbox i1 } -cleanup { .c delete all image delete foo } -result {5 23 35 38} test canvImg-7.1 {DisplayImage procedure} -constraints { testImageType } -setup { .c delete all } -body { image create test foo -variable x .c create image 50 100 -image foo -tags i1 -anchor nw update set x {} .c create rect 55 110 65 115 -width 1 -outline black -fill white update set x } -result {{foo display 4 9 12 6}} test canvImg-7.2 {DisplayImage procedure, no image} -body { .c delete all .c create image 50 100 -tags i1 update .c create rect 55 110 65 115 -width 1 -outline black -fill white update } -result {} |
︙ | ︙ |
Changes to tests/canvMoveto.test.
1 2 3 4 | # This file is a Tcl script to test out the canvas "moveto" command. It is # derived from canvRect.test. # # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test out the canvas "moveto" command. It is # derived from canvRect.test. # # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 2004 Neil McKay. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/canvPs.test.
1 2 3 4 5 | # This file is a Tcl script to test out procedures to write postscript # for canvases to files and channels. It exercises the procedure # TkCanvPostscriptCmd in generic/tkCanvPs.c # # Copyright © 1995 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out procedures to write postscript # for canvases to files and channels. It exercises the procedure # TkCanvPostscriptCmd in generic/tkCanvPs.c # # Copyright © 1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit |
︙ | ︙ | |||
129 130 131 132 133 134 135 | } -cleanup { removeFile foo.ps removeFile bar.ps } -result ok destroy .c | | < < | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | } -cleanup { removeFile foo.ps removeFile bar.ps } -result ok destroy .c test canvPs-3.1 {test ps generation with an embedded window} -setup { set bar [makeFile {} bar.ps] file delete $bar } -body { pack [canvas .c -width 200 -height 200 -background white] .c create rect 20 20 150 150 -tags rect0 -dash . -width 2 .c create arc 0 50 200 200 -tags arc0 \ -dash {4 4} -stipple question -outline red -fill green |
︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 | test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} -body { pack [canvas .c] .c create poly 10 20 10 20 .c postscript } -cleanup { destroy .c } -returnCodes ok -match glob -result * # cleanup unset -nocomplain foo bar imageFinish | > > > > > > > > > > > > > > > > > > | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} -body { pack [canvas .c] .c create poly 10 20 10 20 .c postscript } -cleanup { destroy .c } -returnCodes ok -match glob -result * test canvPs-5.1 {test ps generation with bitmap, bug 424773a00c} -body { pack [canvas .c] update .c create bitmap 50 50 -bitmap questhead .c postscript ; # was crashing on macOS } -cleanup { destroy .c } -returnCodes ok -match glob -result * test canvPs-5.2 {test ps generation with image} -body { pack [canvas .c] update .c create image 50 50 -image ::tk::icons::information .c postscript } -cleanup { destroy .c } -returnCodes ok -match glob -result * # cleanup unset -nocomplain foo bar imageFinish |
︙ | ︙ |
Changes to tests/canvRect.test.
1 2 3 4 5 | # This file is a Tcl script to test out the procedures in tkRectOval.c, # which implement canvas "rectangle" and "oval" items. It is organized # in the standard fashion for Tcl tests. # # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the procedures in tkRectOval.c, # which implement canvas "rectangle" and "oval" items. It is organized # in the standard fashion for Tcl tests. # # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
119 120 121 122 123 124 125 | } -returnCodes error -result {bad screen distance "c"} test canvRect-3.5 {RectOvalCoords procedure} -body { .c create rectangle 10 20 30 40 -tags x .c coords x 1 2 3 d } -cleanup { .c delete withtag all } -returnCodes error -result {bad screen distance "d"} | | < < < | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | } -returnCodes error -result {bad screen distance "c"} test canvRect-3.5 {RectOvalCoords procedure} -body { .c create rectangle 10 20 30 40 -tags x .c coords x 1 2 3 d } -cleanup { .c delete withtag all } -returnCodes error -result {bad screen distance "d"} test canvRect-3.6 {RectOvalCoords procedure} -body { .c create rectangle 10 20 30 40 -tags x .c coords x 10 25 15 40 .c bbox x } -cleanup { .c delete withtag all } -result {9 24 16 41} test canvRect-3.7 {RectOvalCoords procedure} -body { .c create rectangle 10 20 30 40 -tags x |
︙ | ︙ | |||
156 157 158 159 160 161 162 | } -result {1.0} test canvRect-4.3 {ConfigureRectOval procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 .c itemconfigure x -width -5 } -cleanup { .c delete withtag all } -returnCodes error -result {bad screen distance "-5"} | | < | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | } -result {1.0} test canvRect-4.3 {ConfigureRectOval procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 .c itemconfigure x -width -5 } -cleanup { .c delete withtag all } -returnCodes error -result {bad screen distance "-5"} test canvRect-4.4 {ConfigureRectOval procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 .c itemconfigure x -width 10 .c bbox x } -cleanup { .c delete withtag all } -result {5 15 35 45} |
︙ | ︙ |
Changes to tests/canvText.test.
1 2 3 4 5 | # This file is a Tcl script to test out the procedures in tkCanvText.c, # which implement canvas "text" items. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1996-1997 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file is a Tcl script to test out the procedures in tkCanvText.c, # which implement canvas "text" items. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1996-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # Canvas used in 1.* - 17.* tests canvas .c -width 400 -height 300 -bd 2 -relief sunken pack .c update |
︙ | ︙ | |||
62 63 64 65 66 67 68 | } -returnCodes error -result {bitmap "abcxyz" not defined} test canvText-1.12 {configuration options: good value for "underline"} -body { .c itemconfigure test -underline 0 list [lindex [.c itemconfigure test -underline] 4] [.c itemcget test -underline] } -result {0 0} test canvasText-1.13 {configuration options: bad value for "underline"} -body { .c itemconfigure test -underline xyz | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | } -returnCodes error -result {bitmap "abcxyz" not defined} test canvText-1.12 {configuration options: good value for "underline"} -body { .c itemconfigure test -underline 0 list [lindex [.c itemconfigure test -underline] 4] [.c itemcget test -underline] } -result {0 0} test canvasText-1.13 {configuration options: bad value for "underline"} -body { .c itemconfigure test -underline xyz } -returnCodes error -result {bad index "xyz": must be integer?[+-]integer?, end?[+-]integer?, or ""} test canvText-1.14 {configuration options: good value for "width"} -body { .c itemconfigure test -width 6 list [lindex [.c itemconfigure test -width] 4] [.c itemcget test -width] } -result {6 6} test canvasText-1.15 {configuration options: bad value for "width"} -body { .c itemconfigure test -width xyz } -returnCodes error -result {bad screen distance "xyz"} |
︙ | ︙ | |||
752 753 754 755 756 757 758 | .c select from test 5 .c select to test 8 .c icursor test 12 .c coords test 0 0 list [.c index test end] [.c index test insert] \ [.c index test sel.first] [.c index test sel.last] \ [.c index test @0,0] \ | | | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | .c select from test 5 .c select to test 8 .c icursor test 12 .c coords test 0 0 list [.c index test end] [.c index test insert] \ [.c index test sel.first] [.c index test sel.last] \ [.c index test @0,0] \ [.c index test {}] [.c index test 10] [.c index test 100] } -cleanup { .c delete test } -result {15 12 5 8 0 0 10 15} test canvText-14.2 {GetTextIndex procedure: select error} -setup { .c create text 0 0 -tag test focus .c .c focus test |
︙ | ︙ |
Changes to tests/canvWind.test.
1 2 3 4 5 | # This file is a Tcl script to test out the procedures in tkCanvWind.c, # which implement canvas "window" items. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the procedures in tkCanvWind.c, # which implement canvas "window" items. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 | lappend x [list [winfo ismapped $f] [winfo x $f]] .t.c xview scroll -1 units update lappend x [list [winfo ismapped $f] [winfo x $f]] } -cleanup { destroy .t } -result {{1 3} {1 -79} {0 -79} {1 255} {0 255}} # cleanup cleanupTests return | > > > > > > > > > > > > > > > > | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | lappend x [list [winfo ismapped $f] [winfo x $f]] .t.c xview scroll -1 units update lappend x [list [winfo ismapped $f] [winfo x $f]] } -cleanup { destroy .t } -result {{1 3} {1 -79} {0 -79} {1 255} {0 255}} test canvWind-2.1 {DisplayWinItem, window gets destroyed during <Configure>} -setup { destroy .t } -body { toplevel .t canvas .t.c pack .t.c frame .t.c.f -width 50 -height 50 -background red set id [.t.c create window 50 50 -window .t.c.f] update bind .t.c.f <Configure> {destroy .t.c.f} .t.c coords $id 60 60 ; # was crashing update } -cleanup { destroy .t } -result {} # cleanup cleanupTests return |
Changes to tests/canvas.test.
︙ | ︙ | |||
212 213 214 215 216 217 218 | .c xview moveto 0 update set x [list [.c xview]] .c xview scroll 2 units update lappend x [.c xview] } -result {{0.0 0.3} {0.4 0.7}} | | < < | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | .c xview moveto 0 update set x [list [.c xview]] .c xview scroll 2 units update lappend x [.c xview] } -result {{0.0 0.3} {0.4 0.7}} test canvas-2.4 {CanvasWidgetCmd, xview option} -body { .c configure -xscrollincrement 0 -yscrollincrement 5 .c xview moveto 0.6 update set x [list [.c xview]] .c xview scroll 2 units update lappend x [.c xview] |
︙ | ︙ | |||
754 755 756 757 758 759 760 761 762 763 764 765 766 767 | test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setup { destroy .c canvas .c } -body { set id [.c create rect 0 0 1cm 1cm] expr {[lindex [.c coords $id] 2]>1} } -result 1 destroy .c test canvas-16.1 {arc coords check} -setup { canvas .c } -body { set id [.c create arc {0 10 20 30} -start 33] .c itemcget $id -start | > > > > > > > > > > > > > > > > | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setup { destroy .c canvas .c } -body { set id [.c create rect 0 0 1cm 1cm] expr {[lindex [.c coords $id] 2]>1} } -result 1 test canvas-15.20 {bug [237971ce]} -setup { destroy .c canvas .c } -body { set id [.c create line {0 0 50 50 100 50}] .c insert $id end {200 200} .c coords $id } -result {0.0 0.0 50.0 50.0 100.0 50.0 200.0 200.0} test canvas-15.21 {bug [237971ce]} -setup { destroy .c canvas .c } -body { set id [.c create poly {0 0 50 50 100 50}] .c insert $id end {200 200} .c coords $id } -result {0.0 0.0 50.0 50.0 100.0 50.0 200.0 200.0} destroy .c test canvas-16.1 {arc coords check} -setup { canvas .c } -body { set id [.c create arc {0 10 20 30} -start 33] .c itemcget $id -start |
︙ | ︙ |
Changes to tests/choosedir.test.
1 2 3 4 | # This file is a Tcl script to test out Tk's "tk_chooseDir" and # It is organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test out Tk's "tk_chooseDir" and # It is organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
98 99 100 101 102 103 104 | tk_chooseDirectory -title } -returnCodes error -result {value for "-title" missing} test choosedir-1.5.1 {tk_chooseDirectory command} -constraints notAqua -body { tk_chooseDirectory -foo bar } -returnCodes error -result {bad option "-foo": must be -initialdir, -mustexist, -parent, or -title} test choosedir-1.5.2 {tk_chooseDirectory command} -constraints aqua -body { tk_chooseDirectory -foo bar | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | tk_chooseDirectory -title } -returnCodes error -result {value for "-title" missing} test choosedir-1.5.1 {tk_chooseDirectory command} -constraints notAqua -body { tk_chooseDirectory -foo bar } -returnCodes error -result {bad option "-foo": must be -initialdir, -mustexist, -parent, or -title} test choosedir-1.5.2 {tk_chooseDirectory command} -constraints aqua -body { tk_chooseDirectory -foo bar } -returnCodes error -result {bad option "-foo": must be -command, -initialdir, -message, -mustexist, -parent, or -title} test choosedir-1.6 {tk_chooseDirectory command} -body { tk_chooseDirectory -parent foo.bar } -returnCodes error -result {bad window path name "foo.bar"} test choosedir-2.1 {tk_chooseDirectory command, cancel gives null} -constraints { unix notAqua |
︙ | ︙ |
Changes to tests/clipboard.test.
1 2 3 4 5 | # This file is a Tcl script to test out Tk's clipboard management code, # especially the "clipboard" command. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out Tk's clipboard management code, # especially the "clipboard" command. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. # # Note: Multiple display clipboard handling will only be tested if the # environment variable TK_ALT_DISPLAY is set to an alternate display. # |
︙ | ︙ |
Changes to tests/clrpick.test.
1 2 3 4 | # This file is a Tcl script to test out Tk's "tk_chooseColor" command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # This file is a Tcl script to test out Tk's "tk_chooseColor" command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] if {[testConstraint defaultPseudocolor8]} { # let's soak up a bunch of colors...so that # machines with small color palettes still fail. # some tests will be skipped if there are no more colors set numcolors 32 testConstraint colorsLeftover 1 |
︙ | ︙ | |||
168 169 170 171 172 173 174 | nonUnixUserInteraction colorsLeftover } -body { set colors "128 128 64" ToChooseColorByKey . 128 128 64 tk_chooseColor -parent . -title "choose #808040" } -result {#808040} test clrpick-2.3 {tk_chooseColor command} -constraints { | | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | nonUnixUserInteraction colorsLeftover } -body { set colors "128 128 64" ToChooseColorByKey . 128 128 64 tk_chooseColor -parent . -title "choose #808040" } -result {#808040} test clrpick-2.3 {tk_chooseColor command} -constraints { nonUnixUserInteraction colorsLeftover failsOnXQuarz } -body { ToPressButton . ok tk_chooseColor -parent . -title "Press OK" } -result {#808040} test clrpick-2.4 {tk_chooseColor command} -constraints { nonUnixUserInteraction colorsLeftover } -body { |
︙ | ︙ |
Added tests/cluster.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | # This file is a Tcl script to test the [::tk::startOf|endOf]* functions in # tk.tcl and tkIcu.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint needsTcl87orICU [expr {[package vsatisfies [package provide Tcl] 8.7] || [catch {info body ::tk::startOfCluster}]}] test cluster-1.0 {::tk::startOfCluster} -body { ::tk::startOfCluster 🤡 -1 } -result {} test cluster-1.1 {::tk::startOfCluster} -body { ::tk::startOfCluster 🤡 0 } -result 0 test cluster-1.2 {::tk::startOfCluster} -constraints needsTcl87orICU -body { ::tk::startOfCluster 🤡 1 } -result 0 test cluster-1.3 {::tk::startOfCluster} -constraints needsTcl87orICU -body { ::tk::startOfCluster 🤡 2 } -result 2 test cluster-1.4 {::tk::startOfCluster} -constraints needsTcl87orICU -body { ::tk::startOfCluster 🤡 3 } -result 2 test cluster-1.5 {::tk::startOfCluster} -constraints needsTcl87orICU -body { ::tk::startOfCluster 🤡 end } -result 0 test cluster-1.6 {::tk::startOfCluster} -body { ::tk::startOfCluster 🤡 {} } -result {} test cluster-1.7 {::tk::startOfCluster} -constraints needsTcl87orICU -body { ::tk::startOfCluster 🤡 end-1 } -result 0 test cluster-2.0 {::tk::endOfCluster} -body { ::tk::endOfCluster 🤡 -1 } -result 0 test cluster-2.1 {::tk::endOfCluster} -constraints needsTcl87orICU -body { ::tk::endOfCluster 🤡 0 } -result 2 test cluster-2.2 {::tk::endOfCluster} -constraints needsTcl87orICU -body { ::tk::endOfCluster 🤡 1 } -result 2 test cluster-2.3 {::tk::endOfCluster} -body { ::tk::endOfCluster 🤡 2 } -result {} test cluster-2.4 {::tk::endOfCluster} -body { ::tk::endOfCluster 🤡 3 } -result {} test cluster-2.5 {::tk::endOfCluster} -constraints needsTcl87orICU -body { ::tk::endOfCluster 🤡 end } -result 2 test cluster-2.6 {::tk::endOfCluster} -body { ::tk::endOfCluster 🤡 {} } -result 0 test cluster-2.7 {::tk::endOfCluster} -constraints needsTcl87orICU -body { ::tk::endOfCluster 🤡 end-1 } -result 2 test cluster-3.0 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" -1 } -result 2 test cluster-3.1 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" 0 } -result 2 test cluster-3.2 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" 1 } -result 2 test cluster-3.3 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" 2 } -result {} test cluster-3.4 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" 3 } -result {} test cluster-3.5 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" 4 } -result {} test cluster-3.6 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" 5 } -result {} test cluster-3.7 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" end } -result {} test cluster-3.8 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" {} } -result 2 test cluster-3.9 {::tk::endOfWord} -body { ::tk::endOfWord "ab cd" end-1 } -result {} test cluster-4.0 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" -1 } -result {} test cluster-4.1 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" 0 } -result {} test cluster-4.2 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" 1 } -result 0 test cluster-4.3 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" 2 } -result 0 test cluster-4.4 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" 3 } -result 0 test cluster-4.5 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" 4 } -result 3 test cluster-4.6 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" 5 } -result 3 test cluster-4.7 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" end } -result 3 test cluster-4.8 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" {} } -result {} test cluster-4.9 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord "ab cd" end-1 } -result 0 test cluster-5.0 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" -1 } -result 3 test cluster-5.1 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" 0 } -result 3 test cluster-5.2 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" 1 } -result 3 test cluster-5.3 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" 2 } -result 3 test cluster-5.4 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" 3 } -result {} test cluster-5.5 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" 4 } -result {} test cluster-5.6 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" 5 } -result {} test cluster-5.7 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" end } -result {} test cluster-5.8 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" {} } -result 3 test cluster-5.9 {::tk::startOfNextWord} -body { ::tk::startOfNextWord "ab cd" end-1 } -result {} test cluster-6.0 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" -1 } -result {} test cluster-6.1 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" 0 } -result {} test cluster-6.2 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" 1 } -result {} test cluster-6.3 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" 2 } -result 2 test cluster-6.4 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" 3 } -result 3 test cluster-6.5 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" 4 } -result 3 test cluster-6.6 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" 5 } -result 3 test cluster-6.7 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" end } -result 3 test cluster-6.8 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore "ab cd" {} } -result {} test cluster-6.9 {::tk::wordBreakBefore} -body { ::tk::startOfNextWord "ab cd" end-1 } -result {} test cluster-7.0 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" -1 } -result 2 test cluster-7.1 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" 0 } -result 2 test cluster-7.2 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" 1 } -result 2 test cluster-7.3 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" 2 } -result 3 test cluster-7.4 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" 3 } -result {} test cluster-7.5 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" 4 } -result {} test cluster-7.6 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" 5 } -result {} test cluster-7.7 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" end } -result {} test cluster-7.8 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" {} } -result 2 test cluster-7.9 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter "ab cd" end-1 } -result {} test cluster-8.0 {::tk::startOfCluster} -body { ::tk::startOfCluster a b c d } -returnCodes 1 -result {wrong # args: should be "::tk::startOfCluster str start ?locale?"} test cluster-8.1 {::tk::endOfCluster} -body { ::tk::endOfCluster a b c d } -returnCodes 1 -result {wrong # args: should be "::tk::endOfCluster str start ?locale?"} test cluster-8.2 {::tk::startOfPreviousWord} -body { ::tk::startOfPreviousWord a b c d } -returnCodes 1 -result {wrong # args: should be "::tk::startOfPreviousWord str start ?locale?"} test cluster-8.3 {::tk::startOfNextWord} -body { ::tk::startOfNextWord a b c d } -returnCodes 1 -result {wrong # args: should be "::tk::startOfNextWord str start ?locale?"} test cluster-8.4 {::tk::endOfWord} -body { ::tk::endOfWord a b c d } -returnCodes 1 -result {wrong # args: should be "::tk::endOfWord str start ?locale?"} test cluster-8.5 {::tk::wordBreakBefore} -body { ::tk::wordBreakBefore a b c d } -returnCodes 1 -result {wrong # args: should be "::tk::wordBreakBefore str start ?locale?"} test cluster-8.6 {::tk::wordBreakAfter} -body { ::tk::wordBreakAfter a b c d } -returnCodes 1 -result {wrong # args: should be "::tk::wordBreakAfter str start ?locale?"} cleanupTests return |
Changes to tests/cmds.test.
1 2 3 4 | # This file is a Tcl script to test the procedures in the file # tkCmds.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test the procedures in the file # tkCmds.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/color.test.
1 2 3 4 | # This file is a Tcl script to test out the procedures in the file # tkColor.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1995-1998 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test out the procedures in the file # tkColor.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1995-1998 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands # cname -- |
︙ | ︙ | |||
159 160 161 162 163 164 165 | pack .b2 -side top lappend result [testcolor purple] } {{{1 1}} {{1 1} {1 0}} {{1 0} {2 1}}} test color-1.5 {Color table} nonPortable { set fd [open ../xlib/rgb.txt] set result {} while {[gets $fd line] >= 0} { | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | pack .b2 -side top lappend result [testcolor purple] } {{{1 1}} {{1 1} {1 0}} {{1 0} {2 1}}} test color-1.5 {Color table} nonPortable { set fd [open ../xlib/rgb.txt] set result {} while {[gets $fd line] >= 0} { if {[string index $line 0] == "!"} continue set rgb [c255 [winfo rgb . [lrange $line 3 end]]] if {$rgb != [lrange $line 0 2] } { append result $line\n } } return $result |
︙ | ︙ |
Changes to tests/config.test.
1 2 3 4 5 | # This file is a Tcl script to test the procedures in tkConfig.c, # which comprise the new new option configuration system. It is # organized in the standard "white-box" fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test the procedures in tkConfig.c, # which comprise the new new option configuration system. It is # organized in the standard "white-box" fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
38 39 40 41 42 43 44 | testobjconfig alltypes .a lappend x [testobjconfig info alltypes] testobjconfig alltypes .b lappend x [testobjconfig info alltypes] set x } -cleanup { killTables | | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | testobjconfig alltypes .a lappend x [testobjconfig info alltypes] testobjconfig alltypes .b lappend x [testobjconfig info alltypes] set x } -cleanup { killTables } -result {{1 17 -boolean} {2 17 -boolean}} test config-1.2 {Tk_CreateOptionTable - synonym initialization} -constraints { testobjconfig } -body { testobjconfig alltypes .a -synonym green .a cget -color } -cleanup { killTables } -result green test config-1.3 {Tk_CreateOptionTable - option database initialization} -constraints { testobjconfig } -body { testobjconfig alltypes .a option add *b.string different testobjconfig alltypes .b list [.a cget -string] [.b cget -string] |
︙ | ︙ | |||
73 74 75 76 77 78 79 | killTables option clear } -result {foo bar} test config-1.5 {Tk_CreateOptionTable - default initialization} -constraints { testobjconfig } -body { testobjconfig alltypes .a | | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | killTables option clear } -result {foo bar} test config-1.5 {Tk_CreateOptionTable - default initialization} -constraints { testobjconfig } -body { testobjconfig alltypes .a .a cget -anchor } -cleanup { killTables } -result center test config-1.6 {Tk_CreateOptionTable - chained tables} -constraints { testobjconfig } -body { testobjconfig chain1 .a testobjconfig chain2 .b testobjconfig info chain2 } -cleanup { |
︙ | ︙ | |||
152 153 154 155 156 157 158 | } -body { option add *a.color blue testobjconfig alltypes .a list [.a cget -color] } -cleanup { killTables option clear | | | | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | } -body { option add *a.color blue testobjconfig alltypes .a list [.a cget -color] } -cleanup { killTables option clear } -result blue test config-3.3 {Tk_InitOptions - initialize from database} -constraints { testobjconfig } -body { option add *a.justify bogus testobjconfig alltypes .a list [.a cget -justify] } -cleanup { killTables option clear } -result left test config-3.4 {Tk_InitOptions - initialize from widget class} -constraints { testobjconfig } -body { testobjconfig alltypes .a list [.a cget -color] } -cleanup { killTables } -result red test config-3.5 {Tk_InitOptions - no initial value} -constraints { testobjconfig } -body { testobjconfig alltypes .a .a cget -relief } -cleanup { killTables } -result {} test config-3.6 {Tk_InitOptions - bad initial value} -constraints { testobjconfig } -body { option add *a.color non-existent |
︙ | ︙ | |||
206 207 208 209 210 211 212 | invoked from within "testobjconfig alltypes .a"} test config-3.8 {Tk_InitOptions - bad initial value} -constraints { testobjconfig } -body { testobjconfig configerror | | | | | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | invoked from within "testobjconfig alltypes .a"} test config-3.8 {Tk_InitOptions - bad initial value} -constraints { testobjconfig } -body { testobjconfig configerror } -returnCodes error -result {expected integer or "" but got "bogus"} test config-3.9 {Tk_InitOptions - bad initial value} -constraints { testobjconfig } -body { catch {testobjconfig configerror} return $errorInfo } -result {expected integer or "" but got "bogus" (default value for "-int") invoked from within "testobjconfig configerror"} test config-4.1 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -boolean 0 } -cleanup { killTables } -returnCodes ok -result .foo test config-4.2 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -boolean 0 .foo cget -boolean } -cleanup { killTables |
︙ | ︙ | |||
247 248 249 250 251 252 253 | } -returnCodes ok test config-4.4 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -boolean 1 } -cleanup { killTables | | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | } -returnCodes ok test config-4.4 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -boolean 1 } -cleanup { killTables } -returnCodes ok -result .foo test config-4.5 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -boolean 1 .foo cget -boolean } -cleanup { killTables |
︙ | ︙ | |||
270 271 272 273 274 275 276 | killTables } -returnCodes ok test config-4.7 {DoObjConfig - invalid boolean} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { | | | | | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | killTables } -returnCodes ok test config-4.7 {DoObjConfig - invalid boolean} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -boolean foo } -cleanup { killTables } -returnCodes error -result {expected boolean value or "" but got "foo"} test config-4.8 {DoObjConfig - boolean internal value} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -boolean 0 .foo cget -boolean } -cleanup { killTables } -result 0 test config-4.9 {DoObjConfig - integer} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -integer 3 } -cleanup { killTables } -returnCodes ok -result .foo test config-4.10 {DoObjConfig - integer} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -integer 3 .foo cget -integer } -cleanup { killTables |
︙ | ︙ | |||
337 338 339 340 341 342 343 | test config-4.14 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -double 3.14 } -cleanup { killTables | | | | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | test config-4.14 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -double 3.14 } -cleanup { killTables } -returnCodes ok -result .foo test config-4.15 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -double 3.14 .foo cget -double } -cleanup { killTables } -returnCodes ok -result 3.14 test config-4.16 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -double 3.14 .foo cget -double rename .foo {} } -cleanup { |
︙ | ︙ | |||
373 374 375 376 377 378 379 | } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -double 62.75 .foo cget -double } -cleanup { killTables | | | | | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -double 62.75 .foo cget -double } -cleanup { killTables } -result 62.75 test config-4.19 {DoObjConfig - string} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -string test } -cleanup { killTables } -returnCodes ok -result .foo test config-4.20 {DoObjConfig - string} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -string test .foo cget -string } -cleanup { killTables } -returnCodes ok -result test test config-4.21 {DoObjConfig - string} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -string test .foo cget -string rename .foo {} } -cleanup { killTables } -returnCodes ok test config-4.22 {DoObjConfig - null string} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -string {} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.23 {DoObjConfig - null string} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -string {} .foo cget -string } -cleanup { killTables |
︙ | ︙ | |||
439 440 441 442 443 444 445 | killTables } -result {this is a test} test config-4.26 {DoObjConfig - string table} -constraints testobjconfig -body { testobjconfig alltypes .foo -stringtable two } -cleanup { killTables | | | | | > > > > > > > | | | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | killTables } -result {this is a test} test config-4.26 {DoObjConfig - string table} -constraints testobjconfig -body { testobjconfig alltypes .foo -stringtable two } -cleanup { killTables } -returnCodes ok -result .foo test config-4.27 {DoObjConfig - string table} -constraints testobjconfig -body { testobjconfig alltypes .foo -stringtable two .foo cget -stringtable } -cleanup { killTables } -returnCodes ok -result two test config-4.28 {DoObjConfig - string table} -constraints testobjconfig -body { testobjconfig alltypes .foo -stringtable two .foo cget -stringtable rename .foo {} } -cleanup { killTables } -returnCodes ok test config-4.29 {DoObjConfig - invalid string table} -constraints { testobjconfig needsTcl87 } -body { testobjconfig alltypes .foo -stringtable foo } -cleanup { killTables } -returnCodes error -result {bad stringtable "foo": must be one, two, three, four, or ""} test config-4.29a {DoObjConfig - invalid string table} -constraints { testobjconfig needsTcl87 } -body { testobjconfig alltypes .foo -stringtable2 foo } -cleanup { killTables } -returnCodes error -result {bad stringtable2 "foo": must be one, two, or ""} test config-4.30 {DoObjConfig - new string table} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -stringtable two .foo configure -stringtable three } -cleanup { killTables } -returnCodes ok -result 16 test config-4.31 {DoObjConfig - new string table} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -stringtable two .foo configure -stringtable three .foo cget -stringtable } -cleanup { killTables } -returnCodes ok -result three test config-4.32 {DoObjConfig - new string table} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -stringtable two .foo configure -stringtable three .foo cget -stringtable rename .foo {} } -cleanup { killTables } -returnCodes ok test config-4.33 {DoObjConfig - stringtable internal value} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -stringtable "four" .foo cget -stringtable } -cleanup { killTables } -result four test config-4.34 {DoObjConfig - color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color blue } -cleanup { killTables } -returnCodes ok -result .foo test config-4.35 {DoObjConfig - color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color blue .foo cget -color } -cleanup { killTables } -returnCodes ok -result blue test config-4.36 {DoObjConfig - color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color blue .foo cget -color rename .foo {} } -cleanup { killTables } -returnCodes ok |
︙ | ︙ | |||
533 534 535 536 537 538 539 | } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -color purple .foo cget -color } -cleanup { killTables | | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -color purple .foo cget -color } -cleanup { killTables } -result purple test config-4.39 {DoObjConfig - null color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color {} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.40 {DoObjConfig - null color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color {} .foo cget -color } -cleanup { killTables } -returnCodes ok -result {} test config-4.41 {DoObjConfig - null color} -constraints testobjconfig -body { |
︙ | ︙ | |||
587 588 589 590 591 592 593 | test config-4.45 {DoObjConfig - font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -font {Helvetica 72} } -cleanup { killTables | | | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | test config-4.45 {DoObjConfig - font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -font {Helvetica 72} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.46 {DoObjConfig - font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -font {Helvetica 72} .foo cget -font } -cleanup { killTables |
︙ | ︙ | |||
628 629 630 631 632 633 634 | } -returnCodes error -result {unknown font style "foo"} test config-4.50 {DoObjConfig - null font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -font {} } -cleanup { killTables | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | } -returnCodes error -result {unknown font style "foo"} test config-4.50 {DoObjConfig - null font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -font {} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.51 {DoObjConfig - null font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -font {} .foo cget -font } -cleanup { killTables |
︙ | ︙ | |||
652 653 654 655 656 657 658 | killTables } -result {Times 16} test config-4.53 {DoObjConfig - bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 } -cleanup { killTables | | | | | | | | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | killTables } -result {Times 16} test config-4.53 {DoObjConfig - bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 } -cleanup { killTables } -returnCodes ok -result .foo test config-4.54 {DoObjConfig - bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 .foo cget -bitmap } -cleanup { killTables } -returnCodes ok -result gray75 test config-4.55 {DoObjConfig - new bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 .foo configure -bitmap gray50 } -cleanup { killTables } -returnCodes ok -result 128 test config-4.56 {DoObjConfig - new bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 .foo configure -bitmap gray50 .foo cget -bitmap } -cleanup { killTables } -returnCodes ok -result gray50 test config-4.57 {DoObjConfig - invalid bitmap} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -bitmap foobar } -cleanup { killTables } -returnCodes error -result {bitmap "foobar" not defined} test config-4.58 {DoObjConfig - null bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap {} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.59 {DoObjConfig - null bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap {} .foo cget -bitmap } -cleanup { killTables } -returnCodes ok -result {} test config-4.60 {DoObjConfig - bitmap internal value} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -bitmap gray25 .foo cget -bitmap } -cleanup { killTables } -result gray25 test config-4.61 {DoObjConfig - border} -constraints testobjconfig -body { testobjconfig alltypes .foo -border green } -cleanup { killTables } -returnCodes ok -result .foo test config-4.62 {DoObjConfig - border} -constraints testobjconfig -body { testobjconfig alltypes .foo -border green .foo cget -border } -cleanup { killTables } -returnCodes ok -result green test config-4.63 {DoObjConfig - invalid border} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -border xxx } -cleanup { killTables } -returnCodes error -result {unknown color name "xxx"} test config-4.64 {DoObjConfig - null border} -constraints testobjconfig -body { testobjconfig alltypes .foo -border {} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.65 {DoObjConfig - null border} -constraints testobjconfig -body { testobjconfig alltypes .foo -border {} .foo cget -border } -cleanup { killTables } -returnCodes ok -result {} test config-4.66 {DoObjConfig - border internal value} -constraints { |
︙ | ︙ | |||
762 763 764 765 766 767 768 | killTables } -returnCodes ok -result {#444444} test config-4.69 {DoObjConfig - relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief flat } -cleanup { killTables | | | | | | | | | | | | | | | | | | | | | | | | | | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 | killTables } -returnCodes ok -result {#444444} test config-4.69 {DoObjConfig - relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief flat } -cleanup { killTables } -returnCodes ok -result .foo test config-4.70 {DoObjConfig - relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief flat .foo cget -relief } -cleanup { killTables } -returnCodes ok -result flat test config-4.71 {DoObjConfig - invalid relief} -constraints { testobjconfig needsTcl87 } -body { testobjconfig alltypes .foo -relief foo } -cleanup { killTables } -returnCodes error -result {bad relief "foo": must be flat, groove, raised, ridge, solid, sunken, or ""} test config-4.72 {DoObjConfig - relief internal value} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -relief ridge .foo cget -relief } -cleanup { killTables } -result ridge test config-4.73 {DoObjConfig - new relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief raised .foo configure -relief flat } -cleanup { killTables } -returnCodes ok -result 512 test config-4.74 {DoObjConfig - new relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief raised .foo configure -relief flat .foo cget -relief } -cleanup { killTables } -returnCodes ok -result flat test config-4.75 {DoObjConfig - cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor arrow } -cleanup { killTables } -returnCodes ok -result .foo test config-4.76 {DoObjConfig - cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor arrow .foo cget -cursor } -cleanup { killTables } -returnCodes ok -result arrow test config-4.77 {DoObjConfig - invalid cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor foo } -cleanup { killTables } -returnCodes error -result {bad cursor spec "foo"} test config-4.78 {DoObjConfig - null cursor} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -cursor {} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.79 {DoObjConfig - null cursor} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { testobjconfig alltypes .foo -cursor {} .foo cget -cursor } -cleanup { killTables } -returnCodes ok -result {} test config-4.80 {DoObjConfig - new cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor xterm .foo configure -cursor arrow } -cleanup { killTables } -returnCodes ok -result 1024 test config-4.81 {DoObjConfig - new cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor xterm .foo configure -cursor arrow .foo cget -cursor } -cleanup { killTables } -returnCodes ok -result arrow test config-4.82 {DoObjConfig - cursor internal value} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -cursor watch .foo cget -cursor } -cleanup { killTables } -result watch test config-4.83 {DoObjConfig - justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify center } -cleanup { killTables } -returnCodes ok -result .foo test config-4.84 {DoObjConfig - justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify center .foo cget -justify } -cleanup { killTables } -returnCodes ok -result center test config-4.85 {DoObjConfig - invalid justify} -constraints {testobjconfig needsTcl87} -body { testobjconfig alltypes .foo -justify foo } -cleanup { killTables } -returnCodes error -result {bad justification "foo": must be left, right, center, or ""} test config-4.86 {DoObjConfig - new justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify left .foo configure -justify right } -cleanup { killTables } -returnCodes ok -result 2048 test config-4.87 {DoObjConfig - new justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify left .foo configure -justify right .foo cget -justify } -cleanup { killTables } -returnCodes ok -result right test config-4.88 {DoObjConfig - justify internal value} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -justify center .foo cget -justify } -cleanup { killTables } -result center test config-4.89 {DoObjConfig - anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor center } -cleanup { killTables } -returnCodes ok -result .foo test config-4.90 {DoObjConfig - anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor center .foo cget -anchor } -cleanup { killTables } -returnCodes ok -result center test config-4.91 {DoObjConfig - invalid anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor foo } -constraints needsTcl87 -cleanup { killTables } -returnCodes error -result {bad anchor "foo": must be n, ne, e, se, s, sw, w, nw, center, or ""} test config-4.92 {DoObjConfig - new anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor e .foo configure -anchor n } -cleanup { killTables } -returnCodes ok -result 4096 test config-4.93 {DoObjConfig - new anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor e .foo configure -anchor n .foo cget -anchor } -cleanup { killTables } -returnCodes ok -result n test config-4.94 {DoObjConfig - anchor internal value} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -anchor sw .foo cget -anchor } -cleanup { killTables } -result sw test config-4.95 {DoObjConfig - pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42 } -cleanup { killTables } -returnCodes ok -result .foo test config-4.96 {DoObjConfig - pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42 .foo cget -pixel } -cleanup { killTables } -returnCodes ok -result 42 test config-4.97 {DoObjConfig - invalid pixel} -constraints testobjconfig -body { |
︙ | ︙ | |||
960 961 962 963 964 965 966 | } -returnCodes ok -result 8192 test config-4.99 {DoObjConfig - new pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42m .foo configure -pixel 3c .foo cget -pixel } -cleanup { killTables | | | | | | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | } -returnCodes ok -result 8192 test config-4.99 {DoObjConfig - new pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42m .foo configure -pixel 3c .foo cget -pixel } -cleanup { killTables } -returnCodes ok -result 3c test config-4.100 {DoObjConfig - pixel internal value} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -pixel [winfo screenmmwidth .]m set screenW [winfo screenwidth .] set result [.foo cget -pixel] expr {$screenW eq $result} } -cleanup { killTables } -result 1 test config-4.101 {DoObjConfig - window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window .bar } -cleanup { killTables } -returnCodes ok -result .foo test config-4.102 {DoObjConfig - window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window .bar .foo cget -window } -cleanup { killTables } -returnCodes ok -result .bar test config-4.103 {DoObjConfig - invalid window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window foo } -cleanup { killTables } -returnCodes error -result {bad window path name "foo"} test config-4.104 {DoObjConfig - null window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window {} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.105 {DoObjConfig - null window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window {} .foo cget -window } -cleanup { killTables } -returnCodes ok -result {} |
︙ | ︙ | |||
1022 1023 1024 1025 1026 1027 1028 | toplevel .bar toplevel .blamph testobjconfig twowindows .foo -window .bar .foo configure -window .blamph .foo cget -window } -cleanup { killTables | | | | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | toplevel .bar toplevel .blamph testobjconfig twowindows .foo -window .bar .foo configure -window .blamph .foo cget -window } -cleanup { killTables } -returnCodes ok -result .blamph test config-4.108 {DoObjConfig - window internal value} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { testobjconfig internal .foo -window . .foo cget -window } -cleanup { killTables } -result . test config-4.109 {DoObjConfig - releasing old values} -constraints { testobjconfig } -setup { catch {rename .foo {}} } -body { # This test doesn't generate a useful value to check; if an |
︙ | ︙ | |||
1077 1078 1079 1080 1081 1082 1083 | killTables } -result {} test config-4.111 {DoObjConfig - custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom test } -cleanup { killTables | | | | | 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | killTables } -result {} test config-4.111 {DoObjConfig - custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom test } -cleanup { killTables } -returnCodes ok -result .foo test config-4.112 {DoObjConfig - custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom test .foo cget -custom } -cleanup { killTables } -returnCodes ok -result TEST test config-4.113 {DoObjConfig - null custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom {} } -cleanup { killTables } -returnCodes ok -result .foo test config-4.114 {DoObjConfig - null custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom {} .foo cget -custom } -cleanup { killTables } -returnCodes ok -result {} test config-4.115 {DoObjConfig - custom internal value} -constraints { |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | test config-6.2 {GetOptionFromObj - exact match} -constraints { testobjconfig } -body { testobjconfig chain2 .a .a cget -one } -cleanup { killTables | | | | 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | test config-6.2 {GetOptionFromObj - exact match} -constraints { testobjconfig } -body { testobjconfig chain2 .a .a cget -one } -cleanup { killTables } -result one test config-6.3 {GetOptionFromObj - abbreviation} -constraints { testobjconfig } -body { testobjconfig chain2 .a .a cget -fo } -cleanup { killTables } -result four test config-6.4 {GetOptionFromObj - ambiguous abbreviation} -constraints { testobjconfig } -body { testobjconfig chain2 .a .a cget -on } -cleanup { killTables |
︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 | killTables } -result {two and a half} test config-6.6 {GetOptionFromObj - synonym} -constraints testobjconfig -body { testobjconfig alltypes .b .b cget -synonym } -cleanup { killTables | | | | | 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | killTables } -result {two and a half} test config-6.6 {GetOptionFromObj - synonym} -constraints testobjconfig -body { testobjconfig alltypes .b .b cget -synonym } -cleanup { killTables } -result red if {[testConstraint testobjconfig]} { testobjconfig alltypes .a } test config-7.1 {Tk_SetOptions - basics} -constraints testobjconfig -body { .a configure -color green -rel sunken list [.a cget -color] [.a cget -relief] } -result {green sunken} test config-7.2 {Tk_SetOptions - bogus option name} -constraints { testobjconfig } -body { .a configure -bogus } -returnCodes error -result {unknown option "-bogus"} test config-7.3 {Tk_SetOptions - synonym} -constraints testobjconfig -body { .a configure -synonym blue .a cget -color } -result blue test config-7.4 {Tk_SetOptions - missing value} -constraints { testobjconfig } -body { .a configure -color green -relief } -returnCodes error -result {value for "-relief" missing} test config-7.5 {Tk_SetOptions - missing value} -constraints { testobjconfig } -body { catch {.a configure -color green -relief} .a cget -color } -result green test config-7.6 {Tk_SetOptions - saving old values} -constraints { testobjconfig } -body { .a configure -color red -int 7 -relief raised -double 3.14159 .a csave -color green -int 432 -relief sunken -double 2.0 -color bogus } -returnCodes error -result {unknown color name "bogus"} test config-7.7 {Tk_SetOptions - saving old values} -constraints { |
︙ | ︙ | |||
1292 1293 1294 1295 1296 1297 1298 | } -body { testobjconfig alltypes .a catch {.a csave -color green -color black -color blue \ -color #ffff00 -color #ff00ff -color bogus} .a cget -color } -cleanup { killTables | | | 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 | } -body { testobjconfig alltypes .a catch {.a csave -color green -color black -color blue \ -color #ffff00 -color #ff00ff -color bogus} .a cget -color } -cleanup { killTables } -result red test config-8.3 {Tk_RestoreSavedOptions - freeing object memory} -constraints { testobjconfig } -body { testobjconfig alltypes .a .a csave -color green -color black -color blue -color #ffff00 -color #ff00ff } -cleanup { killTables |
︙ | ︙ | |||
1343 1344 1345 1346 1347 1348 1349 | testobjconfig } -body { testobjconfig internal .a catch {.a csave -double 62.4 -color bogus} .a cget -double } -cleanup { killTables | | | | | | | | | | | | | | | | | | 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | testobjconfig } -body { testobjconfig internal .a catch {.a csave -double 62.4 -color bogus} .a cget -double } -cleanup { killTables } -result 3.14159 test config-8.9 {Tk_RestoreSavedOptions - string internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -string "A long string" -color bogus} .a cget -string } -cleanup { killTables } -result foo test config-8.10 {Tk_RestoreSavedOptions - string table internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -stringtable three -color bogus} .a cget -stringtable } -cleanup { killTables } -result one test config-8.11 {Tk_RestoreSavedOptions - color internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -color green -color bogus} .a cget -color } -cleanup { killTables } -result red test config-8.12 {Tk_RestoreSavedOptions - font internal form} -constraints { testobjconfig nonPortable } -body { testobjconfig internal .a catch {.a csave -font {Times 12} -color bogus} .a cget -font } -cleanup { killTables } -result {Helvetica 12} test config-8.13 {Tk_RestoreSavedOptions - bitmap internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -bitmap questhead -color bogus} .a cget -bitmap } -cleanup { killTables } -result gray50 test config-8.14 {Tk_RestoreSavedOptions - border internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -border brown -color bogus} .a cget -border } -cleanup { killTables } -result blue test config-8.15 {Tk_RestoreSavedOptions - anchor internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -anchor e -color bogus} .a cget -anchor } -cleanup { killTables } -result center test config-8.16 {Tk_RestoreSavedOptions - cursor internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -cursor watch -color bogus} .a cget -cursor } -cleanup { killTables } -result xterm test config-8.17 {Tk_RestoreSavedOptions - justify internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -justify right -color bogus} .a cget -justify } -cleanup { killTables } -result left test config-8.18 {Tk_RestoreSavedOptions - anchor internal form} -constraints { testobjconfig } -body { testobjconfig internal .a catch {.a csave -anchor n -color bogus} .a cget -anchor } -cleanup { killTables } -result center test config-8.19 {Tk_RestoreSavedOptions - window internal form} -constraints { testobjconfig } -body { testobjconfig internal .a -window .a catch {.a csave -window .a -color bogus} .a cget -window } -cleanup { killTables } -result .a test config-8.20 {Tk_RestoreSavedOptions - custom internal form} -constraints { testobjconfig } -body { testobjconfig internal .a -custom "foobar" catch {.a csave -custom "barbaz" -color bogus} .a cget -custom } -cleanup { killTables } -result FOOBAR # Most of the tests below will cause memory leakage if there is a # problem. This may not be evident unless the tests are run in # conjunction with a memory usage analyzer such as Purify. test config-9.1 {Tk_FreeConfigOptions/FreeResources - string internal form} -constraints { testobjconfig |
︙ | ︙ | |||
1556 1557 1558 1559 1560 1561 1562 | if {[testConstraint testobjconfig]} { killTables } test config-10.1 {Tk_GetOptionInfo - one item} -constraints testobjconfig -body { testobjconfig alltypes .foo | | | | | | 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 | if {[testConstraint testobjconfig]} { killTables } test config-10.1 {Tk_GetOptionInfo - one item} -constraints testobjconfig -body { testobjconfig alltypes .foo .foo configure -anchor e .foo configure -anchor } -cleanup { destroy .foo } -result {-anchor anchor Anchor center e} test config-10.2 {Tk_GetOptionInfo - one item, synonym} -constraints { testobjconfig } -body { testobjconfig alltypes .foo .foo configure -color black .foo configure -synonym } -cleanup { destroy .foo } -result {-color color Color red black} test config-10.3 {Tk_GetOptionInfo - all items} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -font {Helvetica 18} -integer 13563 .foo configure } -cleanup { destroy .foo } -result {{-boolean boolean Boolean {} {}} {-integer integer Integer 7 13563} {-double double Double 3.14159 3.14159} {-string string String foo foo} {-stringtable StringTable stringTable one one} {-stringtable2 StringTable2 stringTable2 two two} {-color color Color red red} {-font font Font {Helvetica 12} {Helvetica 18}} {-bitmap bitmap Bitmap gray50 gray50} {-border border Border blue blue} {-relief relief Relief {} {}} {-cursor cursor Cursor xterm xterm} {-justify {} {} left left} {-anchor anchor Anchor center center} {-pixel pixel Pixel 1 1} {-custom {} {} {} {}} {-synonym -color}} test config-10.4 {Tk_GetOptionInfo - chaining through tables} -constraints testobjconfig -body { testobjconfig chain2 .foo -one asdf -three xyzzy .foo configure } -cleanup { destroy .foo } -result {{-three three Three three xyzzy} {-four four Four four four} {-two two Two {two and a half} {two and a half}} {-oneAgain oneAgain OneAgain {one again} {one again}} {-one one One one asdf} {-two two Two two {two and a half}}} if {[testConstraint testobjconfig]} { |
︙ | ︙ | |||
1603 1604 1605 1606 1607 1608 1609 | testobjconfig } -body { .a configure -justify } -result {-justify {} {} left left} test config-11.3 {GetConfigList - null default and current value} -constraints { testobjconfig } -body { | | | | 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 | testobjconfig } -body { .a configure -justify } -result {-justify {} {} left left} test config-11.3 {GetConfigList - null default and current value} -constraints { testobjconfig } -body { .a configure -relief } -result {-relief relief Relief {} {}} if {[testConstraint testobjconfig]} { killTables } if {[testConstraint testobjconfig]} { testobjconfig internal .a |
︙ | ︙ | |||
1634 1635 1636 1637 1638 1639 1640 | .a cget -string } -result {test value} test config-12.5 {GetObjectForOption - stringTable} -constraints { testobjconfig } -body { .a configure -stringtable "two" .a cget -stringtable | | | | | | | | | | | 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 | .a cget -string } -result {test value} test config-12.5 {GetObjectForOption - stringTable} -constraints { testobjconfig } -body { .a configure -stringtable "two" .a cget -stringtable } -result two test config-12.6 {GetObjectForOption - color} -constraints testobjconfig -body { .a configure -color "green" .a cget -color } -result green test config-12.7 {GetObjectForOption - font} -constraints testobjconfig -body { .a configure -font {Times 36} .a cget -font } -result {Times 36} test config-12.8 {GetObjectForOption - bitmap} -constraints testobjconfig -body { .a configure -bitmap "questhead" .a cget -bitmap } -result questhead test config-12.9 {GetObjectForOption - border} -constraints testobjconfig -body { .a configure -border #33217c .a cget -border } -result {#33217c} test config-12.10 {GetObjectForOption - relief} -constraints { testobjconfig } -body { .a configure -relief groove .a cget -relief } -result groove test config-12.11 {GetObjectForOption - cursor} -constraints { testobjconfig } -body { .a configure -cursor watch .a cget -cursor } -result watch test config-12.12 {GetObjectForOption - justify} -constraints { testobjconfig } -body { .a configure -justify right .a cget -justify } -result right test config-12.13 {GetObjectForOption - anchor} -constraints testobjconfig -body { .a configure -anchor e .a cget -anchor } -result e test config-12.14 {GetObjectForOption - pixels} -constraints testobjconfig -body { .a configure -pixel 193.2 .a cget -pixel } -result 193 test config-12.15 {GetObjectForOption - window} -constraints testobjconfig -body { .a configure -window .a .a cget -window } -result .a test config-12.16 {GetObjectForOption -custom} -constraints testobjconfig -body { .a configure -custom foobar .a cget -custom } -result FOOBAR test config-12.17 {GetObjectForOption - null values} -constraints { testobjconfig } -body { .a configure -string {} -color {} -font {} -bitmap {} -border {} \ -cursor {} -window {} -custom {} list [.a cget -string] [.a cget -color] [.a cget -font] \ [.a cget -bitmap] [.a cget -border] [.a cget -cursor] \ |
︙ | ︙ |
Changes to tests/constraints.tcl.
1 2 3 4 5 6 7 | if {[namespace exists tk::test]} { deleteWindows wm geometry . {} raise . return } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | if {[namespace exists tk::test]} { deleteWindows wm geometry . {} raise . return } package require tk tk appname tktest wm title . tktest # If the main window isn't already mapped (e.g. because the tests are # being run automatically) , specify a precise size for it so that the # user won't have to position it manually. if {![winfo ismapped .]} { |
︙ | ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | Export bg::setup as setupbg Export bg::cleanup as cleanupbg Export bg::do as dobg namespace export deleteWindows proc deleteWindows {} { eval destroy [winfo children .] } namespace export fixfocus proc fixfocus {} { catch {destroy .focus} toplevel .focus wm geometry .focus +0+0 entry .focus.e .focus.e insert 0 "fixfocus" pack .focus.e update focus -force .focus.e destroy .focus } | > > > > > < | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | Export bg::setup as setupbg Export bg::cleanup as cleanupbg Export bg::do as dobg namespace export deleteWindows proc deleteWindows {} { eval destroy [winfo children .] # This update is needed to avoid intermittent failures on macOS in unixEmbed.test # Reason for the failures is unclear but could have to do with window ids being deleted # after the destroy command returns. The detailed mechanism of such delayed deletions # is not understood, but it appears that this update prevents the test failures. update } namespace export fixfocus proc fixfocus {} { catch {destroy .focus} toplevel .focus wm geometry .focus +0+0 entry .focus.e .focus.e insert 0 "fixfocus" pack .focus.e update focus -force .focus.e destroy .focus } namespace export imageInit imageFinish imageCleanup imageNames variable ImageNames proc imageInit {} { variable ImageNames if {![info exists ImageNames]} { set ImageNames [lsort [image names]] |
︙ | ︙ | |||
168 169 170 171 172 173 174 175 176 177 178 179 180 181 | set r {} foreach img [image names] { if {$img ni $ImageNames} {lappend r $img} } return $r } } } namespace import -force tk::test::* namespace import -force tcltest::testConstraint testConstraint notAqua [expr {[tk windowingsystem] ne "aqua"}] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | set r {} foreach img [image names] { if {$img ni $ImageNames} {lappend r $img} } return $r } # # CONTROL TIMING ASPECTS OF POINTER WARPING # # The proc [controlPointerWarpTiming] is intended to ensure that the (mouse) # pointer has actually been moved to its new position after a Tk test issued: # # [event generate $w $event -warp 1 ...] # # It takes care of the following timing details of pointer warping: # # a. Allow pointer warping to happen if it was scheduled for execution at # idle time. # - In Tk releases 8.6 and older, pointer warping is scheduled for # execution at idle time # - In release 8.7 and newer this happens synchronously if $w refers to the # whole screen or if the -when option to [event generate] is "now". # The namespace variable idle_pointer_warping records which of these is # the case. # # b. Work around a race condition associated with OS notification of # mouse motion on Windows. # # When calling [event generate $w $event -warp 1 ...], the following # sequence occurs: # - At some point in the processing of this command, either via a # synchronous execution path, or asynchronously at idle time, Tk calls # an OS function* to carry out the mouse cursor motion. # - Tk has previously registered a callback function** with the OS, for # the OS to call in order to notify Tk when a mouse move is completed. # - Tk doesn't wait for the callback function to receive the notification # from the OS, but continues processing. This suits most use cases # because usually the notification arrives fast enough (within a few tens # of microseconds). However ... # - A problem arises if Tk performs some processing, immediately following # up on [event generate $w $event -warp 1 ...], and that processing # relies on the mouse pointer having actually moved. If such processing # happens just before the notification from the OS has been received, # Tk will be using not yet updated info (e.g. mouse coordinates). # # Hickup, choke etc ... ! # # * the function SendInput() of the Win32 API # ** the callback function is TkWinChildProc() # # This timing issue can be addressed by putting the Tk process on hold # (do nothing at all) for a somewhat extended amount of time, while # letting the OS complete its job in the meantime. This is what is # accomplished by calling [after ms]. # # ---- # For the history of this issue please refer to Tk ticket [69b48f427e], # specifically the comment on 2019-10-27 14:24:26. # # # Beware: there are cases, not (yet) exercised by the Tk test suite, where # [controlPointerWarpTiming] doesn't ensure the new position of the pointer. # For example, when issued under Tk8.7+, if the value for the -when option # to [event generate $w] is not "now", and $w refers to a Tk window, i.e. not # the whole screen. # variable idle_pointer_warping [expr {![package vsatisfies [package provide Tk] 8.7-]}] proc controlPointerWarpTiming {{duration 50}} { variable idle_pointer_warping if {$idle_pointer_warping} { update idletasks ;# see a. above } if {[tk windowingsystem] eq "win32"} { after $duration ;# see b. above } } namespace export controlPointerWarpTiming } } namespace import -force tk::test::* namespace import -force tcltest::testConstraint testConstraint notAqua [expr {[tk windowingsystem] ne "aqua"}] |
︙ | ︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 204 | ([testConstraint unix] && [testConstraint notAqua]) }] testConstraint haveDISPLAY [expr {[info exists env(DISPLAY)] && [testConstraint x11]}] testConstraint altDisplay [info exists env(TK_ALT_DISPLAY)] testConstraint noExceed [expr { ![testConstraint unix] || [catch {font actual "\{xyz"}] }] # constraints for testing facilities defined in the tktest executable... testConstraint testImageType [expr {"test" in [image types]}] testConstraint testOldImageType [expr {"oldtest" in [image types]}] testConstraint testbitmap [llength [info commands testbitmap]] testConstraint testborder [llength [info commands testborder]] testConstraint testcbind [llength [info commands testcbind]] | > > > > > > | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | ([testConstraint unix] && [testConstraint notAqua]) }] testConstraint haveDISPLAY [expr {[info exists env(DISPLAY)] && [testConstraint x11]}] testConstraint altDisplay [info exists env(TK_ALT_DISPLAY)] testConstraint noExceed [expr { ![testConstraint unix] || [catch {font actual "\{xyz"}] }] testConstraint deprecated [expr {![package vsatisfies [package provide Tcl] 8.7-] || ![::tk::build-info no-deprecate]}] testConstraint needsTcl87 [package vsatisfies [package provide Tcl] 8.7-] # constraint for running a test on all windowing system except aqua # where the test fails due to a known bug testConstraint aquaKnownBug [expr {[testConstraint notAqua] || [testConstraint knownBug]}] # constraints for testing facilities defined in the tktest executable... testConstraint testImageType [expr {"test" in [image types]}] testConstraint testOldImageType [expr {"oldtest" in [image types]}] testConstraint testbitmap [llength [info commands testbitmap]] testConstraint testborder [llength [info commands testborder]] testConstraint testcbind [llength [info commands testcbind]] |
︙ | ︙ | |||
231 232 233 234 235 236 237 | .t insert end "This is\na dot." update set x [list [.t bbox 1.3] [.t bbox 2.5]] destroy .t if {![string match {{22 3 6 15} {31 18 [34] 15}} $x]} { testConstraint fonts 0 } | < < < | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | .t insert end "This is\na dot." update set x [list [.t bbox 1.3] [.t bbox 2.5]] destroy .t if {![string match {{22 3 6 15} {31 18 [34] 15}} $x]} { testConstraint fonts 0 } # constraints for the visuals available.. testConstraint pseudocolor8 [expr { ([catch { toplevel .t -visual {pseudocolor 8} -colormap new }] == 0) && ([winfo depth .t] == 8) }] |
︙ | ︙ |
Changes to tests/cursor.test.
1 2 3 4 5 | # This file is a Tcl script to test out the procedures in the file # tkCursor.c. It is organized in the standard white-box fashion for # Tcl tests. # # Copyright © 1998 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the procedures in the file # tkCursor.c. It is organized in the standard white-box fashion for # Tcl tests. # # Copyright © 1998 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/earth.gif.
cannot compute difference between binary files
Changes to tests/embed.test.
1 2 3 | # This file is a Tcl script to test out embedded Windows. # # Copyright © 1996-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 | # This file is a Tcl script to test out embedded Windows. # # Copyright © 1996-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/entry.test.
1 2 3 4 5 | # This file is a Tcl script to test entry widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file is a Tcl script to test entry widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # For xscrollcommand set scrollInfo {} proc scroll args { global scrollInfo |
︙ | ︙ | |||
43 44 45 46 47 48 49 | } set cy [font metrics {Courier -12} -linespace] test entry-1.1 {configuration option: "background" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | } set cy [font metrics {Courier -12} -linespace] test entry-1.1 {configuration option: "background" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -background #ff0000 .e cget -background } -cleanup { destroy .e } -result {#ff0000} test entry-1.2 {configuration option: "background" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -background non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.3 {configuration option: "bd" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -bd 4 .e cget -bd } -cleanup { destroy .e } -result 4 test entry-1.4 {configuration option: "bd" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -bd badValue } -cleanup { destroy .e } -returnCodes {error} -result {bad screen distance "badValue"} test entry-1.5 {configuration option: "bg" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -bg #ff0000 .e cget -bg } -cleanup { destroy .e } -result {#ff0000} test entry-1.6 {configuration option: "bg" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -bg non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.7 {configuration option: "borderwidth" for entry} -setup { entry .e -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -borderwidth 1.3 .e cget -borderwidth } -cleanup { destroy .e } -result 1 test entry-1.8 {configuration option: "borderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -borderwidth badValue } -cleanup { destroy .e } -returnCodes {error} -result {bad screen distance "badValue"} test entry-1.9 {configuration option: "cursor" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -cursor arrow .e cget -cursor } -cleanup { destroy .e } -result {arrow} test entry-1.10 {configuration option: "cursor" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -cursor badValue } -cleanup { destroy .e } -returnCodes {error} -result {bad cursor spec "badValue"} test entry-1.11 {configuration option: "disabledbackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -disabledbackground green .e cget -disabledbackground } -cleanup { destroy .e } -result {green} test entry-1.12 {configuration option: "disabledbackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -disabledbackground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.13 {configuration option: "disabledforeground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -disabledforeground blue .e cget -disabledforeground } -cleanup { destroy .e } -result {blue} test entry-1.14 {configuration option: "disabledforeground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -disabledforeground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.15 {configuration option: "exportselection" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -exportselection yes .e cget -exportselection } -cleanup { destroy .e } -result 1 test entry-1.16 {configuration option: "exportselection" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -exportselection xyzzy } -cleanup { destroy .e } -returnCodes {error} -result {expected boolean value but got "xyzzy"} test entry-1.17 {configuration option: "fg" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -fg #110022 .e cget -fg } -cleanup { destroy .e } -result {#110022} test entry-1.18 {configuration option: "fg" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -fg non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.19 {configuration option: "font" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e configure -font {Helvetica -12} .e cget -font } -cleanup { destroy .e } -result {Helvetica -12} test entry-1.20 {configuration option: "font" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e configure -font {} } -cleanup { destroy .e } -returnCodes {error} -result {font "" doesn't exist} test entry-1.21 {configuration option: "foreground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -foreground #110022 .e cget -foreground } -cleanup { destroy .e } -result {#110022} test entry-1.22 {configuration option: "foreground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -foreground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.23 {configuration option: "highlightbackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -highlightbackground #110022 .e cget -highlightbackground } -cleanup { destroy .e } -result {#110022} test entry-1.24 {configuration option: "highlightbackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -highlightbackground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.25 {configuration option: "highlightcolor" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -highlightcolor #110022 .e cget -highlightcolor } -cleanup { destroy .e } -result {#110022} test entry-1.26 {configuration option: "highlightcolor" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -highlightcolor non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.27 {configuration option: "highlightthickness" for entry} -setup { entry .e -borderwidth 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -highlightthickness 6 .e cget -highlightthickness } -cleanup { destroy .e } -result 6 test entry-1.28 {configuration option: "highlightthickness" for entry} -setup { entry .e -borderwidth 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -highlightthickness -2 .e cget -highlightthickness } -cleanup { destroy .e } -result 0 test entry-1.29 {configuration option: "highlightthickness" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -highlightthickness badValue } -cleanup { destroy .e } -returnCodes {error} -result {bad screen distance "badValue"} test entry-1.30 {configuration option: "insertbackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -insertbackground #110022 .e cget -insertbackground } -cleanup { destroy .e } -result {#110022} test entry-1.31 {configuration option: "insertbackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -insertbackground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.32 {configuration option: "insertborderwidth" for entry} -setup { entry .e -borderwidth 2 -insertwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -insertborderwidth 1.3 .e cget -insertborderwidth } -cleanup { destroy .e } -result 1 test entry-1.33 {configuration option: "insertborderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -insertborderwidth 2.6x } -cleanup { destroy .e } -returnCodes {error} -result {bad screen distance "2.6x"} test entry-1.34 {configuration option: "insertofftime" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -insertofftime 100 .e cget -insertofftime } -cleanup { destroy .e } -result 100 test entry-1.35 {configuration option: "insertofftime" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -insertofftime 3.2 } -cleanup { destroy .e } -returnCodes {error} -result {expected integer but got "3.2"} test entry-1.36 {configuration option: "insertontime" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -insertontime 100 .e cget -insertontime } -cleanup { destroy .e } -result 100 test entry-1.37 {configuration option: "insertontime" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -insertontime 3.2 } -cleanup { destroy .e } -returnCodes {error} -result {expected integer but got "3.2"} test entry-1.38 {configuration option: "invalidcommand" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -invalidcommand "any string" .e cget -invalidcommand } -cleanup { destroy .e } -result {any string} test entry-1.39 {configuration option: "invcmd" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -invcmd "any string" .e cget -invcmd } -cleanup { destroy .e } -result {any string} test entry-1.40 {configuration option: "justify" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -justify right .e cget -justify } -cleanup { destroy .e } -result {right} test entry-1.41 {configuration option: "justify" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -justify bogus } -cleanup { destroy .e } -returnCodes {error} -result {bad justification "bogus": must be left, right, or center} test entry-1.42 {configuration option: "readonlybackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -readonlybackground green .e cget -readonlybackground } -cleanup { destroy .e } -result {green} test entry-1.43 {configuration option: "readonlybackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -readonlybackground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.44 {configuration option: "relief" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -relief flat .e cget -relief } -cleanup { destroy .e } -result {flat} test entry-1.45 {configuration option: "selectbackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -selectbackground #110022 .e cget -selectbackground } -cleanup { destroy .e } -result {#110022} test entry-1.46 {configuration option: "selectbackground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -selectbackground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.47 {configuration option: "selectborderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -selectborderwidth 1.3 .e cget -selectborderwidth } -cleanup { destroy .e } -result 1 test entry-1.48 {configuration option: "selectborderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -selectborderwidth badValue } -cleanup { destroy .e } -returnCodes {error} -result {bad screen distance "badValue"} test entry-1.49 {configuration option: "selectforeground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -selectforeground #110022 .e cget -selectforeground } -cleanup { destroy .e } -result {#110022} test entry-1.50 {configuration option: "selectforeground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -selectforeground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.51 {configuration option: "show" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -show * .e cget -show } -cleanup { destroy .e } -result {*} test entry-1.52 {configuration option: "state" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -state n .e cget -state } -cleanup { destroy .e } -result {normal} test entry-1.53 {configuration option: "state" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -state bogus } -cleanup { destroy .e } -returnCodes {error} -result {bad state "bogus": must be disabled, normal, or readonly} test entry-1.54 {configuration option: "takefocus" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -takefocus "any string" .e cget -takefocus } -cleanup { destroy .e } -result {any string} test entry-1.55 {configuration option: "textvariable" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -textvariable i .e cget -textvariable } -cleanup { destroy .e } -result {i} test entry-1.56 {configuration option: "width" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -width 402 .e cget -width } -cleanup { destroy .e } -result 402 test entry-1.57 {configuration option: "width" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -width 3p } -cleanup { destroy .e } -returnCodes {error} -result {expected integer but got "3p"} test entry-1.58 {configuration option: "xscrollcommand" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e ; update idletasks update } -body { .e configure -xscrollcommand {Some command} .e cget -xscrollcommand } -cleanup { destroy .e } -result {Some command} |
︙ | ︙ | |||
655 656 657 658 659 660 661 | entry } -returnCodes error -result {wrong # args: should be "entry pathName ?-option value ...?"} test entry-2.2 {Tk_EntryCmd procedure} -body { entry gorp } -returnCodes error -result {bad window path name "gorp"} test entry-2.3 {Tk_EntryCmd procedure} -body { entry .e | | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | entry } -returnCodes error -result {wrong # args: should be "entry pathName ?-option value ...?"} test entry-2.2 {Tk_EntryCmd procedure} -body { entry gorp } -returnCodes error -result {bad window path name "gorp"} test entry-2.3 {Tk_EntryCmd procedure} -body { entry .e pack .e ; update idletasks update list [winfo exists .e] [winfo class .e] [info commands .e] } -cleanup { destroy .e } -result {1 Entry .e} test entry-2.4 {Tk_EntryCmd procedure} -body { entry .e -gorp foo |
︙ | ︙ | |||
681 682 683 684 685 686 687 | } -cleanup { destroy .e } -result {.e} test entry-3.1 {EntryWidgetCmd procedure} -setup { entry .e | | | | | | | | | | | | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | } -cleanup { destroy .e } -result {.e} test entry-3.1 {EntryWidgetCmd procedure} -setup { entry .e pack .e ; update idletasks update } -body { .e } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e option ?arg ...?"} test entry-3.2 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e bbox } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test entry-3.3 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e bbox a b } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test entry-3.4 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e bbox bogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "bogus"} test entry-3.5 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e bbox 0 } -cleanup { destroy .e } -result [list 5 5 0 $cy] # Previously the result was count using previousli counted font measurements # and metrics. It was changed to less verbose solution - the result is the one # that passes fonts constraint (this concerns tests 3.6, 3.7, 3.8, 3.10) test entry-3.6 {EntryWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { # Tcl_UtfAtIndex(): no utf chars .e insert 0 "abc" list [.e bbox 3] [.e bbox end] } -cleanup { destroy .e } -result {{19 5 7 13} {19 5 7 13}} test entry-3.7 {EntryWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { # Tcl_UtfAtIndex(): utf at end .e insert 0 "ab乎" .e bbox end } -cleanup { destroy .e } -result {19 5 12 13} test entry-3.8 {EntryWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { # Tcl_UtfAtIndex(): utf before index .e insert 0 "ab乎c" .e bbox 3 } -cleanup { destroy .e } -result {31 5 7 13} test entry-3.9 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { # Tcl_UtfAtIndex(): no chars .e bbox end } -cleanup { destroy .e } -result "5 5 0 $cy" test entry-3.10 {EntryWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e insert 0 "abcdefghij乎klmnop" list [.e bbox 0] [.e bbox 1] [.e bbox 10] [.e bbox end] } -cleanup { destroy .e } -result {{5 5 7 13} {12 5 7 13} {75 5 12 13} {122 5 7 13}} |
︙ | ︙ | |||
820 821 822 823 824 825 826 | .e configure -bd 4 .e cget -bd } -cleanup { destroy .e } -result 4 test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e | | | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 | .e configure -bd 4 .e cget -bd } -cleanup { destroy .e } -result 4 test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e pack .e ; update idletasks update } -body { llength [.e configure] } -cleanup { destroy .e } -result 38 test entry-3.16 {EntryWidgetCmd procedure, "configure" widget command} -setup { |
︙ | ︙ | |||
873 874 875 876 877 878 879 | } -body { .e delete 0 bar } -cleanup { destroy .e } -returnCodes error -result {bad entry index "bar"} test entry-3.22 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e | | | | | | | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | } -body { .e delete 0 bar } -cleanup { destroy .e } -returnCodes error -result {bad entry index "bar"} test entry-3.22 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "01234567890" .e delete 2 4 .e get } -cleanup { destroy .e } -result 014567890 test entry-3.23 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { .e insert end "01234567890" .e delete 6 .e get } -cleanup { destroy .e } -result 0123457890 test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e ; update idletasks update set x {} } -body { # UTF .e insert end "01234乎67890" .e delete 6 lappend x [.e get] .e delete 0 end .e insert end "012345乎7890" .e delete 6 lappend x [.e get] .e delete 0 end .e insert end "0123456乎890" .e delete 6 lappend x [.e get] } -cleanup { destroy .e } -result [list "01234乎7890" "0123457890" "012345乎890"] test entry-3.25 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "01234567890" .e delete 6 5 .e get } -cleanup { destroy .e } -result 01234567890 test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "01234567890" .e configure -state disabled .e delete 2 8 .e configure -state normal .e get } -cleanup { destroy .e } -result 01234567890 test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "01234567890" .e configure -state readonly .e delete 2 8 .e configure -state normal .e get |
︙ | ︙ | |||
1002 1003 1004 1005 1006 1007 1008 | } -body { .e index foo } -cleanup { destroy .e } -returnCodes error -result {bad entry index "foo"} test entry-3.34 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e | | | | 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 | } -body { .e index foo } -cleanup { destroy .e } -returnCodes error -result {bad entry index "foo"} test entry-3.34 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e index 0 } -cleanup { destroy .e } -returnCodes {ok} -match glob -result {*} test entry-3.35 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e pack .e ; update idletasks update } -body { # UTF .e insert 0 abc乎œdef list [.e index 3] [.e index 4] [.e index end] } -cleanup { destroy .e |
︙ | ︙ | |||
1043 1044 1045 1046 1047 1048 1049 | } -body { .e insert foo Text } -cleanup { destroy .e } -returnCodes error -result {bad entry index "foo"} test entry-3.39 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e | | | | | | | | | | | 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | } -body { .e insert foo Text } -cleanup { destroy .e } -returnCodes error -result {bad entry index "foo"} test entry-3.39 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "01234567890" .e insert 3 xxx .e get } -cleanup { destroy .e } -result {012xxx34567890} test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "01234567890" .e configure -state disabled .e insert 3 xxx .e configure -state normal .e get } -cleanup { destroy .e } -result 01234567890 test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "01234567890" .e configure -state readonly .e insert 3 xxx .e configure -state normal .e get } -cleanup { destroy .e } -result 01234567890 test entry-3.41 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test entry-3.42 {EntryWidgetCmd procedure, "scan" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e scan a } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e scan mark|dragto x"} test entry-3.43 {EntryWidgetCmd procedure, "scan" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e scan a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e scan mark|dragto x"} test entry-3.44 {EntryWidgetCmd procedure, "scan" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e scan foobar 20 } -cleanup { destroy .e } -returnCodes error -result {bad scan option "foobar": must be dragto or mark} test entry-3.45 {EntryWidgetCmd procedure, "scan" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e scan mark 20.1 } -cleanup { destroy .e } -returnCodes error -result {expected integer but got "20.1"} # This test is non-portable because character sizes vary. test entry-3.46 {EntryWidgetCmd procedure, "scan" widget command} -constraints { fonts } -setup { entry .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e insert end "This is quite a long string, in fact a " .e insert end "very very long string" .e scan mark 30 .e scan dragto 28 .e index @0 |
︙ | ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | .e select clear selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test entry-3.50.1 {EntryWidgetCmd procedure, "select clear" widget command} -setup { entry .e | | | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | .e select clear selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test entry-3.50.1 {EntryWidgetCmd procedure, "select clear" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "0123456789" .e select from 1 .e select to 4 update .e select clear |
︙ | ︙ | |||
1197 1198 1199 1200 1201 1202 1203 | } -body { .e selection present foo } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection present"} test entry-3.52 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e | | | | | 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 | } -body { .e selection present foo } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection present"} test entry-3.52 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e selection present } -cleanup { destroy .e } -result 1 test entry-3.53 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e configure -exportselection false .e selection present } -cleanup { destroy .e } -result 1 test entry-3.54 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e delete 0 end .e selection present |
︙ | ︙ | |||
1249 1250 1251 1252 1253 1254 1255 | } -body { .e select adjust 2 3 } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection adjust index"} test entry-3.57 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup { entry .e | | | | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 | } -body { .e select adjust 2 3 } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection adjust index"} test entry-3.57 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "0123456789" .e select from 1 .e select to 5 update .e select adjust 4 selection get } -cleanup { destroy .e } -result 123 test entry-3.58 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end "0123456789" .e select from 1 .e select to 5 update .e select adjust 2 |
︙ | ︙ | |||
1310 1311 1312 1313 1314 1315 1316 | .e select range 4 4 .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-3.63 {EntryWidgetCmd procedure, "selection range" widget command} -setup { entry .e | | | | | | | | | | | | | | | | | | | | | | | | 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 | .e select range 4 4 .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-3.63 {EntryWidgetCmd procedure, "selection range" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end 0123456789 .e select from 3 .e select to 7 .e select range 2 9 list [.e index sel.first] [.e index sel.last] [.e index anchor] } -cleanup { destroy .e } -result {2 9 3} test entry-3.64 {EntryWidgetCmd procedure, "selection" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end 0123456789 .e selection range 0 end .e configure -state disabled .e selection range 2 4 .e configure -state normal list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {0 10} test entry-3.64a {EntryWidgetCmd procedure, "selection" widget command} -setup { entry .e pack .e ; update idletasks update } -body { .e insert end 0123456789 .e selection range 0 end .e configure -state readonly .e selection range 2 4 .e configure -state normal list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 4} test entry-3.64b {EntryWidgetCmd procedure, "selection to" widget command} -setup { entry .e pack .e ; update idletasks update .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." } -body { .e select to 2 3 } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection to index"} test entry-3.65 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 5 format {%.7f %.7f} {*}[.e xview] } -cleanup { destroy .e } -result {0.0537634 0.2688172} test entry-3.66 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e xview gorp } -cleanup { destroy .e } -returnCodes error -result {bad entry index "gorp"} test entry-3.67 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 0 .e icursor 10 .e xview insert format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.107527 0.322581} test entry-3.68 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e xview moveto foo bar } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview moveto fraction"} test entry-3.69 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e xview moveto foo } -cleanup { destroy .e } -returnCodes error -result {expected floating-point number but got "foo"} test entry-3.70 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview moveto 0.5 format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.505376 0.720430} test entry-3.71 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview scroll 24 } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview scroll number pages|units"} test entry-3.72 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview scroll gorp units } -cleanup { destroy .e } -returnCodes error -result {expected floating-point number but got "gorp"} test entry-3.73 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview moveto 0 .e xview scroll 1 pages format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.193548 0.408602} test entry-3.74 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview moveto .9 update .e xview scroll -2 p format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.397849 0.612903} test entry-3.75 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 30 update .e xview scroll 2 units .e index @0 } -cleanup { destroy .e } -result 32 test entry-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 30 update .e xview scroll -1 units .e index @0 } -cleanup { destroy .e } -result 29 test entry-3.77 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview scroll 23 foobars } -cleanup { destroy .e } -returnCodes error -result {bad argument "foobars": must be pages or units} test entry-3.78 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview eat 23 hamburgers } -cleanup { destroy .e } -returnCodes error -result {unknown option "eat": must be moveto or scroll} test entry-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 0 update .e xview {} .e index @0 } -cleanup { destroy .e } -result 0 test entry-3.80 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 300 .e index @0 } -cleanup { destroy .e } -result 73 test entry-3.86 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e insert 10 乎 update # UTF # If Tcl_NumUtfChars wasn't used, wrong answer would be: |
︙ | ︙ | |||
1575 1576 1577 1578 1579 1580 1581 | lappend x [format {%.6f} [lindex [.e xview] 0]] } -cleanup { destroy .e } -result {0.095745 0.106383 0.117021} test entry-3.82 {EntryWidgetCmd procedure} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 | | | | 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 | lappend x [format {%.6f} [lindex [.e xview] 0]] } -cleanup { destroy .e } -result {0.095745 0.106383 0.117021} test entry-3.82 {EntryWidgetCmd procedure} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks update } -body { .e gorp } -cleanup { destroy .e } -returnCodes error -result {bad option "gorp": must be bbox, cget, configure, delete, get, icursor, index, insert, scan, selection, validate, or xview} # The test below doesn't actually check anything directly, but if run # with Purify or some other memory-allocation-checking program it will # ensure that resources get properly freed. test entry-4.1 {DestroyEntry procedure} -body { entry .e -textvariable x -show * pack .e ; update idletasks .e insert end "Sample text" update destroy .e } -result {} test entry-5.1 {ConfigureEntry procedure, -textvariable} -body { set x 12345 |
︙ | ︙ | |||
1644 1645 1646 1647 1648 1649 1650 | set x {} entry .e1 entry .e2 } -body { .e2 insert end "This is some sample text" .e1 configure -exportselection false .e1 insert end "0123456789" | | | | | | | | < | | | | | | | | | | | | | | | | | 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 | set x {} entry .e1 entry .e2 } -body { .e2 insert end "This is some sample text" .e1 configure -exportselection false .e1 insert end "0123456789" pack .e1 .e2 ; update idletasks .e2 select from 0 .e2 select to 10 lappend x [selection get] .e1 select from 1 .e1 select to 5 lappend x [selection get] .e1 configure -exportselection 1 lappend x [selection get] set x } -cleanup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} test entry-5.6 {ConfigureEntry procedure} -setup { entry .e pack .e ; update idletasks } -body { .e insert end "0123456789" .e select from 1 .e select to 5 .e configure -exportselection 0 selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test entry-5.6.1 {ConfigureEntry procedure} -setup { entry .e pack .e ; update idletasks } -body { .e insert end "0123456789" .e select from 1 .e select to 5 .e configure -exportselection 0 catch {selection get} list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 5} test entry-5.7 {ConfigureEntry procedure} -setup { entry .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -font {Courier -12} -width 4 -xscrollcommand scroll .e insert end "01234567890" update set scrollInfo wrong .e configure -width 5 update format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.000000 0.454545} test entry-5.8 {ConfigureEntry procedure} -constraints { fonts failsOnXQuarz } -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -width 0 -font {Helvetica -12} .e insert end "0123" update .e configure -font {Helvetica -24} update winfo geom .e } -cleanup { destroy .e } -result {62x37+0+0} test entry-5.9 {ConfigureEntry procedure} -constraints { fonts } -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -font {Courier -12} -bd 2 -relief raised .e insert end "0123" update list [.e index @10] [.e index @11] [.e index @12] [.e index @13] } -cleanup { destroy .e } -result {0 0 1 1} test entry-5.10 {ConfigureEntry procedure} -constraints { fonts } -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -font {Courier -12} -bd 2 -relief flat .e insert end "0123" update list [.e index @10] [.e index @11] [.e index @12] [.e index @13] } -cleanup { destroy .e } -result {0 0 1 1} test entry-5.11 {ConfigureEntry procedure} -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { # If "0" in selected font had 0 width, caused divide-by-zero error. .e configure -font {{open look glyph}} .e scan dragto 30 update } -cleanup { destroy .e } -result {} # No tests for DisplayEntry. test entry-6.1 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e pack .e ; update idletasks } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 \ -highlightthickness 3 .e insert end 012\t45 update list [.e index @61] [.e index @62] } -cleanup { destroy .e } -result {3 4} test entry-6.2 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e pack .e ; update idletasks } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 \ -justify center -highlightthickness 3 .e insert end 012\t45 update list [.e index @96] [.e index @97] } -cleanup { destroy .e } -result {3 4} test entry-6.3 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e pack .e ; update idletasks } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 \ -justify right -highlightthickness 3 .e insert end 012\t45 update list [.e index @131] [.e index @132] } -cleanup { destroy .e } -result {3 4} test entry-6.4 {EntryComputeGeometry procedure} -setup { entry .e pack .e ; update idletasks } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 5 .e insert end "01234567890" update .e xview 6 .e index @0 } -cleanup { destroy .e } -result 6 test entry-6.5 {EntryComputeGeometry procedure} -setup { entry .e -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 5 .e insert end "01234567890" update .e xview 7 .e index @0 } -cleanup { destroy .e } -result 6 test entry-6.6 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 10 .e insert end "01234\t67890" update .e xview 3 list [.e index @39] [.e index @40] } -cleanup { destroy .e } -result {5 6} test entry-6.7 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -font {Helvetica -24} -bd 3 -relief raised -width 5 .e insert end "01234567" update list [winfo reqwidth .e] [winfo reqheight .e] } -cleanup { destroy .e } -result {77 39} test entry-6.8 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -font {Helvetica -24} -bd 3 -relief raised -width 0 .e insert end "01234567" update list [winfo reqwidth .e] [winfo reqheight .e] } -cleanup { destroy .e } -result {116 39} test entry-6.9 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -font {Helvetica -24} -bd 3 -relief raised -width 0 update list [winfo reqwidth .e] [winfo reqheight .e] } -cleanup { destroy .e } -result {25 39} test entry-6.10 {EntryComputeGeometry procedure} -constraints { unix fonts } -setup { entry .e -highlightthickness 2 -font {Helvetica -12} pack .e ; update idletasks } -body { .e configure -bd 1 -relief raised -width 0 -show . .e insert 0 12345 update set x [winfo reqwidth .e] .e configure -show X lappend x [winfo reqwidth .e] .e configure -show "" lappend x [winfo reqwidth .e] } -cleanup { destroy .e } -result {23 53 43} test entry-6.11 {EntryComputeGeometry procedure} -constraints { win } -setup { entry .e -highlightthickness 2 pack .e ; update idletasks } -body { .e configure -bd 1 -relief raised -width 0 -show . -font {helvetica 12} .e insert 0 12345 update set x1 [winfo reqwidth .e] set x2 [expr {8+5*[font measure {helvetica 12} .]}] set x [expr {$x1 eq $x2}] |
︙ | ︙ | |||
1918 1919 1920 1921 1922 1923 1924 | destroy .e } -result {1 1 1} test entry-6.12 {EntryComputeGeometry procedure} -constraints { fonts } -setup { catch {destroy .e} entry .e -font {Courier -12} -bd 2 -relief raised -width 20 | | | > | < > < | > | < > < | | | | | | | | | | > | < > < | > | | < > < | > | < > < | | | | | | | | | | | | | | | | 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 | destroy .e } -result {1 1 1} test entry-6.12 {EntryComputeGeometry procedure} -constraints { fonts } -setup { catch {destroy .e} entry .e -font {Courier -12} -bd 2 -relief raised -width 20 pack .e ; update idletasks } -body { .e insert end "012\t456\t" update list [.e index @80] [.e index @81] [.e index @115] [.e index @116] } -cleanup { destroy .e } -result {6 7 7 8} test entry-7.1 {InsertChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll update set scrollInfo wrong .e insert 0 abcde .e insert 2 XXX update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abXXXcde abXXXcde {0.000000 1.000000}} test entry-7.2 {InsertChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll update set scrollInfo wrong .e insert 0 abcde .e insert 500 XXX update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abcdeXXX abcdeXXX {0.000000 1.000000}} test entry-7.3 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 0123456789 .e select from 2 .e select to 6 .e insert 2 XXX set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {5 9 5 8} test entry-7.4 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 0123456789 .e select from 2 .e select to 6 .e insert 3 XXX set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 9 2 8} test entry-7.5 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 0123456789 .e select from 2 .e select to 6 .e insert 5 XXX set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 9 2 8} test entry-7.6 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 0123456789 .e select from 2 .e select to 6 .e insert 6 XXX set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 6 2 5} test entry-7.7 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e configure -xscrollcommand scroll .e insert 0 0123456789 .e icursor 4 .e insert 4 XXX .e index insert } -cleanup { destroy .e } -result 7 test entry-7.8 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 0123456789 .e icursor 4 .e insert 5 XXX .e index insert } -cleanup { destroy .e } -result 4 test entry-7.9 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 "This is a very long string" update .e xview 4 .e insert 3 XXX .e index @0 } -cleanup { destroy .e } -result 7 test entry-7.10 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 "This is a very long string" update .e xview 4 .e insert 4 XXX .e index @0 } -cleanup { destroy .e } -result 4 test entry-7.11 {InsertChars procedure} -constraints { fonts } -setup { entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 "xyzzy" update .e insert 2 00 winfo reqwidth .e } -cleanup { destroy .e } -result 59 test entry-8.1 {DeleteChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll update set scrollInfo wrong .e insert 0 abcde .e delete 2 4 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abe abe {0.000000 1.000000}} test entry-8.2 {DeleteChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll update set scrollInfo wrong .e insert 0 abcde .e delete {} 2 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {cde cde {0.000000 1.000000}} test entry-8.3 {DeleteChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll update set scrollInfo wrong .e insert 0 abcde .e delete 3 1000 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abc abc {0.000000 1.000000}} test entry-8.4 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 3 update set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 6 1 5} test entry-8.5 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 4 update set x "[.e index sel.first] [.e index sel.last]" .e select to 4 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 5 1 4} test entry-8.6 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 7 update set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 2 1 5} test entry-8.7 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 8 update .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-8.8 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 3 7 update set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 4 3 8} test entry-8.9 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 3 8 update .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-8.10 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e select from 8 .e select to 3 .e delete 5 8 update set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 5 5 8} test entry-8.11 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e select from 8 .e select to 3 .e delete 8 10 update set x "[.e index sel.first] [.e index sel.last]" .e select to 4 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 8 4 8} test entry-8.12 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 1 4 update .e index insert } -cleanup { destroy .e } -result 1 test entry-8.13 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 1 5 update .e index insert } -cleanup { destroy .e } -result 1 test entry-8.14 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 4 6 update .e index insert } -cleanup { destroy .e } -result 4 test entry-8.15 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 1 4 update .e index @0 } -cleanup { destroy .e } -result 1 test entry-8.16 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 1 5 update .e index @0 } -cleanup { destroy .e } -result 1 test entry-8.17 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 4 6 update .e index @0 } -cleanup { destroy .e } -result 4 test entry-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup { entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks focus .e } -body { .e insert 0 "xyzzy" update .e delete 2 4 # To check that deletion actually happened we measure the new width # of the widget, based on the measuring width of the remaining text ("xyy") |
︙ | ︙ | |||
2369 2370 2371 2372 2373 2374 2375 | } -result {12345 12345} test entry-10.1 {EntrySetValue procedure} -constraints fonts -body { set x abcde set y ab entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0 | | | | | | | | | | | | | | 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 | } -result {12345 12345} test entry-10.1 {EntrySetValue procedure} -constraints fonts -body { set x abcde set y ab entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0 pack .e ; update idletasks .e configure -textvariable x .e configure -textvariable y update list [.e get] [winfo reqwidth .e] } -cleanup { destroy .e } -result {ab 24} test entry-10.2 {EntrySetValue procedure, updating selection} -setup { unset -nocomplain x entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "a" .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-10.3 {EntrySetValue procedure, updating selection} -setup { unset -nocomplain x entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "abcdefg" list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {4 7} test entry-10.4 {EntrySetValue procedure, updating selection} -setup { unset -nocomplain x entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "abcdefghijklmn" list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {4 10} test entry-10.5 {EntrySetValue procedure, updating display position} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e configure -width 10 -font {Courier -12} -textvariable x .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e xview 10 update set x "abcdefg" update .e index @0 } -cleanup { destroy .e } -result 0 test entry-10.6 {EntrySetValue procedure, updating display position} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e ; update idletasks .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e xview 10 update set x "1234567890123456789012" update .e index @0 } -cleanup { destroy .e } -result 10 test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 pack .e ; update idletasks update } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e ; update idletasks .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e icursor 5 set x "123" .e index insert } -cleanup { destroy .e } -result 3 test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e ; update idletasks .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e icursor 5 set x "123456" .e index insert } -cleanup { destroy .e } -result 5 test entry-11.1 {EntryEventProc procedure} -setup { entry .e -highlightthickness 2 -bd 2 -font {Helvetica -12} pack .e ; update idletasks } -body { .e insert 0 abcdefg destroy .e update } -cleanup { destroy .e } -result {} |
︙ | ︙ | |||
2511 2512 2513 2514 2515 2516 2517 | } -cleanup { destroy .b } -result {{} {}} test entry-13.1 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken | | | | | | | | 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 | } -cleanup { destroy .b } -result {{} {}} test entry-13.1 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks } -body { .e insert 0 012345678901234567890 .e xview 4 update .e index end } -cleanup { destroy .e } -result 21 test entry-13.2 {GetEntryIndex procedure} -body { entry .e .e index abogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "abogus"} test entry-13.3 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks } -body { .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 .e index anchor } -cleanup { destroy .e } -result 1 test entry-13.4 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks } -body { .e insert 0 012345678901234567890 .e xview 4 update .e select from 4 .e select to 1 .e index anchor } -cleanup { destroy .e } -result 4 test entry-13.5 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks } -body { .e insert 0 012345678901234567890 .e xview 4 update .e select from 3 .e select to 15 .e select adjust 4 .e index anchor } -cleanup { destroy .e } -result 15 test entry-13.6 {GetEntryIndex procedure} -setup { entry .e } -body { .e index ebogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "ebogus"} test entry-13.7 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks } -body { .e insert 0 012345678901234567890 .e xview 4 update .e icursor 2 .e index insert } -cleanup { destroy .e } -result 2 test entry-13.8 {GetEntryIndex procedure} -setup { entry .e } -body { .e index ibogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "ibogus"} test entry-13.9 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks } -body { .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] |
︙ | ︙ | |||
2616 2617 2618 2619 2620 2621 2622 | test entry-13.10 {GetEntryIndex procedure} -constraints x11 -body { # On unix, when selection is cleared, entry widget's internal # selection range is reset. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken | | | | | | | | | 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | test entry-13.10 {GetEntryIndex procedure} -constraints x11 -body { # On unix, when selection is cleared, entry widget's internal # selection range is reset. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-13.11 {GetEntryIndex procedure} -constraints aquaOrWin32 -body { # On mac and pc, when selection is cleared, entry widget remembers # last selected range. When selection ownership is restored to # entry, the old range will be rehighlighted. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e catch {selection get} .e index sel.first } -cleanup { destroy .e } -result 1 test entry-13.12 {GetEntryIndex procedure} -constraints x11 -body { # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index sbogus } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} # why when string in .e index changed to not beginning with s, # it behaves differently? test entry-13.12.1 {GetEntryIndex procedure} -constraints unix -body { # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index bogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "bogus"} test entry-13.13 {GetEntryIndex procedure} -constraints win -body { # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index sbogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "sbogus"} test entry-13.14 {GetEntryIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, entry widget remembers # last selected range. When selection ownership is restored to # entry, the old range will be rehighlighted. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e selection get } -cleanup { destroy .e } -returnCodes error -match glob -result {*} test entry-13.14.1 {GetEntryIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, entry widget remembers # last selected range. When selection ownership is restored to # entry, the old range will be rehighlighted. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: |
︙ | ︙ | |||
2756 2757 2758 2759 2760 2761 2762 | } -cleanup { destroy .e } -returnCodes error -result {bad entry index "@xyz"} test entry-13.16 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} | | | | | | | | | | | | | | 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 | } -cleanup { destroy .e } -returnCodes error -result {bad entry index "@xyz"} test entry-13.16 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index @4 } -cleanup { destroy .e } -result 4 test entry-13.17 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index @11 } -cleanup { destroy .e } -result 4 test entry-13.18 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index @12 } -cleanup { destroy .e } -result 5 test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index @[expr {[winfo width .e] - 6}] } -cleanup { destroy .e } -result 8 test entry-13.20 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index @[expr {[winfo width .e] - 5}] } -cleanup { destroy .e } -result 9 test entry-13.21 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index @1000 } -cleanup { destroy .e } -result 9 test entry-13.22 {GetEntryIndex procedure} -setup { entry .e pack .e ; update idletasks update } -body { .e index 1xyz } -cleanup { destroy .e } -returnCodes error -result {bad entry index "1xyz"} test entry-13.23 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index {} } -cleanup { destroy .e } -result 0 test entry-13.24 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index 12 } -cleanup { destroy .e } -result 12 test entry-13.25 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e ; update idletasks .e insert 0 012345678901234567890 .e xview 4 update .e index 49 } -cleanup { destroy .e } -result 21 test entry-13.26 {GetEntryIndex procedure} -constraints fonts -body { entry .e -highlightthickness 2 -bd 2 -font {Helvetica -12} selection clear .e .e configure -show . .e insert 0 XXXYZZY pack .e ; update idletasks update list [.e index @7] [.e index @8] } -cleanup { destroy .e } -result {0 1} # XXX Still need to write tests for EntryScanTo and EntrySelectTo. |
︙ | ︙ | |||
2926 2927 2928 2929 2930 2931 2932 | } -cleanup { destroy .e } -result {Text Text} # is scrollcommand needed here?? test entry-16.1 {EntryVisibleRange procedure} -constraints fonts -body { entry .e -width 10 -font {Helvetica -12} | | | | | | | < > | < > < > | < > < | > | | 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 | } -cleanup { destroy .e } -result {Text Text} # is scrollcommand needed here?? test entry-16.1 {EntryVisibleRange procedure} -constraints fonts -body { entry .e -width 10 -font {Helvetica -12} pack .e ; update idletasks update .e insert 0 "............................." format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.000000 0.827586} test entry-16.2 {EntryVisibleRange procedure} -constraints { unix fonts } -body { entry .e -show X -width 10 -font {Helvetica -12} pack .e ; update idletasks update .e insert 0 "............................." format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.000000 0.275862} test entry-16.3 {EntryVisibleRange procedure} -constraints { win } -body { entry .e -show . -width 10 -font {Helvetica -12} pack .e ; update idletasks update .e insert 0 XXXXXXXXXXXXXXXXXXXXXXXXXXXXX format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.000000 0.827586} test entry-16.4 {EntryVisibleRange procedure} -body { entry .e -show "" format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.000000 1.000000} test entry-17.1 {EntryUpdateScrollbar procedure} -body { entry .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e update set scrollInfo wrong .e delete 0 end .e insert 0 123 update format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.000000 1.000000} test entry-17.2 {EntryUpdateScrollbar procedure} -body { entry .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e update set scrollInfo wrong .e insert 0 0123456789abcdef .e xview 3 update format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.187500 0.812500} test entry-17.3 {EntryUpdateScrollbar procedure} -body { entry .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e update set scrollInfo wrong .e insert 0 abcdefghijklmnopqrs .e xview 6 update format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.315789 0.842105} test entry-17.4 {EntryUpdateScrollbar procedure} -setup { proc bgerror msg { global x set x $msg } } -body { entry .e -width 5 pack .e update set scrollInfo wrong .e configure -xscrollcommand thisisnotacommand update list $x $errorInfo } -cleanup { destroy .e rename bgerror {} } -result {{invalid command name "thisisnotacommand"} {invalid command name "thisisnotacommand" while executing "thisisnotacommand 0.0 1.0" |
︙ | ︙ | |||
3050 3051 3052 3053 3054 3055 3056 | unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white | | | | | | | | | | | | | | | | | 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 | unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert 0 a set ::vVals } -cleanup { destroy .e } -result {.e 1 0 a {} a all key} test entry-19.2 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert 0 a ;# previous settings .e insert 1 b return $::vVals } -cleanup { destroy .e } -result {.e 1 1 ab a b all key} test entry-19.3 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert 0 ab ;# previous settings .e insert end c set ::vVals } -cleanup { destroy .e } -result {.e 1 2 abc ab c all key} test entry-19.4 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert 0 abc ;# previous settings .e insert 1 123 list $::vVals $::e } -cleanup { destroy .e } -result {{.e 1 1 a123bc abc 123 all key} a123bc} test entry-19.5 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert 0 a123bc ;# previous settings .e delete 2 set ::vVals } -cleanup { destroy .e } -result {.e 0 2 a13bc a123bc 2 all key} test entry-19.6 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert 0 a13bc ;# previous settings .e configure -validate key .e delete 1 3 set ::vVals } -cleanup { destroy .e } -result {.e 0 1 abc a13bc 13 key key} test entry-19.7 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate focus \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abc ;# previous settings set ::vVals {} .e insert end d set ::vVals } -cleanup { destroy .e } -result {} test entry-19.8 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e configure -validate focus ;# previous settings .e insert end abcd ;# previous settings focus -force .e # update necessary to process FocusIn event update set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focus focusin} test entry-19.9 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate focus \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abcd ;# previous settings focus -force .e ;# previous settings update ;# previous settings # update necessary to process FocusIn event focus -force . # update necessary to process FocusOut event update set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focus focusout} test entry-19.10 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abcd ;# previous settings focus -force .e # update necessary to process FocusIn event update set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} all focusin} test entry-19.11 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abcd ;# previous settings focus -force .e ;# previous settings # update necessary to process FocusIn event update ;# previous settings focus -force . # update necessary to process FocusOut event update set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} all focusout} test entry-19.12 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate focusin \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert 0 abcd ;# previous settings focus -force .e # update necessary to process FocusIn event update set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focusin focusin} test entry-19.13 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate focusin \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abcd ;# previous settings set ::vVals {} focus -force . # update necessary to process FocusOut event update set ::vVals } -cleanup { destroy .e } -result {} test entry-19.14 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate focuso \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abcd ;# previous settings set ::vVals {} ;# previous settings focus -force .e # update necessary to process FocusIn event update set ::vVals } -cleanup { destroy .e } -result {} test entry-19.15 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate focuso \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abcd ;# previous settings set ::vVals {} ;# previous settings focus -force .e ;# previous settings # update necessary to process FocusIn event update ;# previous settings focus -force . # update necessary to process FocusOut event |
︙ | ︙ | |||
3321 3322 3323 3324 3325 3326 3327 | unset -nocomplain ::e ::vVals } -body { entry .e -validate focuso \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white | | | 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 | unset -nocomplain ::e ::vVals } -body { entry .e -validate focuso \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abcd ;# previous settings set ::vVals {} ;# previous settings focus -force .e ;# previous settings # update necessary to process FocusIn event update ;# previous settings focus -force . # update necessary to process FocusOut event |
︙ | ︙ | |||
3344 3345 3346 3347 3348 3349 3350 | unset -nocomplain ::e ::vVals } -body { entry .e -validate focuso \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white | | | | | 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 | unset -nocomplain ::e ::vVals } -body { entry .e -validate focuso \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks .e insert end abcd ;# previous settings set ::e newdata list [.e cget -validate] $::vVals } -cleanup { destroy .e } -result {focusout {.e -1 -1 newdata abcd {} focusout forced}} # proc doval changed - returns 0 test entry-19.18 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval3 %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks set ::e newdata ;# previous settings .e configure -validate all set ::e nextdata list [.e cget -validate] $::vVals } -cleanup { destroy .e } -result {none {.e -1 -1 nextdata newdata {} all forced}} ## This sets validate to none because it shows that we prevent a possible ## loop condition in the validation, when the entry textvar is also set # proc doval2 used test entry-19.19 {entry widget validation} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval3 %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] .e validate list [.e cget -validate] [.e get] $::vVals } -cleanup { destroy .e |
︙ | ︙ | |||
3405 3406 3407 3408 3409 3410 3411 | unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white | | | 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 | unset -nocomplain ::e ::vVals } -body { entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e ; update idletasks set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] ;# prev .e validate ;# previous settings .e configure -validate all set ::e testdata list [.e cget -validate] [.e get] $::e $::vVals |
︙ | ︙ | |||
3428 3429 3430 3431 3432 3433 3434 | ## different value in the entry widget shown as is in the textvar. test entry-19.21 {entry widget validation - bug 40e4bf6198} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate key \ -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \ -textvariable ::e | | | 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 | ## different value in the entry widget shown as is in the textvar. test entry-19.21 {entry widget validation - bug 40e4bf6198} -setup { unset -nocomplain ::e ::vVals } -body { entry .e -validate key \ -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \ -textvariable ::e pack .e ; update idletasks set ::e origdata .e insert 0 A list [.e cget -validate] [.e get] $::e $::vVals } -cleanup { destroy .e } -result {none origdata mydata {.e 1 0 Aorigdata origdata A key key}} |
︙ | ︙ | |||
3502 3503 3504 3505 3506 3507 3508 | destroy .e } -result 0 test entry-20.7 {widget deletion with textvariable active} -body { # SF bugs 607390 and 617446 set FOO init entry .e -textvariable FOO -validate all \ | | | 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 | destroy .e } -result 0 test entry-20.7 {widget deletion with textvariable active} -body { # SF bugs 607390 and 617446 set FOO init entry .e -textvariable FOO -validate all \ -validatecommand {%W configure -bg white; format 1} bind .e <Destroy> { set FOO hello } destroy .e winfo exists .e } -cleanup { destroy .e } -result 0 |
︙ | ︙ |
Changes to tests/event.test.
1 2 3 4 5 | # This file is a Tcl script to test the code in tkEvent.c. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. | | < < | < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < | < < < < < | < < < < < < < < < < > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # This file is a Tcl script to test the code in tkEvent.c. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test # XXX This test file is woefully incomplete. Right now it only tests # a few of the procedures in tkEvent.c. Please add more tests whenever # possible. # Setup table used to query key events. proc _init_keypress_lookup {} { global keypress_lookup # Characters with meaning to Tcl... array set keypress_lookup [list \ - minus \ > greater \ \" quotedbl \ \# numbersign \ \$ dollar \ \; semicolon \ \[ bracketleft \ \\ backslash \ \] bracketright \ \{ braceleft \ \} braceright \ " " space \ \xA0 nobreakspace \ "\n" Return \ "\t" Tab] } # Lookup an event in the keypress table. # For example: # Q -> Q # ; -> semicolon # > -> greater # Delete -> Delete # Escape -> Escape proc _keypress_lookup {char} { global keypress_lookup if {! [info exists keypress_lookup]} { |
︙ | ︙ | |||
752 753 754 755 756 757 758 759 760 761 762 763 764 765 | lappend result [$e index insert] lappend result [_get_selection $e] return $result } -cleanup { deleteWindows } -result {1.3 A 1.3 A} test event-7.2(double-click) {A double click on a lone character in an entry widget should select that character} -setup { deleteWindows } -body { set t [toplevel .t] set e [entry $t.e] | > | 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | lappend result [$e index insert] lappend result [_get_selection $e] return $result } -cleanup { deleteWindows unset x1 y1 width height middle_y left_x left_y right_x right_y } -result {1.3 A 1.3 A} test event-7.2(double-click) {A double click on a lone character in an entry widget should select that character} -setup { deleteWindows } -body { set t [toplevel .t] set e [entry $t.e] |
︙ | ︙ | |||
818 819 820 821 822 823 824 825 826 827 828 829 830 831 | lappend result [$e index insert] lappend result [_get_selection $e] return $result } -cleanup { deleteWindows } -result {4 A 4 A} test event-8 {event generate with keysyms corresponding to multi-byte virtual keycodes - bug e36963bfe8df9f5e528134707a91b9c0051de723} -constraints nonPortable -setup { deleteWindows set res [list ] | > | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | lappend result [$e index insert] lappend result [_get_selection $e] return $result } -cleanup { deleteWindows unset x1 y1 width height middle_y left_x left_y right_x right_y } -result {4 A 4 A} test event-8 {event generate with keysyms corresponding to multi-byte virtual keycodes - bug e36963bfe8df9f5e528134707a91b9c0051de723} -constraints nonPortable -setup { deleteWindows set res [list ] |
︙ | ︙ | |||
854 855 856 857 858 859 860 861 862 863 864 865 866 867 | return "Test failed, unless the keyboard tied to the system \ on which this test is run does NOT have a diaeresis \ physical key - in this case, test is actually void." } } -cleanup { deleteWindows } -result {OK} # cleanup update unset -nocomplain keypress_lookup rename _init_keypress_lookup {} rename _keypress_lookup {} rename _keypress {} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | return "Test failed, unless the keyboard tied to the system \ on which this test is run does NOT have a diaeresis \ physical key - in this case, test is actually void." } } -cleanup { deleteWindows } -result {OK} test event-9 {no <Enter> event is generated for the container window when its managed window in which the mouse pointer was inside gets destroyed - bug 9e1312f32c} -setup { set res [list ] set iconified false if {[winfo ismapped .]} { wm iconify . update set iconified true } } -body { toplevel .top pack propagate .top 0 bind .top <Enter> {lappend res %W} pack [frame .top.f -bg green -width 50 -height 50] -anchor se -side bottom tkwait visibility .top.f after 50 update focus -force .top.f event generate .top.f <Motion> -warp 1 -x 25 -y 25 ; # <Enter> sent to .top and .top.f controlPointerWarpTiming update ; # idletasks not enough destroy .top.f ; # no <Enter> event sent update set res } -cleanup { deleteWindows if {$iconified} { wm deiconify . update } } -result {.top .top.f} test event-9.1 {enter . window by destroying a toplevel - bug b1d115fa60} -setup { set EnterBind [bind . <Enter>] } -body { wm geometry . 200x200+300+300 wm deiconify . _pause 200 toplevel .top2 -width 200 -height 200 wm geometry .top2 +[expr {[winfo rootx .]+50}]+[expr {[winfo rooty .]+50}] wm deiconify .top2 raise .top2 _pause 400 event generate .top2 <Motion> -warp 1 -x 50 -y 50 _pause 100 bind . <Enter> {lappend res %W} set res [list ] destroy .top2 _pause 200 set res } -cleanup { deleteWindows bind . <Enter> $EnterBind } -result {.} test event-9.2 {enter toplevel window by destroying a toplevel - bug b1d115fa60} -setup { set iconified false if {[winfo ismapped .]} { wm iconify . update set iconified true } } -body { toplevel .top1 wm geometry .top1 200x200+300+300 wm deiconify .top1 _pause 200 toplevel .top2 -width 200 -height 200 wm geometry .top2 +[expr {[winfo rootx .top1]+50}]+[expr {[winfo rooty .top1]+50}] wm deiconify .top2 raise .top2 _pause 400 event generate .top2 <Motion> -warp 1 -x 50 -y 50 _pause 100 bind .top1 <Enter> {lappend res %W} set res [list ] destroy .top2 _pause 200 set res } -cleanup { deleteWindows ; # destroy all children of ".", this already includes .top1 if {$iconified} { wm deiconify . update } } -result {.top1} # cleanup update unset -nocomplain keypress_lookup rename _init_keypress_lookup {} rename _keypress_lookup {} rename _keypress {} |
︙ | ︙ |
Changes to tests/filebox.test.
1 2 3 4 5 | # This file is a Tcl script to test out Tk's "tk_getOpenFile" and # "tk_getSaveFile" commands. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out Tk's "tk_getOpenFile" and # "tk_getSaveFile" commands. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands test fileDialog-0.1 {GetFileName: file types: MakeFilter() fails} { |
︙ | ︙ | |||
70 71 72 73 74 75 76 | } update SendButtonPress $parent ok mouse } proc SendButtonPress {parent btn type} { | < | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | } update SendButtonPress $parent ok mouse } proc SendButtonPress {parent btn type} { if {$parent == "."} { set w .__tk_filedialog } else { set w $parent.__tk_filedialog } upvar ::tk::dialog::file::__tk_filedialog data |
︙ | ︙ | |||
107 108 109 110 111 112 113 | if {$tcl_platform(platform) == "unix"} { set modes "0 1" } else { set modes 1 } set unknownOptionsMsg(tk_getOpenFile,notAqua) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, -title, or -typevariable} | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | if {$tcl_platform(platform) == "unix"} { set modes "0 1" } else { set modes 1 } set unknownOptionsMsg(tk_getOpenFile,notAqua) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, -title, or -typevariable} set unknownOptionsMsg(tk_getOpenFile,aqua) {bad option "-foo": must be -command, -defaultextension, -filetypes, -initialdir, -initialfile, -message, -multiple, -parent, -title, or -typevariable} set unknownOptionsMsg(tk_getSaveFile,notAqua) {bad option "-foo": must be -confirmoverwrite, -defaultextension, -filetypes, -initialdir, -initialfile, -parent, -title, or -typevariable} set unknownOptionsMsg(tk_getSaveFile,aqua) {bad option "-foo": must be -command, -confirmoverwrite, -defaultextension, -filetypes, -initialdir, -initialfile, -message, -parent, -title, or -typevariable} set tmpFile "filebox.tmp" makeFile { # this file can be empty! } $tmpFile array set filters { |
︙ | ︙ | |||
206 207 208 209 210 211 212 | set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring | < | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring test filebox-2.1-$mode "tk_getOpenFile command" nonUnixUserInteraction { ToPressButton $parent cancel tk_getOpenFile -title "Press Cancel ($verylongstring)" -parent $parent } "" set fileName $tmpFile set fileDir [tcltest::temporaryDirectory] |
︙ | ︙ | |||
277 278 279 280 281 282 283 | } foreach {x res} [list 1 "-unset-" 2 "Text files"] { set t [expr {$x + [llength [array names filters]]}] test filebox-3.$t-$mode "tk_getOpenFile command" nonUnixUserInteraction { catch {unset tv} catch {unset typeName} ToPressButton $parent ok | < < < | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | } foreach {x res} [list 1 "-unset-" 2 "Text files"] { set t [expr {$x + [llength [array names filters]]}] test filebox-3.$t-$mode "tk_getOpenFile command" nonUnixUserInteraction { catch {unset tv} catch {unset typeName} ToPressButton $parent ok set choice [tk_getOpenFile -title "Press Ok" \ -filetypes $filters($x) -parent $parent \ -initialfile $fileName -initialdir $fileDir \ -typevariable tv] if {[info exists tv]} { set typeName $tv } else { |
︙ | ︙ | |||
333 334 335 336 337 338 339 | } -returnCodes error -result {bad file type "Foo", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"} set isNative [expr { [info commands ::tk::MotifFDialog] eq "" && [info commands ::tk::dialog::file::] eq "" }] | < < < < < < < < < < < < < < | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | } -returnCodes error -result {bad file type "Foo", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"} set isNative [expr { [info commands ::tk::MotifFDialog] eq "" && [info commands ::tk::dialog::file::] eq "" }] test filebox-5.1-$mode "tk_getSaveFile command" nonUnixUserInteraction { ToPressButton $parent cancel tk_getSaveFile -title "Press Cancel ($verylongstring)" -parent $parent } "" set fileName "12x 455" set fileDir [pwd] |
︙ | ︙ |
Changes to tests/focus.test.
1 2 3 4 5 | # This file is a Tcl script to test out the "focus" command and the # other procedures in the file tkFocus.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994-1996 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file is a Tcl script to test out the "focus" command and the # other procedures in the file tkFocus.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] proc focusSetup {} { destroy .t toplevel .t wm geom .t +0+0 foreach i {b1 b2 b3 b4} { |
︙ | ︙ |
Changes to tests/focusTcl.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the features of the script # file focus.tcl, which includes the procedures tk_focusNext and # tk_focusPrev, among other things. This file is organized in the # standard fashion for Tcl tests. # # Copyright © 1995 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out the features of the script # file focus.tcl, which includes the procedures tk_focusNext and # tk_focusPrev, among other things. This file is organized in the # standard fashion for Tcl tests. # # Copyright © 1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/font.test.
1 2 3 4 5 | # This file is a Tcl script to test out Tk's "font" command # plus the procedures in tkFont.c. It is organized in the # standard white-box fashion for Tcl tests. # # Copyright © 1996-1998 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # This file is a Tcl script to test out Tk's "font" command # plus the procedures in tkFont.c. It is organized in the # standard white-box fashion for Tcl tests. # # Copyright © 1996-1998 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands # Some tests require support for 4-byte UTF-8 sequences testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}] testConstraint utfcompat [expr {([string length "\U10000"] == 2) && [package vsatisfies [package provide Tcl] 8]}] testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] set defaultfontlist [font names] proc getnondefaultfonts {} { global defaultfontlist set nondeffonts [list ] |
︙ | ︙ | |||
152 153 154 155 156 157 158 | } -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike} test font-4.12 {font command: actual} -body { font actual {-family times} -- \uD800 } -match glob -result {*} test font-4.13 {font command: actual} -body { font actual {-family times} -- \uDC00 } -match glob -result {*} | | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | } -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike} test font-4.12 {font command: actual} -body { font actual {-family times} -- \uD800 } -match glob -result {*} test font-4.13 {font command: actual} -body { font actual {-family times} -- \uDC00 } -match glob -result {*} test font-4.14 {font command: actual} -constraints {utfcompat win knownBug} -body { font actual {-family times} -family -- \uD800\uDC00 } -result {times} test font-4.15 {font command: actual} -body { font actual {-family times} -- \uDC00\uD800 } -returnCodes 1 -match glob -result {expected a single character but got "*"} test font-4.16 {font command: actual} -constraints {fullutf win knownBug} -body { font actual {-family times} -family -- \U10000 } -result {times} test font-5.1 {font command: configure} -body { # (objc < 3) font configure |
︙ | ︙ | |||
436 437 438 439 440 441 442 | test font-10.4 {font command: metrics: arguments} -body { # (objc - skip) > 4) when skip == 0 font metrics xyz abc def } -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?-option?"} test font-10.5 {font command: metrics: arguments} -body { # (objc - skip) > 4) when skip == 2 font metrics xyz -displayof . abc | | | | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | test font-10.4 {font command: metrics: arguments} -body { # (objc - skip) > 4) when skip == 0 font metrics xyz abc def } -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?-option?"} test font-10.5 {font command: metrics: arguments} -body { # (objc - skip) > 4) when skip == 2 font metrics xyz -displayof . abc } -returnCodes error -result {bad metric "abc": must be -ascent, -descent, -fixed, or -linespace} test font-10.6 {font command: metrics: bad font} -constraints noExceed -body { # (tkfont == NULL) font metrics "\{xyz" } -returnCodes error -result "font \"{xyz\" doesn't exist" test font-10.7 {font command: metrics: get all metrics} -setup { catch {unset a} } -body { # (objc == 3) array set a [font metrics {-family xyz}] lsort [array names a] } -cleanup { unset a } -result {-ascent -descent -fixed -linespace} test font-10.8 {font command: metrics: bad metric} -body { # (Tcl_GetIndexFromObj() != TCL_OK) font metrics $fixed -xyz } -returnCodes error -result {bad metric "-xyz": must be -ascent, -descent, -fixed, or -linespace} test font-10.9 {font command: metrics: get individual metrics} -body { font metrics $fixed -ascent font metrics $fixed -descent font metrics $fixed -linespace font metrics $fixed -fixed } -result 1 |
︙ | ︙ | |||
519 520 521 522 523 524 525 | } -cleanup { font delete xyz } -result {} test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup { destroy .t.f catch {font delete xyz} pack [label .t.f] | | | | | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | } -cleanup { font delete xyz } -result {} test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup { destroy .t.f catch {font delete xyz} pack [label .t.f] update idletasks } -body { font create xyz -family times -size 20 .t.f config -font xyz -text "abcd" -padx 0 -bd 0 -highlightthickness 0 set a1 [font measure xyz "abcd"] update idletasks set b1 [winfo reqwidth .t.f] font configure xyz -family helvetica -size 20 set a2 [font measure xyz "abcd"] update idletasks set b2 [winfo reqwidth .t.f] expr {$a1==$b1 && $a2==$b2} } -cleanup { destroy .t.f font delete xyz } -result 1 |
︙ | ︙ | |||
1679 1680 1681 1682 1683 1684 1685 | destroy .t.c # Label used in 27.* tests destroy .t.f pack [label .t.f] update test font-27.1 {Tk_UnderlineTextLayout procedure: no underline chosen} -body { | | | | 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 | destroy .t.c # Label used in 27.* tests destroy .t.f pack [label .t.f] update test font-27.1 {Tk_UnderlineTextLayout procedure: no underline chosen} -body { .t.f config -text "foo" -underline {} } -result {} test font-27.2 {Tk_UnderlineTextLayout procedure: underline not visible} -body { .t.f config -text "000 00000" -wrap [expr $ax*7] -under 10 } -result {} test font-27.3 {Tk_UnderlineTextLayout procedure: underline is visible} -body { .t.f config -text "000 00000" -wrap [expr $ax*7] -under 5 .t.f config -wrap -1 -underline {} } -result {} destroy .t.f # Canvas created for tests: 28.* destroy .t.c |
︙ | ︙ | |||
1761 1762 1763 1764 1765 1766 1767 | # Label used in 29.* tests destroy .t.f pack [label .t.f] update test font-29.1 {Tk_CharBBox procedure: index < 0} -body { | | | 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 | # Label used in 29.* tests destroy .t.f pack [label .t.f] update test font-29.1 {Tk_CharBBox procedure: index < 0} -body { .t.f config -text "000" -underline {} } -result {} test font-29.2 {Tk_CharBBox procedure: loop} -body { .t.f config -text "000\t000\t000\t000" -underline 9 } -result {} test font-29.3 {Tk_CharBBox procedure: special char} -body { .t.f config -text "000\t000\t000" -underline 7 } -result {} |
︙ | ︙ | |||
2336 2337 2338 2339 2340 2341 2342 | font actual -xyz--*-*-*-*-*-*-*-*-*-*-*-* font actual -xyz-*-*-*-*-*-*-*-*-*-*-*-*-* font actual -xyz-?-*-*-*-*-*-*-*-*-*-*-*-* lindex [font actual -xyz-times-*-*-*-*-*-*-*-*-*-*-*-*] 1 } -result [font actual {times 0} -family] | | | 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 | font actual -xyz--*-*-*-*-*-*-*-*-*-*-*-* font actual -xyz-*-*-*-*-*-*-*-*-*-*-*-*-* font actual -xyz-?-*-*-*-*-*-*-*-*-*-*-*-* lindex [font actual -xyz-times-*-*-*-*-*-*-*-*-*-*-*-*] 1 } -result [font actual {times 0} -family] test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntu -setup { set oldscale [tk scaling] } -body { tk scaling 0.5 font actual {times -12} -size } -cleanup { tk scaling $oldscale } -result 24 |
︙ | ︙ | |||
2360 2361 2362 2363 2364 2365 2366 | test font-45.1 {TkFontGetAliasList: no match} -body { font actual {snarky 10} -family } -result [font actual {-size 10} -family] test font-45.2 {TkFontGetAliasList: match} -constraints win -body { font actual {times 10} -family } -result {times} | | | 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 | test font-45.1 {TkFontGetAliasList: no match} -body { font actual {snarky 10} -family } -result [font actual {-size 10} -family] test font-45.2 {TkFontGetAliasList: match} -constraints win -body { font actual {times 10} -family } -result {times} test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed failsOnUbuntu} -body { if {[font actual {{times new roman} 10} -family] eq "Times New Roman"} { # avoid test failure on systems that have a real "times new roman" font set res 1 } else { set res [expr {[font actual {{times new roman} 10} -family] eq \ [font actual {times 10} -family]} ] } |
︙ | ︙ | |||
2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 | load {} Tk one load {} Tk two one eval menu .menubar two eval menu .menubar interp delete one interp delete two } -result {} # cleanup cleanupTests return | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 | load {} Tk one load {} Tk two one eval menu .menubar two eval menu .menubar interp delete one interp delete two } -result {} test font-47.2 {Bug 3049518 - Canvas} -body { if {"MyFont" ni [font names]} { font create MyFont -family "Liberation Sans" -size 13 } set text Hello! destroy .t.c set c [canvas .t.c] set textid [$c create text 20 20 -font MyFont -text $text -anchor nw] set twidth [font measure MyFont $text] set theight [font metrics MyFont -linespace] set circid [$c create polygon \ 15 15 \ [expr {15 + $twidth}] 15 \ [expr {15 + $twidth}] [expr {15 + $theight}] \ 15 [expr {15 + $theight}] \ -width 1 -joinstyle round -smooth true -fill {} -outline blue] pack $c -fill both -expand 1 -side top update # Lamda test functions set circle_text {{w user_data text circ} { if {[winfo class $w] ne "Canvas"} { puts "Wrong widget type: $w" return } if {$user_data ne "FontChanged"} { return } lappend ::results called-$w lassign [$w bbox $text] x0 y0 x1 y1 set offset 5 set coord [lmap expr { $x0-$offset $y0-$offset $x1+$offset $y0-$offset $x1+$offset $y1+$offset $x0-$offset $y1+$offset } {expr $expr}] if {[catch {$w coord $circ $coord} err]} { puts Error:$err } }} set enclosed {{can id} {$can find enclosed {*}[$can bbox $id]}} set results {} apply $circle_text $c FontChanged $textid $circid update bind $c <<TkWorldChanged>> [list apply $circle_text %W %d $textid $circid] # Begin test: set results {} lappend results [apply $enclosed $c $circid] font configure MyFont -size 26 update ; # services the "TheWorldHasChanged" event, queues "TkWorldChanged" events update ; # services the queued "TkWorldChanged" events lappend results [apply $enclosed $c $circid] font configure MyFont -size 9 update idletasks update lappend results [apply $enclosed $c $circid] font configure MyFont -size 12 update idletasks update lappend results [apply $enclosed $c $circid] } -cleanup { destroy $c unset -nocomplain ::results } -result {{1 2} called-.t.c {1 2} called-.t.c {1 2} called-.t.c {1 2}} test font-47.3 {Bug 3049518 - Label} -body { if {"MyFont" ni [font names]} { font create MyFont -family "Liberation Sans" -size 13 } set text "Label Test" destroy .t.l set make-img {{size} { set img [image create photo -width $size -height $size] $img blank set max [expr {$size - 1}] for {set x 0} {$x < $size} {incr x} { $img put red -to $x $x $img put black -to 0 $x $img put black -to $x 0 $img put black -to $max $x $img put black -to $x $max } return $img }} set testWorldChanged {{w user_data} { global make-img if {$user_data ne "FontChanged"} { return } if {![winfo exists $w] || [winfo class $w] ne "Label"} { return } if {[$w cget -image] ne ""} { image delete [$w cget -image] } set size [font metrics [$w cget -font] -linespace] set img [apply ${make-img} $size] $w configure -image $img }} set check {{w} { global results set f [$w cget -font] set i [$w cget -image] set fs [font metrics $f -linespace] set ish [image height $i] set isw [image width $i] lappend results [list [expr {$fs == $ish ? 1 : [list $fs $ish]}] [expr {$fs == $isw ? 1 : [list $fs $isw]}]] }} set size [font metrics MyFont -linespace] set img [apply ${make-img} $size] set l [label .t.l -compound left -image $img -text $text -font MyFont] pack $l -side top -fill both -expand 1 update bind $l <<TkWorldChanged>> [list apply $testWorldChanged %W %d] set ::results {} apply $check $l font configure MyFont -size 26 update ; # services the "TheWorldHasChanged" event, queues "TkWorldChanged" events update ; # services the queued "TkWorldChanged" events apply $check $l font configure MyFont -size 9 update idletasks update apply $check $l font configure MyFont -size 13 update idletasks update apply $check $l set results } -cleanup { destroy $l unset -nocomplain ::results } -result {{1 1} {1 1} {1 1} {1 1}} # cleanup cleanupTests return |
Changes to tests/fontchooser.test.
1 2 3 4 5 6 7 8 | # Test the "tk::fontchooser" command # # Copyright © 2008 Pat Thoyts package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Test the "tk::fontchooser" command # # Copyright © 2008 Pat Thoyts package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] # the following helper functions are related to the functions used # in winDialog.test where they are used to send messages to the win32 # dialog (hence the weirdness). proc start {cmd} { set ::tk_dialog {} set ::iter_after 0 after 1 $cmd } proc then {cmd} { |
︙ | ︙ | |||
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | tk::fontchooser::Show } then { Click ok } lrange $::testfont 1 end } -result {14 bold} # ------------------------------------------------------------------------- cleanupTests return # Local Variables: # mode: tcl # indent-tabs-mode: nil # End: | > > > > > > | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | tk::fontchooser::Show } then { Click ok } lrange $::testfont 1 end } -result {14 bold} test fontchooser-5.1 {fontchooser multiple configure} -constraints {scriptImpl} -body { tk fontchooser configure -title TestTitle -command foo tk fontchooser configure -command bar tk fontchooser configure -title } -result {TestTitle} # ------------------------------------------------------------------------- cleanupTests return # Local Variables: # mode: tcl # indent-tabs-mode: nil # End: |
Changes to tests/frame.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the "frame", "labelframe" and # "toplevel" commands of Tk. It is organized in the standard fashion for Tcl # tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out the "frame", "labelframe" and # "toplevel" commands of Tk. It is organized in the standard fashion for Tcl # tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands |
︙ | ︙ | |||
651 652 653 654 655 656 657 | wm geometry .t +0+0 toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green tkwait visibility .x list [expr {[winfo rootx .x] - [winfo rootx .t]}] \ [expr {[winfo rooty .x] - [winfo rooty .t]}] \ [winfo width .t] [winfo height .t] } -cleanup { | < < < < < < | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | wm geometry .t +0+0 toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green tkwait visibility .x list [expr {[winfo rootx .x] - [winfo rootx .t]}] \ [expr {[winfo rooty .x] - [winfo rooty .t]}] \ [winfo width .t] [winfo height .t] } -cleanup { deleteWindows } -result {0 0 140 300} test frame-3.10 {TkCreateFrame procedure, -use option} -constraints { unix } -setup { deleteWindows } -body { |
︙ | ︙ | |||
1024 1025 1026 1027 1028 1029 1030 | test frame-9.1 {MapFrame procedure} -setup { deleteWindows } -body { toplevel .t -width 100 -height 400 wm geometry .t +0+0 set result [winfo ismapped .t] | | | 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | test frame-9.1 {MapFrame procedure} -setup { deleteWindows } -body { toplevel .t -width 100 -height 400 wm geometry .t +0+0 set result [winfo ismapped .t] update lappend result [winfo ismapped .t] } -cleanup { deleteWindows } -result {0 1} test frame-9.2 {MapFrame procedure} -setup { deleteWindows } -body { |
︙ | ︙ | |||
1049 1050 1051 1052 1053 1054 1055 | wm geometry .t2 +0+0 tkwait visibility .t2 toplevel .t -width 100 -height 400 wm geometry .t +0+0 frame .t2.f -width 50 -height 50 bind .t2.f <Configure> {destroy .t} pack .t2.f -side top | | | 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | wm geometry .t2 +0+0 tkwait visibility .t2 toplevel .t -width 100 -height 400 wm geometry .t +0+0 frame .t2.f -width 50 -height 50 bind .t2.f <Configure> {destroy .t} pack .t2.f -side top update winfo exists .t } -cleanup { deleteWindows } -result 0 test frame-10.1 {frame widget vs hidden commands} -setup { deleteWindows |
︙ | ︙ | |||
1137 1138 1139 1140 1141 1142 1143 | } return $result } -cleanup { deleteWindows } -result {1 1 1 1 1 1 1 1 1 1 1 1} test frame-12.3 {FrameWorldChanged procedure} -setup { deleteWindows | < < < < | < < | < | < | 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | } return $result } -cleanup { deleteWindows } -result {1 1 1 1 1 1 1 1 1 1 1 1} test frame-12.3 {FrameWorldChanged procedure} -setup { deleteWindows } -body { # Check reaction on font change font create myfont -family courier -size 10 labelframe .f -font myfont -text Mupp place .f -x 0 -y 0 -width 40 -height 40 pack [frame .f.f] -fill both -expand 1 update set h1 [font metrics myfont -linespace] set y1 [winfo y .f.f] font configure myfont -size 20 update ; # services the "TheWorldHasChanged" event, queues "TkWorldChanged" events update ; # services the queued "TkWorldChanged" events set h2 [font metrics myfont -linespace] set y2 [winfo y .f.f] expr {($h2 - $h1) - ($y2 - $y1)} } -cleanup { deleteWindows font delete myfont } -result 0 |
︙ | ︙ |
Changes to tests/geometry.test.
1 2 3 4 5 6 | # This file is a Tcl script to test the procedures in the file # tkGeometry.c (generic support for geometry managers). It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test the procedures in the file # tkGeometry.c (generic support for geometry managers). It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. proc getsize w { regexp {(^[^+-]*)} [wm geometry $w] foo x return $x } |
︙ | ︙ |
Changes to tests/get.test.
1 2 3 4 5 | # This file is a Tcl script to test out the procedures in the file # tkGet.c. It is organized in the standard fashion for Tcl # white-box tests. # # Copyright © 1998 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the procedures in the file # tkGet.c. It is organized in the standard fashion for Tcl # white-box tests. # # Copyright © 1998 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/grab.test.
1 2 3 4 5 6 | # Tests for the grab command. # # This file contains a collection of tests for one or more of the Tk # built-in commands. Sourcing this file runs the tests and # generates output for errors. No output means no errors were found. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Tests for the grab command. # # This file contains a collection of tests for one or more of the Tk # built-in commands. Sourcing this file runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1998-2000 Ajuba Solutions. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/grid.test.
1 2 3 4 | # This file is a Tcl script to test out the *NEW* "grid" command of Tk. It is # (almost) organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test out the *NEW* "grid" command of Tk. It is # (almost) organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/image.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the "image" command and the # other procedures in the file tkImage.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out the "image" command and the # other procedures in the file tkImage.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/imgBmap.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out images of type "bitmap" (i.e., # the procedures in the file tkImgBmap.c). It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out images of type "bitmap" (i.e., # the procedures in the file tkImgBmap.c). It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit |
︙ | ︙ | |||
217 218 219 220 221 222 223 | destroy .c } -result {} test imageBmap-5.1 {GetBitmapData procedure} -body { list [catch {image create bitmap -file ~bad_user/a/b} msg] \ [string tolower $msg] | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | destroy .c } -result {} test imageBmap-5.1 {GetBitmapData procedure} -body { list [catch {image create bitmap -file ~bad_user/a/b} msg] \ [string tolower $msg] } -result {1 {couldn't read bitmap file "~bad_user/a/b": no such file or directory}} test imageBmap-5.2 {GetBitmapData procedure} -body { list [catch {image create bitmap -file bad_name} msg] [string tolower $msg] } -result {1 {couldn't read bitmap file "bad_name": no such file or directory}} test imageBmap-5.3 {GetBitmapData procedure} -setup {imageCleanup} -body { image create bitmap -data { } } -returnCodes error -result {format error in bitmap data} test imageBmap-5.4 {GetBitmapData procedure} -setup {imageCleanup} -body { |
︙ | ︙ |
Changes to tests/imgPNG.test.
1 2 3 4 5 | # This file is a Tcl script to test out the code in tkImgFmtPNG.c, which reads # and write PNG-format image files for photo widgets. The files is organized # in the standard fashion for Tcl tests. # # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the code in tkImgFmtPNG.c, which reads # and write PNG-format image files for photo widgets. The files is organized # in the standard fashion for Tcl tests. # # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 1998 Willem van Schaik (images only) # Copyright © 2008 Donal K. Fellows # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv |
︙ | ︙ | |||
1052 1053 1054 1055 1056 1057 1058 | PmSgZc0hPNhvYAruYN27V8n2gtXV8fOShnq5O9t+492kG9n2LQv65KWAaWAMUDPhEaG0oIFyOMgkhy YOaz2HKRVHc4lqQbf3LMisUrWjrl9XhhBCkwnWnNLiFDVCParR5BeeRJE47aungOASE1gueu+OTh76 0dt3Gzx47dvzRUnHNQ8Cf2yQZE7mg+XtslqVWi5XocjlDu7K0pgS+dfbs2V8tFotPlUqlr+ZyuXNO+ duFtaSrZF3pfCpiGjN2imToJJ39m6BjG1XZRwrkAI8YUKSZWlEZQDAIrNArHnyvpXtmM/B7wJeAbwO fBcxKuQMrzfLdBoz29fX9led5v6u1XnBJW7vnr/YlrXEoNo22LRYOYlxZ1S6rkOfDcLvPAY/hGmWC7 H68uFI+x0oSPg2MAN/L5/M/vtqSED/T5cMu9J4Wf7HMGsB/4TEv/DFwe3Y/NPN57VXh+5BWApwFLlh r661tV1eju/ne8YJrkWtES0tmRe2VOviv2j2aBp5nHihiRaz/A4oCnsAsje/+AAAAAElFTkSuQmCC" | > > > | | 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | PmSgZc0hPNhvYAruYN27V8n2gtXV8fOShnq5O9t+492kG9n2LQv65KWAaWAMUDPhEaG0oIFyOMgkhy YOaz2HKRVHc4lqQbf3LMisUrWjrl9XhhBCkwnWnNLiFDVCParR5BeeRJE47aungOASE1gueu+OTh76 0dt3Gzx47dvzRUnHNQ8Cf2yQZE7mg+XtslqVWi5XocjlDu7K0pgS+dfbs2V8tFotPlUqlr+ZyuXNO+ duFtaSrZF3pfCpiGjN2imToJJ39m6BjG1XZRwrkAI8YUKSZWlEZQDAIrNArHnyvpXtmM/B7wJeAbwO fBcxKuQMrzfLdBoz29fX9led5v6u1XnBJW7vnr/YlrXEoNo22LRYOYlxZ1S6rkOfDcLvPAY/hGmWC7 H68uFI+x0oSPg2MAN/L5/M/vtqSED/T5cMu9J4Wf7HMGsB/4TEv/DFwe3Y/NPN57VXh+5BWApwFLlh r661tV1eju/ne8YJrkWtES0tmRe2VOviv2j2aBp5nHihiRaz/A4oCnsAsje/+AAAAAElFTkSuQmCC" dpi100aspect2 "iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAACXBIWXMAAA9hAAAewgEw8YEEAAAA FklEQVR4nGP4+vXrP11lJgYGhj9xSQAzOwXsETZ69QAAAABJRU5ErkJggg==" } # $encoded(basn0g08), $encoded(basn2c08), $encoded(basn3p08), $encoded(basn6a08) test imgPNG-1.1 {reading basic images; grayscale} -setup { catch {rename foo ""} } -body { image create photo foo -data $encoded(basn0g08) list [image width foo] [image height foo] |
︙ | ︙ | |||
1110 1111 1112 1113 1114 1115 1116 | # the image contains an unknown chunk iDOT # since the name of this chunk starts with a lowercase letter, # it's an ancillary chunk that shall not trigger an error catch {set i [image create photo -file $fileName]} } -cleanup { image delete $i } -result 0 | | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | # the image contains an unknown chunk iDOT # since the name of this chunk starts with a lowercase letter, # it's an ancillary chunk that shall not trigger an error catch {set i [image create photo -file $fileName]} } -cleanup { image delete $i } -result 0 test imgPNG-4.1 {data image with metadata} -body { image create photo i1 -data $encoded(dpi100aspect2) i1 cget -metadata } -cleanup { image delete i1 } -result {DPI 99.9998 aspect 2.0} test imgPNG-4.2 {file image with metadata} -setup { set path [file join [configure -tmpdir] test.png] set h [open $path "WRONLY BINARY CREAT"] puts -nonewline $h [binary decode base64 $encoded(dpi100aspect2)] close $h } -body { image create photo i1 -file $path i1 cget -metadata } -cleanup { image delete i1 file delete $path } -result {DPI 99.9998 aspect 2.0} test imgPNG-4.3 {data output with metadata} -setup { image create photo i1 -data $encoded(dpi100aspect2) } -body { set imgData [i1 data -format png] image delete i1 image create photo i1 -data $imgData i1 cget -metadata } -cleanup { image delete i1 } -result {DPI 99.9998 aspect 2.0} test imgPNG-4.4 {file output with metadata} -setup { image create photo i1 -data $encoded(dpi100aspect2) set path [file join [configure -tmpdir] test.png] } -body { i1 write $path -format png image delete i1 image create photo i1 -file $path i1 cget -metadata } -cleanup { image delete i1 file delete $path } -result {DPI 99.9998 aspect 2.0} } namespace delete png imageFinish cleanupTests return # Local Variables: # mode: tcl # fill-column: 78 # End: |
Changes to tests/imgPPM.test.
1 2 3 4 5 | # This file is a Tcl script to test out the code in tkImgFmtPPM.c, # which reads and write PPM-format image files for photo widgets. # The files is organized in the standard fashion for Tcl tests. # # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the code in tkImgFmtPPM.c, # which reads and write PPM-format image files for photo widgets. # The files is organized in the standard fashion for Tcl tests. # # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/imgPhoto.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the "photo" image type and the other # procedures in the file tkImgPhoto.c. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1994 The Australian National University # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out the "photo" image type and the other # procedures in the file tkImgPhoto.c. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1994 The Australian National University # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 2002-2008 Donal K. Fellows # All rights reserved. # # Author: Paul Mackerras ([email protected]) # # This file is somewhat caothic: the order of the tests does not |
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # ImgPostscriptPhoto no tests # Tk_PhotoPutBlock_NoComposite no tests, probably none needed # Tk_PhotoPutZoomedBlock_NoComposite no tests, probably none needed # Tk_PhotoExpand_Panic no tests, probably none needed # Tk_PhotoPutBlock_Panic no tests, probably none needed # Tk_PhotoPutZoomedBlock_Panic no tests, probably none needed # Tk_PhotoSetSize_Panic no tests, probably none needed #-------------------------------------------------------------------------- # # # Some tests are not specific to a function in tkImgPhoto.c. They are: # | > > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | # ImgPostscriptPhoto no tests # Tk_PhotoPutBlock_NoComposite no tests, probably none needed # Tk_PhotoPutZoomedBlock_NoComposite no tests, probably none needed # Tk_PhotoExpand_Panic no tests, probably none needed # Tk_PhotoPutBlock_Panic no tests, probably none needed # Tk_PhotoPutZoomedBlock_Panic no tests, probably none needed # Tk_PhotoSetSize_Panic no tests, probably none needed # Tk_PhotoGetMetadata: imgPhoto-21.* # Tk_PhotoSetMetadata: imgPhoto-22.* #-------------------------------------------------------------------------- # # # Some tests are not specific to a function in tkImgPhoto.c. They are: # |
︙ | ︙ | |||
192 193 194 195 196 197 198 199 200 201 202 203 204 205 | image create photo photo1 } -body { photo1 put {{blue green}} photo1 get 1 0 -withalpha } -cleanup { imageCleanup } -result {0 128 0 255} test imgPhoto-2.1 {ImgPhotoCreate procedure} -setup { imageCleanup } -body { catch {image create photo -blah blah} imageNames } -result {} | > > > | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | image create photo photo1 } -body { photo1 put {{blue green}} photo1 get 1 0 -withalpha } -cleanup { imageCleanup } -result {0 128 0 255} test imgPhoto-1.14 {options for photo images - error case} -body { image create photo photo1 -metadata } -returnCodes error -result {value for "-metadata" missing} test imgPhoto-2.1 {ImgPhotoCreate procedure} -setup { imageCleanup } -body { catch {image create photo -blah blah} imageNames } -result {} |
︙ | ︙ | |||
328 329 330 331 332 333 334 | } -result {25 30} test imgPhoto-4.6 {ImgPhotoCmd procedure: configure option} -setup { image create photo photo1 } -body { llength [photo1 configure] } -cleanup { image delete photo1 | | | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | } -result {25 30} test imgPhoto-4.6 {ImgPhotoCmd procedure: configure option} -setup { image create photo photo1 } -body { llength [photo1 configure] } -cleanup { image delete photo1 } -result 8 test imgPhoto-4.7 {ImgPhotoCmd procedure: configure option} -setup { image create photo photo1 } -body { photo1 conf -palette 3/4/2 photo1 configure -palette } -cleanup { image delete photo1 |
︙ | ︙ | |||
570 571 572 573 574 575 576 | hasTeapotPhoto } -setup { image create photo photo1 } -body { photo1 read $teapotPhotoFile -zoom 2 } -returnCodes error -cleanup { image delete photo1 | | | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | hasTeapotPhoto } -setup { image create photo photo1 } -body { photo1 read $teapotPhotoFile -zoom 2 } -returnCodes error -cleanup { image delete photo1 } -result {unrecognized option "-zoom": must be -format, -from, -metadata, -shrink, or -to} test imgPhoto-4.32 {ImgPhotoCmd procedure: read option} -setup { image create photo photo1 } -body { list [catch {photo1 read bogus} err] [string tolower $err] } -cleanup { image delete photo1 } -result {1 {couldn't open "bogus": no such file or directory}} |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 | test imgPhoto-4.90 {ImgPhotoCmd put: existing but not allowed opt} -setup { image create photo photo1 } -body { photo1 put yellow -from 0 0 1 1 } -cleanup { imageCleanup } -returnCodes error -result \ | | | | 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 | test imgPhoto-4.90 {ImgPhotoCmd put: existing but not allowed opt} -setup { image create photo photo1 } -body { photo1 put yellow -from 0 0 1 1 } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-from": must be -format, -metadata, or -to} test imgPhoto-4.91 {ImgPhotoCmd put: invalid option} -setup { image create photo photo1 } -body { photo1 put {{0 1 2 3}} -bogus x } -returnCodes error -result \ {unrecognized option "-bogus": must be -format, -metadata, or -to} test imgPhoto-4.92 {ImgPhotocmd put: missing data} -setup { image create photo photo1 } -body { photo1 put -to 0 0 } -returnCodes error -result \ {wrong # args: should be "photo1 put data ?-option value ...?"} test imgPhoto-4.93 {ImgPhotoCmd put: data in ppm format} -constraints { |
︙ | ︙ | |||
1233 1234 1235 1236 1237 1238 1239 | test imgPhoto-4.104 {ImgPhotoCmd data: existing but not accepted opt} -setup { image create photo photo1 } -body { photo1 data -to } -cleanup { imageCleanup } -returnCodes error -result \ | | | | 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | test imgPhoto-4.104 {ImgPhotoCmd data: existing but not accepted opt} -setup { image create photo photo1 } -body { photo1 data -to } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-to": must be -background, -format, -from, -grayscale, or -metadata} test imgPhoto-4.105 {ImgPhotoCmd data: invalid option} -setup { image create photo photo1 } -body { photo1 data -bogus } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-bogus": must be -background, -format, -from, -grayscale, or -metadata} test imgPhoto-4.106 {ImgPhotoCmd data: extra arg before options} -setup { image create photo photo1 } -body { photo1 data bogus -grayscale } -cleanup { imageCleanup } -returnCodes error -result \ |
︙ | ︙ | |||
2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 | test imgPhoto-20.12 {Valid GIF (file)} -setup { set fileName [file join [file dirname [info script]] red.gif] } -body { image create photo gif1 -file $fileName } -cleanup { catch {image delete gif1} } -result gif1 catch {rename foreachPixel {}} catch {rename checkImgTrans {}} catch {rename checkImgTransLoop {}} imageFinish # cleanup | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 | test imgPhoto-20.12 {Valid GIF (file)} -setup { set fileName [file join [file dirname [info script]] red.gif] } -body { image create photo gif1 -file $fileName } -cleanup { catch {image delete gif1} } -result gif1 # imgPhoto-21.x : Tk_PhotoGetMetadata test imgPhoto-21.1 {option -metadata, get configure list} -setup { image create photo photo1 -metadata {dpi 100} } -body { photo1 configure -metadata } -cleanup { catch {image delete photo1} } -result {-metadata {} {} {} {dpi 100}} test imgPhoto-21.2 {option -metadata, get value} -setup { image create photo photo1 -metadata {dpi 100} } -body { photo1 cget -metadata } -cleanup { catch {image delete photo1} } -result {dpi 100} test imgPhoto-21.3 {option -metadata, get default value} -setup { image create photo photo1 } -body { photo1 cget -metadata } -cleanup { catch {image delete photo1} } -result {} # imgPhoto-22.x : Tk_PhotoSetMetadata test imgPhoto-22.1 {option -metadata, set value} -setup { image create photo photo1 } -body { photo1 configure -metadata {dpi 100} photo1 cget -metadata } -cleanup { catch {image delete photo1} } -result {dpi 100} test imgPhoto-22.2 {option -metadata, change value} -setup { image create photo photo1 -metadata {dpi 200} } -body { photo1 configure -metadata {dpi 100} photo1 cget -metadata } -cleanup { catch {image delete photo1} } -result {dpi 100} test imgPhoto-22.3 {option -metadata, clear value} -setup { image create photo photo1 -metadata {dpi 200} } -body { photo1 configure -metadata {} photo1 cget -metadata } -cleanup { catch {image delete photo1} } -result {} # 23.x GIF images with metadata # The following gif core data is used by the following data. # N.B. this is the same image as test imgPhoto-18.10 # size 16x16, global color table size: 8 set gifstart "GIF89a\x10\x00\x10\x00\xc2\x07\x00" # color table append gifstart "\x00\x00\x00\x33\x33\xff\xff\x33\x33\xff\x33\xff\x33\xff\x33\x33\xff\xff\xff\xff\x33\xff\xff\xff" # Graphic control extension: Transparent color index: 7 (not needed here) # append gifdata "\x21\xf9\x04\x01\x0a\x00\x07\x00" # Image descriptor: 16x16, no local color table set gifdata "\x2c\x00\x00\x00\x00\x10\x00\x10\x00\x00" # Image data append gifdata "\x03\x21\x78\xba\xdc\x2d\x30\x42\x77\xa4\x15\xef\xda\xa5\xb5\xea\xd7\x07\x4a\xe2\x38\x55\xe6\x99\xaa\x6b\x69\x72\x2f\x33\x52\x1d\x65\x37\x09\x00" set gifend "\x3b" test imgPhoto-23.1 {GIF comment before image data (-data)} -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {comment ABCD} test imgPhoto-23.2 {GIF file comment before image data (-file)} -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend set path [file join [configure -tmpdir] test.gif] set h [open $path "WRONLY BINARY CREAT"] puts -nonewline $h $data close $h } -body { image create photo gif1 -file $path gif1 cget -metadata } -cleanup { catch {image delete gif1} file delete $path } -result {comment ABCD} test imgPhoto-23.3 {GIF comment after image data (-data)} -setup { set data $::gifstart append data $::gifdata # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {comment ABCD} test imgPhoto-23.4 {GIF comment after image data (-file)} -setup { set data $::gifstart append data $::gifdata # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifend set path [file join [configure -tmpdir] test.gif] set h [open $path "WRONLY BINARY CREAT"] puts $h $data close $h } -body { image create photo gif1 -file $path gif1 cget -metadata } -cleanup { catch {image delete gif1} file delete $path } -result {comment ABCD} test imgPhoto-23.5 {Two GIF comment blocks (-data)} -setup { set data $::gifstart # Append a comment extension block with data "1234" append data "\x21\xfe\x04" "1234" "\x0" append data $::gifdata # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {comment ABCD} test imgPhoto-23.6 {Two GIF comment blocks (-file)} -setup { set data $::gifstart # Append a comment extension block with data "1234" append data "\x21\xfe\x04" "1234" "\x0" append data $::gifdata # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifend set path [file join [configure -tmpdir] test.gif] set h [open $path "WRONLY BINARY CREAT"] puts $h $data close $h } -body { image create photo gif1 -file $path gif1 cget -metadata } -cleanup { catch {image delete gif1} file delete $path } -result {comment ABCD} test imgPhoto-23.7 {create: test if shared metadata object is not preserved\ (-data)}\ -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend } -body { set metadataDict [dict create A 1] set metadataDict2 $metadataDict image create photo gif1 -data $data -metadata $metadataDict list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2 } -cleanup { catch {image delete gif1} } -result {{A 1 comment ABCD} {A 1} {A 1}} test imgPhoto-23.8 {create: test if shared metadata object is not preserved\ (-file)}\ -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend set path [file join [configure -tmpdir] test.gif] set h [open $path "WRONLY BINARY CREAT"] puts $h $data close $h } -body { set metadataDict [dict create A 1] set metadataDict2 $metadataDict image create photo gif1 -file $path -metadata $metadataDict list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2 } -cleanup { catch {image delete gif1} file delete $path } -result {{A 1 comment ABCD} {A 1} {A 1}} test imgPhoto-23.9 {configure: test if shared metadata object is not\ preserved (empty image, -data)}\ -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend } -body { image create photo gif1 set metadataDict [dict create A 1] set metadataDict2 $metadataDict gif1 configure -data $data -format gif -metadata $metadataDict list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2 } -cleanup { catch {image delete gif1} } -result {{A 1 comment ABCD} {A 1} {A 1}} test imgPhoto-23.10 {configure: test if shared metadata object is not preserved\ (empty image, -file)}\ -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend set path [file join [configure -tmpdir] test.gif] set h [open $path "WRONLY BINARY CREAT"] puts $h $data close $h } -body { image create photo gif1 set metadataDict [dict create A 1] set metadataDict2 $metadataDict gif1 configure -file $path -format gif -metadata $metadataDict list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2 } -cleanup { catch {image delete gif1} file delete $path } -result {{A 1 comment ABCD} {A 1} {A 1}} test imgPhoto-23.11 {configure: test if shared metadata object is not preserved\ (metadata replace, -data}\ -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend } -body { image create photo gif1 -data "$::gifstart$::gifdata$::gifend" set metadataDict [dict create A 1] set metadataDict2 $metadataDict gif1 configure -data $data -format gif -metadata $metadataDict list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2 } -cleanup { catch {image delete gif1} } -result {{A 1 comment ABCD} {A 1} {A 1}} test imgPhoto-23.12 {configure: test if shared metadata object is not preserved\ (metadata replace, -file}\ -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend set path [file join [configure -tmpdir] test.gif] set h [open $path "WRONLY BINARY CREAT"] puts $h $data close $h } -body { image create photo gif1 -data "$::gifstart$::gifdata$::gifend" set metadataDict [dict create A 1] set metadataDict2 $metadataDict gif1 configure -file $path -format gif -metadata $metadataDict list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2 } -cleanup { catch {image delete gif1} file delete $path } -result {{A 1 comment ABCD} {A 1} {A 1}} test imgPhoto-23.13 {configure: test if shared metadata object is not preserved\ (-data)}\ -setup { set data $::gifstart$::gifdata$::gifend } -body { image create photo gif1 -data $data set metadataDict [dict create A 1] set metadataDict2 $metadataDict set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend gif1 configure -data $data -format gif -metadata $metadataDict list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2 } -cleanup { catch {image delete gif1} } -result {{A 1 comment ABCD} {A 1} {A 1}} test imgPhoto-23.14 {configure: test if shared metadata object is not preserved\ (-file)}\ -setup { set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend set path [file join [configure -tmpdir] test.gif] set h [open $path "WRONLY BINARY CREAT"] puts $h $data close $h } -body { image create photo gif1 -data "$::gifstart$::gifdata$::gifend" set metadataDict [dict create A 1] set metadataDict2 $metadataDict gif1 configure -file $path -format gif -metadata $metadataDict list [dict get [gif1 cget -metadata]] $metadataDict $metadataDict2 } -cleanup { catch {image delete gif1} file delete $path } -result {{A 1 comment ABCD} {A 1} {A 1}} test imgPhoto-23.15 {output data with comment (from -metadata argument)}\ -setup { set data $::gifstart$::gifdata$::gifend } -body { image create photo gif1 -data $data set gifData [gif1 data -format gif -metadata [dict create comment ABCD]] } -cleanup { catch {image delete gif1} } -match glob -result {*ABCD*} test imgPhoto-23.22 {output file with comment (from -metadata argument)}\ -setup { set data $::gifstart$::gifdata$::gifend set path [file join [configure -tmpdir] test.gif] } -body { image create photo gif1 -data $data gif1 write $path -format gif -metadata [dict create comment ABCD] image delete gif1 image create photo gif1 -file $path dict get [gif1 cget -metadata] comment } -cleanup { catch {image delete gif1} file delete $path } -result {ABCD} test imgPhoto-23.16 {output data with comment (from -metadata property)}\ -setup { set data $::gifstart$::gifdata$::gifend } -body { image create photo gif1 -data $data gif1 configure -metadata [dict create comment ABCD] set gifData [gif1 data -format gif] } -cleanup { catch {image delete gif1} } -match glob -result {*ABCD*} test imgPhoto-23.17 {output file with comment (from -metadata property)}\ -setup { set data $::gifstart$::gifdata$::gifend set path [file join [configure -tmpdir] test.gif] } -body { image create photo gif1 -data $data gif1 configure -metadata [dict create comment ABCD] gif1 write $path -format gif image delete gif1 image create photo gif1 -file $path dict get [gif1 cget -metadata] comment } -cleanup { catch {image delete gif1} file delete $path } -result {ABCD} test imgPhoto-23.18 {configure: empty metadata parameter overwrites image metadata} -setup { image create photo gif1 -data $::gifstart$::gifdata$::gifend\ -metadata {foo bar} set data $::gifstart # Append a comment extension block with data "ABCD" append data "\x21\xfe\x04" "ABCD" "\x0" # Trailer append data $::gifdata $::gifend } -body { gif1 configure -data $data -metadata {} gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {comment ABCD} test imgPhoto-23.19 {write: empty metadata parameter overwrites image metadata} -setup { image create photo gif1 -data $::gifstart$::gifdata$::gifend\ -metadata {comment bar} set path [file join [configure -tmpdir] test.gif] } -body { gif1 write $path -format gif -metadata {} image delete gif1 image create photo gif1 -file $path dict size [gif1 cget -metadata] } -cleanup { catch {image delete gif1} file delete $path } -result {0} test imgPhoto-23.20 {data: empty metadata parameter overwrites image metadata} -setup { image create photo gif1 -data $::gifstart$::gifdata$::gifend\ -metadata {comment bar} } -body { set data [gif1 data -format gif -metadata {}] image delete gif1 image create photo gif1 -data $data dict size [gif1 cget -metadata] } -cleanup { catch {image delete gif1} file delete $path } -result {0} test imgPhoto-23.21 {GIF delay time metadata} -setup { set data $::gifstart # Graphic control extension: 10 1/100s delay time append data "\x21\xf9\x04\x00\x0a\x00\x00\x00" # Trailer append data $::gifdata $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{delay time} 10} test imgPhoto-23.22 {GIF disposal method "do not dispose" metadata} -setup { set data $::gifstart # Graphic control extension: disposdal method: append data "\x21\xf9\x04\x04\x00\x00\x00\x00" # Trailer append data $::gifdata $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{disposal method} {do not dispose}} test imgPhoto-33.23 {GIF disposal method "restore to background color" metadata} -setup { set data $::gifstart # Graphic control extension: disposdal method: append data "\x21\xf9\x04\x08\x00\x00\x00\x00" # Trailer append data $::gifdata $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{disposal method} {restore to background color}} test imgPhoto-43.24 {GIF disposal method "restore to previous" metadata} -setup { set data $::gifstart # Graphic control extension: disposdal method: append data "\x21\xf9\x04\x0C\x00\x00\x00\x00" # Trailer append data $::gifdata $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{disposal method} {restore to previous}} test imgPhoto-53.25 {GIF user input flag metadata} -setup { set data $::gifstart # Graphic control extension: disposdal method: append data "\x21\xf9\x04\x02\x00\x00\x00\x00" # Trailer append data $::gifdata $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{user interaction} 1} test imgPhoto-63.26 {GIF update region metadata} -setup { # size 32x32, global color table size: 8 set data "GIF89a\x20\x00\x20\x00\xc2\x07\x00" # color table append data "\x00\x00\x00\x33\x33\xff\xff\x33\x33\xff\x33\xff\x33\xff\x33\x33\xff\xff\xff\xff\x33\xff\xff\xff" # Trailer # As this is 16x16, we will get an update region setting append data $::gifdata $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{update region} {0 0 16 16}} test imgPhoto-63.27 {GIF multiple options metadata} -setup { # size 32x32, global color table size: 8 set data "GIF89a\x20\x00\x20\x00\xc2\x07\x00" # color table append data "\x00\x00\x00\x33\x33\xff\xff\x33\x33\xff\x33\xff\x33\xff\x33\x33\xff\xff\xff\xff\x33\xff\xff\xff" # Graphic control extension: do not dispose, user interaction, transparent color, delay time 10 append data "\x21\xf9\x04\x07\x0a\x00\x01\x00" # Image data and trailer # As this is 16x16, we will get an update region setting append data $::gifdata $::gifend } -body { image create photo gif1 -data $data gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{update region} {0 0 16 16} {delay time} 10 {disposal method} {do not dispose} {user interaction} 1} test imgPhoto-63.27 {GIF multiple options metadata in -index 0} -setup { # size 32x32, global color table size: 8 set data "GIF89a\x20\x00\x20\x00\xc2\x07\x00" # color table append data "\x00\x00\x00\x33\x33\xff\xff\x33\x33\xff\x33\xff\x33\xff\x33\x33\xff\xff\xff\xff\x33\xff\xff\xff" # Graphic control extension: do not dispose, user interaction, transparent color, delay time 4096 append data "\x21\xf9\x04\x07\x00\x10\x01\x00" # Image data # As this is 16x16, we will get an update region setting append data $::gifdata # Graphic control extension: restore to background, delay time 1 append data "\x21\xf9\x04\x08\x01\x00\x02\x00" # Image data and trailer # As this is 16x16, we will get an update region setting append data $::gifdata $::gifend } -body { image create photo gif1 -data $data -format "gif -index 0" gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{update region} {0 0 16 16} {delay time} 4096 {disposal method} {do not dispose} {user interaction} 1} test imgPhoto-63.28 {GIF multiple options metadata in -index 1} -setup { # size 32x32, global color table size: 8 set data "GIF89a\x20\x00\x20\x00\xc2\x07\x00" # color table append data "\x00\x00\x00\x33\x33\xff\xff\x33\x33\xff\x33\xff\x33\xff\x33\x33\xff\xff\xff\xff\x33\xff\xff\xff" # Graphic control extension: restore to background, delay time 1 append data "\x21\xf9\x04\x08\x01\x00\x02\x00" # Image data # As this is 16x16, we will get an update region setting append data $::gifdata # Graphic control extension: do not dispose, user interaction, transparent color, delay time 4096 append data "\x21\xf9\x04\x07\x00\x10\x01\x00" # Image data and trailer # As this is 16x16, we will get an update region setting append data $::gifdata $::gifend } -body { image create photo gif1 -data $data -format "gif -index 1" gif1 cget -metadata } -cleanup { catch {image delete gif1} } -result {{update region} {0 0 16 16} {delay time} 4096 {disposal method} {do not dispose} {user interaction} 1} unset -nocomplain gifstart gifdata gifend catch {rename foreachPixel {}} catch {rename checkImgTrans {}} catch {rename checkImgTransLoop {}} imageFinish # cleanup |
︙ | ︙ |
Changes to tests/imgSVGnano.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 15 | package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit namespace eval svgnano { variable data | > > > | | | | | | | | | | | < | > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit namespace eval svgnano { variable data set data(plus) {\ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> <path fill="none" stroke="#000000" d="M0 0 h16 v16 h-16 z"/> <path fill="none" stroke="#000000" d="M8 4 v 8 M4 8 h 8"/> <circle fill="yellow" stroke="red" cx="10" cy="80" r="10" /> <ellipse fill="none" stroke="blue" stroke-width="3" cx="60" cy="60" rx="10" ry="20" /> <line x1="10" y1="90" x2="50" y2="99"/> <rect fill="none" stroke="green" x="20" y="20" width="60" height="50" rx="3" ry="3"/> <polyline fill="red" stroke="purple" points="80,10 90,20 85,40"/> <polygon fill ="yellow" points="80,80 70,85 90,90"/> </svg>} set data(bad) {<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0:w"> </svg>\ } tcltest::makeFile $data(plus) plus.svg set data(plusFilePath) [file join [tcltest::configure -tmpdir] plus.svg] tcltest::makeFile $data(bad) bad.svg set data(badFilePath) [file join [tcltest::configure -tmpdir] bad.svg] test imgSVGnano-1.1 {reading simple image} -setup { catch {rename foo ""} } -body { image create photo foo -data $data(plus) list [image width foo] [image height foo] } -cleanup { |
︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | image create photo foo -data $data(plus) foo configure -format {svg -scale 2} foo configure -format {svg -dpi 600} list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {100 100} test imgSVGnano-1.5 {reading simple image from file} -setup { catch {rename foo ""} } -body { image create photo foo -file $data(plusFilePath) list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {100 100} | > < | > | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | image create photo foo -data $data(plus) foo configure -format {svg -scale 2} foo configure -format {svg -dpi 600} list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {100 100} test imgSVGnano-1.5 {reading simple image from file} -setup { catch {rename foo ""} } -body { image create photo foo -file $data(plusFilePath) list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {100 100} test imgSVGnano-1.6 {simple image from file with options} -setup { catch {rename foo ""} } -body { image create photo foo -file $data(plusFilePath) -format {svg -dpi 100 -scale 3} list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {300 300} test imgSVGnano-1.7 {very small scale gives 1x1 image} -body { image create photo foo -format "svg -scale 0.000001"\ -data $data(plus) list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {1 1} test imgSVGnano-1.8 {very small scale gives 1x1 image, from file} -body { image create photo foo -format "svg -scale 0.000001"\ -file $data(plusFilePath) list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {1 1} |
︙ | ︙ | |||
148 149 150 151 152 153 154 | } -returnCodes error -result {-scaletoheight value must be positive} test imgSVGnano-3.6 {no number parameter to -scaletoheight} -body { image create photo foo -format "svg -scaletoheight invalid"\ -data $data(plus) } -returnCodes error -result {expected integer but got "invalid"} | | | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | } -returnCodes error -result {-scaletoheight value must be positive} test imgSVGnano-3.6 {no number parameter to -scaletoheight} -body { image create photo foo -format "svg -scaletoheight invalid"\ -data $data(plus) } -returnCodes error -result {expected integer but got "invalid"} test imgSVGnano-3.7 {option -scaletowidth} -body { image create photo foo -format "svg -scaletowidth 20"\ -data $data(plus) image width foo } -cleanup { rename foo "" } -result 20 test imgSVGnano-3.8 {option -scaletoheight} -body { image create photo foo -format "svg -scaletoheight 20"\ -data $data(plus) image height foo } -cleanup { rename foo "" } -result 20 |
︙ | ︙ | |||
189 190 191 192 193 194 195 | lappend res [image width foo] [image height foo] foo configure -format "svg -scale 2" lappend res [image width foo] [image height foo] } -cleanup { rename foo "" unset res } -result {100 100 200 200} | < | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | lappend res [image width foo] [image height foo] foo configure -format "svg -scale 2" lappend res [image width foo] [image height foo] } -cleanup { rename foo "" unset res } -result {100 100 200 200} test imgSVGnano-4.2 {error on file not accessible on reread due to configure} -setup { catch {rename foo ""} tcltest::makeFile $data(plus) tmpplus.svg image create photo foo -file [file join [tcltest::configure -tmpdir] tmpplus.svg] tcltest::removeFile tmpplus.svg } -body { |
︙ | ︙ | |||
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\ <svg xmlns="http://www.w3.org/2000/svg">\ <circle cx="6.5cm" cy="2cm" r="100" transform="skewX(1 1)"/>\ </g></svg>} } -cleanup { rename foo "" } -result {foo} };# end of namespace svgnano namespace delete svgnano imageFinish cleanupTests return # Local Variables: # mode: tcl # fill-column: 78 # End: | > > > > > > > > > > | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\ <svg xmlns="http://www.w3.org/2000/svg">\ <circle cx="6.5cm" cy="2cm" r="100" transform="skewX(1 1)"/>\ </g></svg>} } -cleanup { rename foo "" } -result {foo} test imgSVGnano-5.2 {bug d6e9b4db40 - "<svg" and ">" must be present} -body { image create photo foo -format svg -data\ {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\ "-//W3C//DTD SVG 1.0//EN\" \ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\ <sERRORvBADFILEg xmlns="http://www.w3.org/2000/svg">\ <circle cx="6.5cm" cy="2cm" r="100" transform="skewX(1 1)"/>\ </g></svg>} } -returnCodes error -result {couldn't recognize image data} };# end of namespace svgnano namespace delete svgnano imageFinish cleanupTests return # Local Variables: # mode: tcl # fill-column: 78 # End: |
Changes to tests/listbox.test.
1 2 3 4 5 | # This file is a Tcl script to test out the "listbox" command # of Tk. It is organized in the standard fashion for Tcl tests. # # Copyright © 1993-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the "listbox" command # of Tk. It is organized in the standard fashion for Tcl tests. # # Copyright © 1993-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ | |||
364 365 366 367 368 369 370 | .l activate } -returnCodes error -result {wrong # args: should be ".l activate index"} test listbox-3.3 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate a b } -returnCodes error -result {wrong # args: should be ".l activate index"} test listbox-3.4 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate fooey | | | | | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | .l activate } -returnCodes error -result {wrong # args: should be ".l activate index"} test listbox-3.3 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate a b } -returnCodes error -result {wrong # args: should be ".l activate index"} test listbox-3.4 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate fooey } -returnCodes error -result {bad listbox index "fooey": must be active, anchor, end, @x,y, or an index} test listbox-3.5 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate 3 .l index active } -result 3 test listbox-3.6 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate {} .l index active } -result 0 test listbox-3.7 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate 30 .l index active } -result 17 test listbox-3.8 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate end .l index active } -result 17 test listbox-3.9 {ListboxWidgetCmd procedure, "bbox" option} -body { .l bbox } -returnCodes error -result {wrong # args: should be ".l bbox index"} test listbox-3.10 {ListboxWidgetCmd procedure, "bbox" option} -body { .l bbox a b } -returnCodes error -result {wrong # args: should be ".l bbox index"} test listbox-3.11 {ListboxWidgetCmd procedure, "bbox" option} -body { .l bbox fooey } -returnCodes error -result {bad listbox index "fooey": must be active, anchor, end, @x,y, or an index} test listbox-3.12 {ListboxWidgetCmd procedure, "bbox" option} -body { .l yview 3 update list [.l bbox 2] [.l bbox 8] } -result {{} {}} test listbox-3.13 {ListboxWidgetCmd procedure, "bbox" option} -cleanup { destroy .l2 |
︙ | ︙ | |||
422 423 424 425 426 427 428 | list [.l bbox 3] [.l bbox 4] } -result {{7 7 17 14} {7 26 17 14}} test listbox-3.15 {ListboxWidgetCmd procedure, "bbox" option} -constraints { fonts } -body { .l yview 0 update | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | list [.l bbox 3] [.l bbox 4] } -result {{7 7 17 14} {7 26 17 14}} test listbox-3.15 {ListboxWidgetCmd procedure, "bbox" option} -constraints { fonts } -body { .l yview 0 update list [.l bbox {}] [.l bbox 0] } -result {{} {7 7 17 14}} test listbox-3.16 {ListboxWidgetCmd procedure, "bbox" option} -constraints { fonts } -body { .l yview end update list [.l bbox 17] [.l bbox end] [.l bbox 18] |
︙ | ︙ | |||
554 555 556 557 558 559 560 | .l delete } -returnCodes error -result {wrong # args: should be ".l delete firstIndex ?lastIndex?"} test listbox-3.31 {ListboxWidgetCmd procedure, "delete" option} -body { .l delete a b c } -returnCodes error -result {wrong # args: should be ".l delete firstIndex ?lastIndex?"} test listbox-3.32 {ListboxWidgetCmd procedure, "delete" option} -body { .l delete badIndex | | | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | .l delete } -returnCodes error -result {wrong # args: should be ".l delete firstIndex ?lastIndex?"} test listbox-3.31 {ListboxWidgetCmd procedure, "delete" option} -body { .l delete a b c } -returnCodes error -result {wrong # args: should be ".l delete firstIndex ?lastIndex?"} test listbox-3.32 {ListboxWidgetCmd procedure, "delete" option} -body { .l delete badIndex } -returnCodes error -result {bad listbox index "badIndex": must be active, anchor, end, @x,y, or an index} test listbox-3.33 {ListboxWidgetCmd procedure, "delete" option} -body { .l delete 2 123ab } -returnCodes error -result {bad listbox index "123ab": must be active, anchor, end, @x,y, or an index} test listbox-3.34 {ListboxWidgetCmd procedure, "delete" option} -setup { destroy .l2 } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 .l2 delete 3 list [.l2 get 2] [.l2 get 3] [.l2 index end] |
︙ | ︙ | |||
583 584 585 586 587 588 589 | destroy .l2 } -result {el1 el5 5} test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup { destroy .l2 } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 | | | | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | destroy .l2 } -result {el1 el5 5} test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup { destroy .l2 } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 .l2 delete {} 2 .l2 get 0 end } -cleanup { destroy .l2 } -result {el3 el4 el5 el6 el7} test listbox-3.37 {ListboxWidgetCmd procedure, "delete" option} -setup { destroy .l2 } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 .l2 delete {} {} .l2 get 0 end } -cleanup { destroy .l2 } -result {el0 el1 el2 el3 el4 el5 el6 el7} test listbox-3.38 {ListboxWidgetCmd procedure, "delete" option} -setup { destroy .l2 } -body { |
︙ | ︙ | |||
646 647 648 649 650 651 652 | .l get } -returnCodes error -result {wrong # args: should be ".l get firstIndex ?lastIndex?"} test listbox-3.43 {ListboxWidgetCmd procedure, "get" option} -body { .l get a b c } -returnCodes error -result {wrong # args: should be ".l get firstIndex ?lastIndex?"} test listbox-3.44 {ListboxWidgetCmd procedure, "get" option} -body { .l get 2.4 | | | | 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | .l get } -returnCodes error -result {wrong # args: should be ".l get firstIndex ?lastIndex?"} test listbox-3.43 {ListboxWidgetCmd procedure, "get" option} -body { .l get a b c } -returnCodes error -result {wrong # args: should be ".l get firstIndex ?lastIndex?"} test listbox-3.44 {ListboxWidgetCmd procedure, "get" option} -body { .l get 2.4 } -returnCodes error -result {bad listbox index "2.4": must be active, anchor, end, @x,y, or an index} test listbox-3.45 {ListboxWidgetCmd procedure, "get" option} -body { .l get end bogus } -returnCodes error -result {bad listbox index "bogus": must be active, anchor, end, @x,y, or an index} test listbox-3.46 {ListboxWidgetCmd procedure, "get" option} -setup { destroy .l2 } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 list [.l2 get 0] [.l2 get 3] [.l2 get end] } -cleanup { |
︙ | ︙ | |||
677 678 679 680 681 682 683 | listbox .l2 .l2 insert 0 el0 el1 el2 "two words" el4 el5 el6 el7 .l2 get 3 end } -cleanup { destroy .l2 } -result {{two words} el4 el5 el6 el7} test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body { | | | | | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | listbox .l2 .l2 insert 0 el0 el1 el2 "two words" el4 el5 el6 el7 .l2 get 3 end } -cleanup { destroy .l2 } -result {{two words} el4 el5 el6 el7} test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body { .l get {} } -result {} test listbox-3.50 {ListboxWidgetCmd procedure, "get" option} -body { .l get {} {} } -result {} test listbox-3.51 {ListboxWidgetCmd procedure, "get" option} -body { .l get {} 3 } -result {el0 el1 el2 el3} test listbox-3.52 {ListboxWidgetCmd procedure, "get" option} -body { .l get 12 end } -result {el12 el13 el14 el15 el16 el17} test listbox-3.53 {ListboxWidgetCmd procedure, "get" option} -body { .l get 12 20 } -result {el12 el13 el14 el15 el16 el17} |
︙ | ︙ | |||
708 709 710 711 712 713 714 | .l index } -returnCodes error -result {wrong # args: should be ".l index index"} test listbox-3.58 {ListboxWidgetCmd procedure, "index" option} -body { .l index a b } -returnCodes error -result {wrong # args: should be ".l index index"} test listbox-3.59 {ListboxWidgetCmd procedure, "index" option} -body { .l index @ | | | | | | | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | .l index } -returnCodes error -result {wrong # args: should be ".l index index"} test listbox-3.58 {ListboxWidgetCmd procedure, "index" option} -body { .l index a b } -returnCodes error -result {wrong # args: should be ".l index index"} test listbox-3.59 {ListboxWidgetCmd procedure, "index" option} -body { .l index @ } -returnCodes error -result {bad listbox index "@": must be active, anchor, end, @x,y, or an index} test listbox-3.60 {ListboxWidgetCmd procedure, "index" option} -body { .l index 2 } -result 2 test listbox-3.61 {ListboxWidgetCmd procedure, "index" option} -body { expr {[.l index {}]<0} } -result 1 test listbox-3.62 {ListboxWidgetCmd procedure, "index" option} -body { .l index end } -result 18 test listbox-3.63 {ListboxWidgetCmd procedure, "index" option} -body { .l index 34 } -result 18 test listbox-3.64 {ListboxWidgetCmd procedure, "insert" option} -body { .l insert } -returnCodes error -result {wrong # args: should be ".l insert index ?element ...?"} test listbox-3.65 {ListboxWidgetCmd procedure, "insert" option} -body { .l insert badIndex } -returnCodes error -result {bad listbox index "badIndex": must be active, anchor, end, @x,y, or an index} test listbox-3.66 {ListboxWidgetCmd procedure, "insert" option} -setup { destroy .l2 } -body { listbox .l2 .l2 insert end a b c d e .l2 insert 3 x y z .l2 get 0 end } -cleanup { destroy .l2 } -result {a b c x y z d e} test listbox-3.67 {ListboxWidgetCmd procedure, "insert" option} -setup { destroy .l2 } -body { listbox .l2 .l2 insert end a b c .l2 insert 0 x .l2 get 0 end } -cleanup { destroy .l2 } -result {x a b c} test listbox-3.68 {ListboxWidgetCmd procedure, "insert" option} -setup { destroy .l2 } -body { |
︙ | ︙ | |||
812 813 814 815 816 817 818 | update list [format {%.6g %.6g} {*}[.t.l xview]] [format {%.6g %.6g} {*}[.t.l yview]] } -cleanup { destroy .t } -result {{0.249364 0.427481} {0.0714286 0.428571}} test listbox-3.79 {ListboxWidgetCmd procedure, "scan" option} -body { .l scan foo 2 4 | | | | 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | update list [format {%.6g %.6g} {*}[.t.l xview]] [format {%.6g %.6g} {*}[.t.l yview]] } -cleanup { destroy .t } -result {{0.249364 0.427481} {0.0714286 0.428571}} test listbox-3.79 {ListboxWidgetCmd procedure, "scan" option} -body { .l scan foo 2 4 } -returnCodes error -result {bad option "foo": must be dragto or mark} test listbox-3.80 {ListboxWidgetCmd procedure, "see" option} -body { .l see } -returnCodes error -result {wrong # args: should be ".l see index"} test listbox-3.81 {ListboxWidgetCmd procedure, "see" option} -body { .l see a b } -returnCodes error -result {wrong # args: should be ".l see index"} test listbox-3.82 {ListboxWidgetCmd procedure, "see" option} -body { .l see gorp } -returnCodes error -result {bad listbox index "gorp": must be active, anchor, end, @x,y, or an index} test listbox-3.83 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 7 .l index @0,0 } -result 7 test listbox-3.84 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 |
︙ | ︙ | |||
854 855 856 857 858 859 860 | test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 13 .l index @0,0 } -result 11 test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 | | | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 13 .l index @0,0 } -result 11 test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see {} .l index @0,0 } -result 0 test listbox-3.90 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see end .l index @0,0 } -result 13 |
︙ | ︙ | |||
880 881 882 883 884 885 886 | .l select a } -returnCodes error -result {wrong # args: should be ".l selection option index ?index?"} test listbox-3.94 {ListboxWidgetCmd procedure, "selection" option} -body { .l select a b c d } -returnCodes error -result {wrong # args: should be ".l selection option index ?index?"} test listbox-3.95 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection a bogus | | | | | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | .l select a } -returnCodes error -result {wrong # args: should be ".l selection option index ?index?"} test listbox-3.94 {ListboxWidgetCmd procedure, "selection" option} -body { .l select a b c d } -returnCodes error -result {wrong # args: should be ".l selection option index ?index?"} test listbox-3.95 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection a bogus } -returnCodes error -result {bad listbox index "bogus": must be active, anchor, end, @x,y, or an index} test listbox-3.96 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection a 0 lousy } -returnCodes error -result {bad listbox index "lousy": must be active, anchor, end, @x,y, or an index} test listbox-3.97 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor 0 0 } -returnCodes error -result {wrong # args: should be ".l selection anchor index"} test listbox-3.98 {ListboxWidgetCmd procedure, "selection" option} -body { list [.l selection anchor 5; .l index anchor] \ [.l selection anchor 0; .l index anchor] } -result {5 0} test listbox-3.99 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor {} .l index anchor } -result 0 test listbox-3.100 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor end .l index anchor } -result 17 test listbox-3.101 {ListboxWidgetCmd procedure, "selection" option} -body { |
︙ | ︙ | |||
921 922 923 924 925 926 927 | .l selection set 2 8 .l selection clear 4 list [.l selection includes 3] [.l selection includes 4] \ [.l selection includes 5] } -result {1 0 1} test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection set 0 end | | | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | .l selection set 2 8 .l selection clear 4 list [.l selection includes 3] [.l selection includes 4] \ [.l selection includes 5] } -result {1 0 1} test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection set 0 end .l selection includes {} } -result 0 test listbox-3.106 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end .l selection set end .l selection includes end } -result 1 test listbox-3.107 {ListboxWidgetCmd procedure, "selection" option} -body { |
︙ | ︙ | |||
1131 1132 1133 1134 1135 1136 1137 | listbox .l -width 20 -height 5 -bd 4 -highlightthickness 1 -selectborderwidth 2 pack .l .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 el12 el13 el14 \ el15 el16 el17 update test listbox-3.127 {ListboxWidgetCmd procedure, "xview" option} -body { .l yview foo | | | 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 | listbox .l -width 20 -height 5 -bd 4 -highlightthickness 1 -selectborderwidth 2 pack .l .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 el12 el13 el14 \ el15 el16 el17 update test listbox-3.127 {ListboxWidgetCmd procedure, "xview" option} -body { .l yview foo } -returnCodes error -result {bad listbox index "foo": must be active, anchor, end, @x,y, or an index} test listbox-3.128 {ListboxWidgetCmd procedure, "xview" option} -body { .l yview foo a b } -returnCodes error -result {unknown option "foo": must be moveto or scroll} test listbox-3.129 {ListboxWidgetCmd procedure, "xview" option} -setup { destroy .l2 listbox .l2 -width 10 -height 5 -font $fixed pack .l2 |
︙ | ︙ | |||
1973 1974 1975 1976 1977 1978 1979 | } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index a } -cleanup { destroy .l | | | 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 | } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index a } -cleanup { destroy .l } -returnCodes error -result {bad listbox index "a": must be active, anchor, end, @x,y, or an index} test listbox-10.5 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index end |
︙ | ︙ | |||
2014 2015 2016 2017 2018 2019 2020 | } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index @ } -cleanup { destroy .l | | | | | | | | 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 | } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index @ } -cleanup { destroy .l } -returnCodes error -result {bad listbox index "@": must be active, anchor, end, @x,y, or an index} test listbox-10.9 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index @foo } -cleanup { destroy .l } -returnCodes error -result {bad listbox index "@foo": must be active, anchor, end, @x,y, or an index} test listbox-10.10 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index @1x3 } -cleanup { destroy .l } -returnCodes error -result {bad listbox index "@1x3": must be active, anchor, end, @x,y, or an index} test listbox-10.11 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index @1, } -cleanup { destroy .l } -returnCodes error -result {bad listbox index "@1,": must be active, anchor, end, @x,y, or an index} test listbox-10.12 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index @1,foo } -cleanup { destroy .l } -returnCodes error -result {bad listbox index "@1,foo": must be active, anchor, end, @x,y, or an index} test listbox-10.13 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index @1,2x } -cleanup { destroy .l } -returnCodes error -result {bad listbox index "@1,2x": must be active, anchor, end, @x,y, or an index} test listbox-10.14 {GetListboxIndex procedure} -constraints { fonts } -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 |
︙ | ︙ | |||
2088 2089 2090 2091 2092 2093 2094 | } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index 1xy } -cleanup { destroy .l | | | 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 | } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index 1xy } -cleanup { destroy .l } -returnCodes error -result {bad listbox index "1xy": must be active, anchor, end, @x,y, or an index} test listbox-10.16 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update .l index 3 |
︙ | ︙ | |||
2125 2126 2127 2128 2129 2130 2131 | } -result {} test listbox-10.19 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update | | | | 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 | } -result {} test listbox-10.19 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update expr {[.l index {}]<0} } -cleanup { destroy .l } -result 1 test listbox-10.20 {GetListboxIndex procedure} -setup { destroy .l } -body { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 .l delete 0 end update |
︙ | ︙ | |||
2151 2152 2153 2154 2155 2156 2157 | } -body { listbox .l -height 5 pack .l .l insert 0 a b c d e f g h i j .l yview 3 update set x [.l index @0,0] | | | 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | } -body { listbox .l -height 5 pack .l .l insert 0 a b c d e f g h i j .l yview 3 update set x [.l index @0,0] .l yview {} update lappend x [.l index @0,0] } -cleanup { destroy .l } -result {3 0} test listbox-11.2 {ChangeListboxView procedure, boundary conditions for index} -setup { destroy .l |
︙ | ︙ | |||
2374 2375 2376 2377 2378 2379 2380 | .l select set 0 end .l curselection } -result {} test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -body { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end | | | | 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 | .l select set 0 end .l curselection } -result {} test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -body { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set {} {} .l curselection } -result {} test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} -body { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set {} 3 .l curselection } -result {0 1 2 3} test listbox-15.6 {ListboxSelect procedure, boundary conditions for indices} -body { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set 2 4 |
︙ | ︙ |
Changes to tests/main.test.
1 2 3 4 5 6 | # This file contains tests for the tkMain.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # This file contains tests for the tkMain.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
41 42 43 44 45 46 47 | set script [makeFile {} script] file delete $script set f [open $script w] fconfigure $f -encoding utf-8 puts $f {puts [list $argv0 $argv $tcl_interactive]} puts $f {puts [string equal \u20AC €]; exit} close $f | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | set script [makeFile {} script] file delete $script set f [open $script w] fconfigure $f -encoding utf-8 puts $f {puts [list $argv0 $argv $tcl_interactive]} puts $f {puts [string equal \u20AC €]; exit} close $f catch {set f [open "|[list [interpreter] -encoding iso8859-1 script]" r]} } -body { read $f } -cleanup { close $f removeFile script } -result "script {} 0\n0\n" |
︙ | ︙ | |||
87 88 89 90 91 92 93 | close $f removeFile script } -returnCodes ok -result {-enc utf-8 script} test main-3.1 {Tk_ParseArgv: -help option} -constraints unix -body { # Run only on unix as Win32 pops up native dialog exec [interpreter] -help | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | close $f removeFile script } -returnCodes ok -result {-enc utf-8 script} test main-3.1 {Tk_ParseArgv: -help option} -constraints unix -body { # Run only on unix as Win32 pops up native dialog exec [interpreter] -help } -returnCodes error -match glob -result {*application-specific initialization failed: Command-specific options:*} test main-3.2 {Tk_ParseArgv: -help option} -setup { set maininterp [interp create] } -body { $maininterp eval { set argc 1 ; set argv -help } load {} Tk $maininterp } -cleanup { |
︙ | ︙ |
Changes to tests/menu.test.
1 2 3 4 | # This file is a Tcl script to test menus in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1995-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test menus in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1995-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit |
︙ | ︙ | |||
1195 1196 1197 1198 1199 1200 1201 | test menu-2.223 {entry configuration options 0 -underline 3p tearoff} -body { .m1 entryconfigure 0 -underline 3p } -returnCodes error -result {unknown option "-underline"} test menu-2.224 {entry configuration options 1 -underline 3p command} -body { .m1 entryconfigure 1 -underline 3p | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 | test menu-2.223 {entry configuration options 0 -underline 3p tearoff} -body { .m1 entryconfigure 0 -underline 3p } -returnCodes error -result {unknown option "-underline"} test menu-2.224 {entry configuration options 1 -underline 3p command} -body { .m1 entryconfigure 1 -underline 3p } -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} test menu-2.225 {entry configuration options 2 -underline 3p cascade} -body { .m1 entryconfigure 2 -underline 3p } -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} test menu-2.226 {entry configuration options 3 -underline 3p separator} -body { .m1 entryconfigure 3 -underline 3p } -returnCodes error -result {unknown option "-underline"} test menu-2.227 {entry configuration options 4 -underline 3p checkbutton} -body { .m1 entryconfigure 4 -underline 3p } -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} test menu-2.228 {entry configuration options 5 -underline 3p radiobutton} -body { .m1 entryconfigure 5 -underline 3p } -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} deleteWindows if {[testConstraint hasEarthPhoto]} { image delete image1 } test menu-3.1 {MenuWidgetCmd procedure} -setup { destroy .m1 } -body { menu .m1 .m1 } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 option ?arg ...?"} test menu-3.2 {MenuWidgetCmd, Tcl_Preserve and Tcl_Release} -constraints { nonUnixUserInteraction } -setup { destroy .m1 } -body { menu .m1 -postcommand "destroy .m1" .m1 add command -label "menu-3.2: Hit Escape" .m1 post 40 40 } -cleanup { destroy .m1 } -returnCodes ok -result {} test menu-3.3 {MenuWidgetCmd procedure, "activate" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 activate } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 activate index"} test menu-3.4 {MenuWidgetCmd procedure, "activate" option} -setup { destroy .m1 } -body { menu .m1 .m1 activate "foo" } -returnCodes error -result {bad menu entry index "foo"} test menu-3.5 {MenuWidgetCmd procedure, "activate" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 add separator .m1 activate 2 } -cleanup { destroy .m1 } -result {} test menu-3.6 {MenuWidgetCmd procedure, "activate" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 entryconfigure 1 -state disabled .m1 activate 1 } -cleanup { destroy .m1 } -result {} test menu-3.7 {MenuWidgetCmd procedure, "activate" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 activate 1 } -cleanup { destroy .m1 } -result {} test menu-3.8 {MenuWidgetCmd procedure, "add" option} -setup { destroy .m1 } -body { menu .m1 .m1 add } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 add type ?-option value ...?"} test menu-3.9 {MenuWidgetCmd procedure, "add" option} -setup { destroy .m1 } -body { menu .m1 .m1 add foo } -cleanup { destroy .m1 } -returnCodes error -result {bad menu entry type "foo": must be cascade, checkbutton, command, radiobutton, or separator} test menu-3.10 {MenuWidgetCmd procedure, "add" option} -setup { destroy .m1 } -body { menu .m1 .m1 add separator } -cleanup { destroy .m1 } -result {} test menu-3.11 {MenuWidgetCmd procedure, "cget" option} -setup { destroy .m1 } -body { menu .m1 .m1 cget } -returnCodes error -result {wrong # args: should be ".m1 cget option"} test menu-3.12 {MenuWidgetCmd procedure, "cget" option} -setup { destroy .m1 } -body { menu .m1 .m1 cget -gorp } -returnCodes error -result {unknown option "-gorp"} test menu-3.13 {MenuWidgetCmd procedure, "cget" option} -setup { destroy .m1 } -body { menu .m1 .m1 configure -postcommand "Some string" .m1 cget -postcommand } -cleanup { destroy .m1 } -result {Some string} test menu-3.14 {MenuWidgetCmd procedure, "clone" option} -setup { destroy .m1 } -body { menu .m1 .m1 clone } -returnCodes error -result {wrong # args: should be ".m1 clone newMenuName ?menuType?"} test menu-3.15 {MenuWidgetCmd procedure, "clone" option} -setup { destroy .m1 } -body { menu .m1 .m1 clone a b c d } -returnCodes error -result {wrong # args: should be ".m1 clone newMenuName ?menuType?"} test menu-3.16 {MenuWidgetCmd procedure, "clone" option} -setup { destroy .m1 } -body { menu .m1 .m1 clone .m1.clone1 } -cleanup { destroy .m1 } -result {} test menu-3.17 {MenuWidgetCmd procedure, "clone" option} -setup { destroy .m1 } -body { menu .m1 .m1 clone .m1.clone1 tearoff } -cleanup { destroy .m1 } -result {} test menu-3.18 {MenuWidgetCmd procedure, "configure" option} -setup { destroy .m1 } -body { menu .m1 llength [.m1 configure] } -cleanup { destroy .m1 } -result 21 test menu-3.19 {MenuWidgetCmd procedure, "configure" option} -setup { destroy .m1 } -body { menu .m1 .m1 configure -gorp } -returnCodes error -result {unknown option "-gorp"} test menu-3.20 {MenuWidgetCmd procedure, "configure" option} -setup { destroy .m1 } -body { menu .m1 .m1 configure -postcommand "A random String" } -cleanup { destroy .m1 } -result {} test menu-3.21 {MenuWidgetCmd procedure, "configure" option} -setup { destroy .m1 } -body { menu .m1 .m1 configure -postcommand "Another string" lindex [.m1 configure -postcommand] 4 } -cleanup { destroy .m1 } -result {Another string} test menu-3.22 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 delete } -returnCodes error -result {wrong # args: should be ".m1 delete first ?last?"} test menu-3.23 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 delete foo } -returnCodes error -result {bad menu entry index "foo"} test menu-3.24 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 delete 0 "foo" } -returnCodes error -result {bad menu entry index "foo"} test menu-3.25 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 delete 0 } -cleanup { destroy .m1 } -result {} test menu-3.26 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "foo" .m1 delete 1 0 } -cleanup { destroy .m1 } -result {} test menu-3.27 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "1" .m1 add command -label "2" .m1 add command -label "3" .m1 delete 1 3 } -cleanup { destroy .m1 } -result {} test menu-3.28 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "1" .m1 add command -label "2" .m1 add command -label "3" .m1 activate 2 .m1 delete 1 3 } -cleanup { destroy .m1 } -result {} test menu-3.29 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "1" .m1 add command -label "2" .m1 add command -label "3" .m1 activate 3 .m1 delete 1 } -cleanup { destroy .m1 } -result {} test menu-3.29+1 {MenuWidgetCmd, "delete", Bug 220950} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "bogus" .m1 add command -label "ok" .m1 delete 10 20 .m1 entrycget last -label } -cleanup { destroy .m1 } -result ok test menu-3.30 {MenuWidgetCmd procedure, "entrycget" option} -setup { destroy .m1 } -body { menu .m1 .m1 entrycget } -returnCodes error -result {wrong # args: should be ".m1 entrycget index option"} test menu-3.31 {MenuWidgetCmd procedure, "entrycget" option} -setup { destroy .m1 } -body { menu .m1 .m1 entrycget index option foo } -returnCodes error -result {wrong # args: should be ".m1 entrycget index option"} test menu-3.32 {MenuWidgetCmd procedure, "entrycget" option} -setup { destroy .m1 } -body { menu .m1 .m1 entrycget foo -label } -returnCodes error -result {bad menu entry index "foo"} test menu-3.33 {MenuWidgetCmd procedure, "entrycget" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 entrycget 1 -label } -cleanup { destroy .m1 } -result {test} test menu-3.34 {MenuWidgetCmd procedure, "entryconfigure" option} -setup { destroy .m1 } -body { menu .m1 .m1 entryconfigure } -returnCodes error -result {wrong # args: should be ".m1 entryconfigure index ?-option value ...?"} test menu-3.35 {MenuWidgetCmd procedure, "entryconfigure" option} -setup { destroy .m1 } -body { menu .m1 .m1 entryconfigure foo } -returnCodes error -result {bad menu entry index "foo"} test menu-3.36 {MenuWidgetCmd procedure, "entryconfigure" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" llength [.m1 entryconfigure 1] } -cleanup { destroy .m1 } -result 15 test menu-3.37 {MenuWidgetCmd procedure, "entryconfigure" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" lindex [.m1 entryconfigure 1 -label] 4 } -cleanup { destroy .m1 } -result {test} test menu-3.38 {MenuWidgetCmd procedure, "entryconfigure" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 entryconfigure 1 -label "changed" lindex [.m1 entryconfigure 1 -label] 4 } -cleanup { destroy .m1 } -result {changed} test menu-3.39 {MenuWidgetCmd procedure, "index" option} -setup { destroy .m1 } -body { menu .m1 .m1 index } -returnCodes error -result {wrong # args: should be ".m1 index string"} test menu-3.40 {MenuWidgetCmd procedure, "index" option} -setup { destroy .m1 } -body { menu .m1 .m1 index foo } -returnCodes error -result {bad menu entry index "foo"} test menu-3.41 {MenuWidgetCmd procedure, "index" option} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 add command -label "test" .m1 add command -label "3" .m1 add command -label "another label" .m1 add command -label "end" .m1 add command -label "3a" .m1 add command -label "final entry" list [.m1 index "test"] [.m1 index "3"] [.m1 index "3a"] [.m1 index "end"] } -cleanup { destroy .m1 } -result {1 3 5 6} test menu-3.42 {MenuWidgetCmd procedure, "insert" option} -setup { destroy .m1 } -body { menu .m1 .m1 insert } -returnCodes error -result {wrong # args: should be ".m1 insert index type ?-option value ...?"} test menu-3.43 {MenuWidgetCmd procedure, "insert" option} -setup { destroy .m1 } -body { menu .m1 .m1 insert 1 command -label "test" .m1 entrycget 1 -label } -cleanup { destroy .m1 } -result {test} test menu-3.44 {MenuWidgetCmd procedure, "invoke" option} -setup { destroy .m1 } -body { menu .m1 .m1 invoke } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 invoke index"} test menu-3.45 {MenuWidgetCmd procedure, "invoke" option} -setup { destroy .m1 } -body { menu .m1 .m1 invoke foo } -cleanup { destroy .m1 } -returnCodes error -result {bad menu entry index "foo"} test menu-3.46 {MenuWidgetCmd procedure, "invoke" option} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add command -label "set foo" -command "set foo hello" list [.m1 invoke 1] [set foo] [unset foo] } -cleanup { destroy .m1 } -returnCodes ok -result {hello hello {}} test menu-3.47 {MenuWidgetCmd procedure, "post" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "On Windows, hit Escape to get this menu to go away" .m1 post } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 post x y ?index?"} test menu-3.48 {MenuWidgetCmd procedure, "post" option} -setup { destroy .m1 } -body { menu .m1 .m1 post foo 40 } -cleanup { destroy .m1 } -returnCodes error -result {expected integer but got "foo"} test menu-3.49 {MenuWidgetCmd procedure, "post" option} -setup { destroy .m1 } -body { menu .m1 .m1 post 40 bar } -cleanup { destroy .m1 } -returnCodes error -result {expected integer but got "bar"} test menu-3.50 {MenuWidgetCmd procedure, "post" option} -constraints { nonUnixUserInteraction } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "menu-3.50: hit Escape" -command "puts hello" .m1 post 40 40 } -cleanup { destroy .m1 } -result {} test menu-3.51 {MenuWidgetCmd procedure, "postcascade" option} -setup { destroy .m1 } -body { menu .m1 .m1 postcascade } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 postcascade index"} test menu-3.52 {MenuWidgetCmd procedure, "postcascade" option} -setup { destroy .m1 } -body { menu .m1 .m1 postcascade foo } -cleanup { destroy .m1 } -returnCodes error -result {bad menu entry index "foo"} test menu-3.53 {MenuWidgetCmd procedure, "postcascade" option} -constraints { nonUnixUserInteraction } -setup { destroy .m1 .m2 } -body { menu .m1 .m1 add command -label "menu-3.53 - hit Escape" menu .m2 .m1 post 40 40 .m1 add cascade -menu .m2 .m1 postcascade 1 } -cleanup { destroy .m1 .m2 } -result {} test menu-3.54 {MenuWidgetCmd procedure, "postcascade" option} -setup { destroy .m1 .m2 } -body { menu .m1 menu .m2 .m1 add cascade -menu .m2 -label "menu-3.57 - hit Escape" .m1 postcascade 1 .m1 postcascade {} } -cleanup { destroy .m1 .m2 } -result {} test menu-3.55 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 .m1 type } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 type index"} test menu-3.56 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 .m1 type foo } -cleanup { destroy .m1 } -returnCodes error -result {bad menu entry index "foo"} test menu-3.57 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 type 1 } -cleanup { destroy .m1 } -result {command} test menu-3.58 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 .m1 add separator .m1 type 1 } -cleanup { destroy .m1 } -result {separator} test menu-3.59 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label "test" .m1 type 1 } -cleanup { destroy .m1 } -result {checkbutton} test menu-3.60 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 .m1 add radiobutton -label "test" .m1 type 1 } -cleanup { destroy .m1 } -result {radiobutton} test menu-3.61 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label "test" .m1 type 1 } -cleanup { destroy .m1 } -result {cascade} test menu-3.62 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 type 0 } -cleanup { destroy .m1 } -result {tearoff} test menu-3.63 {MenuWidgetCmd procedure, "unpost" option} -setup { destroy .m1 } -body { menu .m1 .m1 unpost foo } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 unpost"} test menu-3.64 {MenuWidgetCmd procedure, "unpost" option} -constraints { nonUnixUserInteraction } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "menu-3.64 - hit Escape" .m1 post 40 40 .m1 unpost } -cleanup { destroy .m1 } -result {} test menu-3.65 {MenuWidgetCmd procedure, "yposition" option} -setup { destroy .m1 } -body { menu .m1 .m1 yposition } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 yposition index"} test menu-3.66a {MenuWidgetCmd procedure, "yposition" option, no tearoff} -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 yposition 1 } -cleanup { destroy .m1 } -result 0 test menu-3.66b {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints { notAqua } -setup { destroy .m1 } -body { # on Win or Linux, tearoff menus are supported # see menu-3.66c for aqua menu .m1 -tearoff 1 .m1 yposition 1 } -cleanup { destroy .m1 } -result 1 test menu-3.66c {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints { aqua } -setup { destroy .m1 } -body { # on OS X, tearoff menus are not supported # see menu-3.66b for win or linux menu .m1 -tearoff 1 .m1 yposition 1 } -cleanup { destroy .m1 } -result 0 test menu-3.67 {MenuWidgetCmd procedure, bad option} -setup { destroy .m1 } -body { menu .m1 .m1 foo } -cleanup { destroy .m1 } -returnCodes error -result {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, xposition, or yposition} test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} -setup { deleteWindows } -body { set t .t set m1 .t.m1 set c1 .t.c1 |
︙ | ︙ | |||
1858 1859 1860 1861 1862 1863 1864 | } -cleanup { destroy .m1 } -result {} test menu-3.71 {MenuWidgetCmd procedure, "index end" option, bug [f3cd942e9e]} -setup { destroy .m1 } -body { menu .m1 | | | | | | | 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 | } -cleanup { destroy .m1 } -result {} test menu-3.71 {MenuWidgetCmd procedure, "index end" option, bug [f3cd942e9e]} -setup { destroy .m1 } -body { menu .m1 .m1 index "end" } -cleanup { destroy .m1 } -result {} test menu-4.1 {TkInvokeMenu: disabled} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off \ -state disabled list [catch {.m1 invoke 1} msg] $foo } -cleanup { destroy .m1 } -result {0 off} test menu-4.2 {TkInvokeMenu: tearoff} -setup { destroy .m1 } -body { menu .m1 catch {.m1 invoke 0} } -cleanup { deleteWindows } -result 0 test menu-4.3 {TkInvokeMenu: checkbutton -on} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 \ [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 on 0 {}} test menu-4.4 {TkInvokeMenu: checkbutton -off} -setup { destroy .m1 } -body { catch {unset foo} |
︙ | ︙ | |||
1913 1914 1915 1916 1917 1918 1919 | destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add checkbutton -label "test" -variable foo(1) -onvalue on list [catch {.m1 invoke 1} msg] $msg [catch {set foo(1)} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { | | | | | | | | | | 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 | destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add checkbutton -label "test" -variable foo(1) -onvalue on list [catch {.m1 invoke 1} msg] $msg [catch {set foo(1)} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 on 0 {}} test menu-4.6 {TkInvokeMenu: radiobutton} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 -tearoff 1 .m1 add radiobutton -label "1" -variable foo -value one .m1 add radiobutton -label "2" -variable foo -value two .m1 add radiobutton -label "3" -variable foo -value three list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 one 0 {}} test menu-4.7 {TkInvokeMenu: radiobutton} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 -tearoff 1 .m1 add radiobutton -label "1" -variable foo -value one .m1 add radiobutton -label "2" -variable foo -value two .m1 add radiobutton -label "3" -variable foo -value three list [catch {.m1 invoke 2} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 two 0 {}} test menu-4.8 {TkInvokeMenu: radiobutton} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add radiobutton -label "1" -variable foo -value one .m1 add radiobutton -label "2" -variable foo -value two .m1 add radiobutton -label "3" -variable foo -value three list [catch {.m1 invoke 3} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 three 0 {}} test menu-4.9 {TkInvokeMenu: radiobutton array element} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add radiobutton -label "1" -variable foo(2) -value one .m1 add radiobutton -label "2" -variable foo(2) -value two .m1 add radiobutton -label "3" -variable foo(2) -value three list [catch {.m1 invoke 3} msg] $msg [catch {set foo(2)} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 three 0 {}} test menu-4.10 {TkInvokeMenu} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add command -label "test" -command "set menu_test menu-4.8" list [catch {.m1 invoke 1} msg] $msg [catch {set menu_test} msg2] $msg2 [catch {unset menu_test} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 menu-4.8 0 menu-4.8 0 {}} test menu-4.11 {TkInvokeMenu} -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label "test" -menu .m1.m2 list [catch {.m1 invoke 1} msg] $msg } -cleanup { destroy .m1 } -result {0 {}} test menu-4.12 {TkInvokeMenu} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 add command -label "test" -command ".m1 delete 1" list [catch {.m1 invoke 1} msg] $msg [catch {.m1 type "test"} msg2] $msg2 } -cleanup { destroy .m1 } -result {0 {} 1 {bad menu entry index "test"}} test menu-5.1 {DestroyMenuInstance} -setup { destroy .m1 } -body { menu .m1 destroy .m1 |
︙ | ︙ | |||
2174 2175 2176 2177 2178 2179 2180 | } -result {0 0} test menu-6.9 {TkDestroyMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m1 clone .m3 | | | | | | | | 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 | } -result {0 0} test menu-6.9 {TkDestroyMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m1 clone .m3 list [destroy .m2] [destroy .m3] [destroy .m1] } -returnCodes ok -result {{} {} {}} test menu-6.10 {TkDestroyMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m1 clone .m3 list [destroy .m3] [destroy .m1] } -returnCodes ok -result {{} {}} test menu-6.11 {TkDestroyMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m1 clone .m3 .m1 clone .m4 list [destroy .m2] [destroy .m1] } -returnCodes ok -result {{} {}} test menu-6.12 {TkDestroyMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m1 clone .m3 .m1 clone .m4 list [destroy .m3] [destroy .m1] } -returnCodes ok -result {{} {}} test menu-6.13 {TkDestroyMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m1 clone .m3 .m1 clone .m4 list [destroy .m4] [destroy .m1] } -returnCodes ok -result {{} {}} test menu-6.14 {TkDestroyMenu} -setup { destroy .m1 } -body { menu .m1 . configure -menu .m1 list [destroy .m1] [. configure -menu ""] } -returnCodes ok -result {{} {}} test menu-6.15 {TkDestroyMenu} -setup { deleteWindows |
︙ | ︙ | |||
2832 2833 2834 2835 2836 2837 2838 | deleteWindows } -body { menu .m1 .m1 add command -label "active" .m1 add command -label "test2" .m1 add command -label "test3" .m1 activate 2 | | | 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 | deleteWindows } -body { menu .m1 .m1 add command -label "active" .m1 add command -label "test2" .m1 add command -label "test3" .m1 activate 2 .m1 entrycget {} -label } -cleanup { deleteWindows } -result {} #test menu-13.7 - Need to add @test here. test menu-13.7 {TkGetMenuIndex} -setup { deleteWindows } -body { |
︙ | ︙ | |||
3113 3114 3115 3116 3117 3118 3119 | menu .menubar menu .menubar.test -tearoff 0 .menubar add cascade -label Test -underline 0 -menu .menubar.test menu .menubar.test.cascade -tearoff 0 .menubar.test.cascade add command -label SubItem -command "puts SubItemSelected" . configure -menu .menubar list [catch {.menubar.test add cascade -label SubMenu \ | | | | | | | | | | 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 | menu .menubar menu .menubar.test -tearoff 0 .menubar add cascade -label Test -underline 0 -menu .menubar.test menu .menubar.test.cascade -tearoff 0 .menubar.test.cascade add command -label SubItem -command "puts SubItemSelected" . configure -menu .menubar list [catch {.menubar.test add cascade -label SubMenu \ -menu .menubar.test.cascade}] \ [info commands .\#menubar.\#menubar\#test.\#menubar\#test\#cascade] \ [. configure -menu ""] } -cleanup { deleteWindows } -result {0 .#menubar.#menubar#test.#menubar#test#cascade {}} test menu-17.1 {MenuVarProc} -setup { deleteWindows } -body { catch {unset foo} menu .m1 set foo "hello" list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [unset foo] } -cleanup { deleteWindows } -result {{} {}} # menu-17.2 - Don't know how to generate the flags in the if test menu-17.2 {MenuVarProc} -setup { deleteWindows } -body { catch {unset foo} menu .m1 list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [set foo ""] } -cleanup { deleteWindows } -result {{} {}} test menu-17.3 {MenuVarProc} -setup { deleteWindows } -body { catch {unset foo} menu .m1 set foo "hello" list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [set foo "hello"] [unset foo] } -cleanup { deleteWindows } -result {{} hello {}} test menu-17.4 {MenuVarProc} -setup { deleteWindows } -body { menu .m1 set foo "goodbye" list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [set foo "hello"] [unset foo] } -cleanup { deleteWindows } -result {{} hello {}} test menu-17.5 {MenuVarProc} -setup { deleteWindows } -body { menu .m1 set foo "hello" list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [set foo "goodbye"] [unset foo] } -cleanup { deleteWindows } -result {{} goodbye {}} test menu-17.6 {MenuVarProc [5d991b822e]} -setup { deleteWindows } -body { # Want this not to crash |
︙ | ︙ | |||
3301 3302 3303 3304 3305 3306 3307 | deleteWindows } -result {} test menu-20.5 {CloneMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 foo | | | 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 | deleteWindows } -result {} test menu-20.5 {CloneMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 foo } -returnCodes error -result {bad menu type "foo": must be menubar, normal, or tearoff} test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 } -cleanup { deleteWindows |
︙ | ︙ | |||
3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 | wm geometry .m1 200x100 update set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}] .m1 index @$x,5 } -cleanup { deleteWindows } -result 0 test menu-23.1 {RecursivelyDeleteMenu} -setup { deleteWindows } -body { menu .m1 . configure -menu .m1 . configure -menu "" | > > > > > > > > > > > > > > > > > > > > > > | 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 | wm geometry .m1 200x100 update set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}] .m1 index @$x,5 } -cleanup { deleteWindows } -result 0 test menu-22.6 {tk_popup on separator entry} -setup { deleteWindows } -constraints {x11} -body { menu .m1 label .l -text ClickMe! .m1 add command -label "Example 1" -command bell .m1 add command -label "Example 2" -command bell .m1 add separator .m1 add command -label "Example Other" -command "bell;bell" tk_popup .m1 100 100 2 set waiting 0 tkwait visibility .m1 after 333 incr waiting vwait waiting .m1 invoke 4 after 333 incr waiting vwait waiting destroy .m1 } -cleanup { deleteWindows } -result {} test menu-23.1 {RecursivelyDeleteMenu} -setup { deleteWindows } -body { menu .m1 . configure -menu .m1 . configure -menu "" |
︙ | ︙ | |||
3477 3478 3479 3480 3481 3482 3483 | } -result {{} {}} test menu-24.3 {TkNewMenuName} -setup { deleteWindows } -body { menu .#m rename .#m hideme list [catch {. configure -menu [menu .m]}] [. configure -menu ""] [destroy .#m] \ | | | 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 | } -result {{} {}} test menu-24.3 {TkNewMenuName} -setup { deleteWindows } -body { menu .#m rename .#m hideme list [catch {. configure -menu [menu .m]}] [. configure -menu ""] [destroy .#m] \ [destroy .m] [destroy hideme] } -result {0 {} {} {} {}} test menu-25.1 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" |
︙ | ︙ | |||
3834 3835 3836 3837 3838 3839 3840 | deleteWindows } -result {} test menu-32.6 {DeleteMenuCloneEntries - reentrancy - crashes tk8.0} -setup { deleteWindows } -body { menu .m1 .m1 add command -label test \ | | | 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 | deleteWindows } -result {} test menu-32.6 {DeleteMenuCloneEntries - reentrancy - crashes tk8.0} -setup { deleteWindows } -body { menu .m1 .m1 add command -label test \ -command ".m1 delete test ; .m1 add command -label test -command \".m1 delete test\"; .m1 delete test" .m1 invoke test } -cleanup { deleteWindows } -result {} test menu-32.7 {DeleteMenuCloneEntries - one entry} -setup { deleteWindows } -body { |
︙ | ︙ | |||
3857 3858 3859 3860 3861 3862 3863 | } -body { # SF bug #465324 menu .menubar . configure -menu .menubar menu .menubar.test .menubar.test add command -label "hi" for {set i 0} {$i < 10} {incr i} { | | | | 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 | } -body { # SF bug #465324 menu .menubar . configure -menu .menubar menu .menubar.test .menubar.test add command -label "hi" for {set i 0} {$i < 10} {incr i} { .menubar add cascade -menu .menubar.test -label "Test" .menubar delete Test } info commands .#menubar*test* } -cleanup { deleteWindows } -result {} test menu-32.9 {Ensure deleting of clones doesn't corrupt menu refs} -setup { |
︙ | ︙ | |||
3892 3893 3894 3895 3896 3897 3898 | deleteWindows } -result {.menubar.cascade .#menubar.#menubar#test.#menubar#cascade .menubar.cascade .#menubar.#menubar#test.#menubar#cascade} test menu-33.1 {menu vs command hiding} -setup { deleteWindows } -body { | | | | | 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 | deleteWindows } -result {.menubar.cascade .#menubar.#menubar#test.#menubar#cascade .menubar.cascade .#menubar.#menubar#test.#menubar#cascade} test menu-33.1 {menu vs command hiding} -setup { deleteWindows } -body { set l [interp hidden] menu .m interp hide {} .m destroy .m set result [list [winfo children .] [interp hidden]] expr {$result eq [list {} $l]} } -result 1 # menu-34 MenuInit only called at boot time # creating menus on two different screens then deleting the # menu from the first screen crashes Tk8.3.1 # test menu-34.1 {menus on multiple screens - crashes tk8.3.1, Bug 5454} -constraints { altDisplay } -setup { deleteWindows } -body { toplevel .one menu .one.m toplevel .two -screen $::env(TK_ALT_DISPLAY) menu .two.m |
︙ | ︙ | |||
3943 3944 3945 3946 3947 3948 3949 | menu .m -type menubar list [catch ".m post 1 1" msg] $msg } -cleanup { destroy .m } -result {1 {a menubar menu cannot be posted}} test menu-38.1 {Can't dismiss ttk::menubutton menu until mouse has hovered over it - bug fa32290898} -setup { | | < | > > > > > > > > | 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 | menu .m -type menubar list [catch ".m post 1 1" msg] $msg } -cleanup { destroy .m } -result {1 {a menubar menu cannot be posted}} test menu-38.1 {Can't dismiss ttk::menubutton menu until mouse has hovered over it - bug fa32290898} -setup { } -constraints {x11} -body { toplevel .top ttk::menubutton .top.mb -text "Some menu"; menu .top.mb.m; .top.mb.m add command -label "Item 1"; .top.mb.m add command -label "Item 2"; .top.mb configure -menu .top.mb.m; pack .top.mb update # simulate mouse click on the menubutton, which posts its menu event generate .top.mb <Button-1> -warp 1 controlPointerWarpTiming event generate .top.mb <ButtonRelease-1> update # simulate mouse click on the menu again, i.e. without # entering/leaving the posted menu event generate .top.mb <Button-1> update after 50 event generate .top.mb <ButtonRelease-1> update # the menu shall have been unposted by the second click winfo ismapped .top.mb.m } -cleanup { destroy .top.mb.m .top.m .top } -result 0 test menu-39.1 {empty -type - bug be8f5b9fc2} -setup { catch {destroy .m} } -body { menu .m -type {} } -cleanup { destroy .m } -returnCodes error -result {ambiguous type "": must be menubar, normal, or tearoff} # cleanup imageFinish deleteWindows cleanupTests return # Local variables: # mode: tcl # End: |
Changes to tests/menuDraw.test.
1 2 3 4 | # This file is a Tcl script to test drawing of menus in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1996-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test drawing of menus in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1996-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test imageInit |
︙ | ︙ | |||
128 129 130 131 132 133 134 | deleteWindows } -body { menu .m1 .m1 add command -label "foo" .m1 entryconfigure 1 -state foo } -cleanup { deleteWindows | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | deleteWindows } -body { menu .m1 .m1 add command -label "foo" .m1 entryconfigure 1 -state foo } -cleanup { deleteWindows } -returnCodes error -result {bad state "foo": must be active, disabled, or normal} test menuDraw-6.7 {TkMenuConfigureEntryDrawOptions - tkfont specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -font "Courier 12" } -cleanup { deleteWindows |
︙ | ︙ | |||
554 555 556 557 558 559 560 | } -returnCodes ok -match glob -result * test menuDraw-15.2 {TkPostTearoffMenu - Deactivation} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -state active set tearoff [tk::TearOffMenu .m1 40 40] | | | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | } -returnCodes ok -match glob -result * test menuDraw-15.2 {TkPostTearoffMenu - Deactivation} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -state active set tearoff [tk::TearOffMenu .m1 40 40] expr {[$tearoff index active]<0} } -cleanup { deleteWindows } -result 1 test menuDraw-15.3 {TkPostTearoffMenu - post command} -setup { deleteWindows } -body { catch {unset foo} menu .m1 -postcommand "set foo .m1" .m1 add command -label "foo" list [catch {tk::TearOffMenu .m1 40 40}] [set foo] [unset foo] [destroy .m1] |
︙ | ︙ |
Changes to tests/menubut.test.
1 2 3 4 5 | # This file is a Tcl script to test menubuttons in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test menubuttons in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. # XXX This test file is woefully incomplete right now. If any part # XXX of a procedure has tests then the whole procedure has tests, # XXX but many procedures have no tests. package require tcltest 2.2 |
︙ | ︙ | |||
290 291 292 293 294 295 296 | .mb configure -underline 5 .mb cget -underline } -cleanup { .mb configure -underline [lindex [.mb configure -underline] 3] } -result 5 test menubutton-1.55 {configuration options} -body { .mb configure -underline 3p | | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | .mb configure -underline 5 .mb cget -underline } -cleanup { .mb configure -underline [lindex [.mb configure -underline] 3] } -result 5 test menubutton-1.55 {configuration options} -body { .mb configure -underline 3p } -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""} test menubutton-1.56 {configuration options} -body { .mb configure -width 402 .mb cget -width } -cleanup { .mb configure -width [lindex [.mb configure -width] 3] } -result 402 test menubutton-1.57 {configuration options} -body { |
︙ | ︙ |
Changes to tests/message.test.
1 2 3 4 5 | # This file is a Tcl script to test out the "message" command # of Tk. It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the "message" command # of Tk. It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-2000 Ajuba Solutions. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::loadTestedCommands eval tcltest::configure $argv |
︙ | ︙ |
Changes to tests/msgbox.test.
1 2 3 4 | # This file is a Tcl script to test out Tk's "tk_messageBox" command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test out Tk's "tk_messageBox" command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/obj.test.
1 2 3 4 | # This file is a Tcl script to test new object types in Tk. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test new object types in Tk. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/oldpack.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the old syntax of Tk's # "pack" command (before release 3.3). It is organized in the # standard fashion for Tcl tests. # # Copyright © 1991-1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out the old syntax of Tk's # "pack" command (before release 3.3). It is organized in the # standard fashion for Tcl tests. # # Copyright © 1991-1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ | |||
28 29 30 31 32 33 34 | place .pack.blue.l -relwidth 1.0 -relheight 1.0 frame .pack.violet -width 80 -height 20 label .pack.violet.l -text P -bd 2 -relief raised place .pack.violet.l -relwidth 1.0 -relheight 1.0 if {![catch {pack ap .pack .pack.red top}]} { | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | place .pack.blue.l -relwidth 1.0 -relheight 1.0 frame .pack.violet -width 80 -height 20 label .pack.violet.l -text P -bd 2 -relief raised place .pack.violet.l -relwidth 1.0 -relheight 1.0 if {![catch {pack ap .pack .pack.red top}]} { # Don't execute any of this file if Tk is compiled with -DTK_NO_DEPRECATED test oldpack-1.1 {basic positioning} -body { #pack ap .pack .pack.red top update winfo geometry .pack.red } -result 10x20+45+0 |
︙ | ︙ |
Changes to tests/option.test.
1 2 3 4 5 | # This file is a Tcl script to test out the option-handling facilities # of Tk. It is organized in the standard fashion for Tcl tests. # # Copyright © 1991-1993 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the option-handling facilities # of Tk. It is organized in the standard fashion for Tcl tests. # # Copyright © 1991-1993 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/pack.test.
1 2 3 4 5 | # This file is a Tcl script to test out the "pack" command of Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1993 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file is a Tcl script to test out the "pack" command of Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1993 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # Create some test windows. destroy .pack toplevel .pack wm geom .pack 300x200+0+0 |
︙ | ︙ | |||
1259 1260 1261 1262 1263 1264 1265 | } -body { pack .pack.a -ipady {5 5} } -returnCodes error -result {bad ipady value "5 5": must be positive screen distance} test pack-12.29 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side bac | | | 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | } -body { pack .pack.a -ipady {5 5} } -returnCodes error -result {bad ipady value "5 5": must be positive screen distance} test pack-12.29 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side bac } -returnCodes error -result {bad side "bac": must be bottom, left, right, or top} test pack-12.30 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -lousy bac } -returnCodes error -result {bad option "-lousy": must be -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side} test pack-12.31 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d |
︙ | ︙ | |||
1530 1531 1532 1533 1534 1535 1536 | place .pack.a -x 40 -y 10 update winfo manager .pack.a winfo geometry .pack.a pack info .pack.a } -returnCodes error -result {window ".pack.a" isn't packed} | | | 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 | place .pack.a -x 40 -y 10 update winfo manager .pack.a winfo geometry .pack.a pack info .pack.a } -returnCodes error -result {window ".pack.a" isn't packed} if {[tk windowingsystem] ne "aqua"} { proc packUpdate {} { update } } else { proc packUpdate {} { } } |
︙ | ︙ |
Changes to tests/panedwindow.test.
1 2 3 4 5 | # This file is a Tcl script to test entry widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test entry widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ | |||
118 119 120 121 122 123 124 | } -returnCodes error -result {bad screen distance "badValue"} test panedwindow-1.23 {configuration options: -proxyrelief (good)} -body { .p configure -proxyrelief groove list [lindex [.p configure -proxyrelief] 4] [.p cget -proxyrelief] } -cleanup { .p configure -proxyrelief [lindex [.p configure -proxyrelief] 3] } -result {groove groove} | | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | } -returnCodes error -result {bad screen distance "badValue"} test panedwindow-1.23 {configuration options: -proxyrelief (good)} -body { .p configure -proxyrelief groove list [lindex [.p configure -proxyrelief] 4] [.p cget -proxyrelief] } -cleanup { .p configure -proxyrelief [lindex [.p configure -proxyrelief] 3] } -result {groove groove} test panedwindow-1.24 {configuration options: -proxyrelief (bad)} -constraints needsTcl87 -body { .p configure -proxyrelief 1.5 } -returnCodes error -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, sunken, or ""} test panedwindow-1.25 {configuration options: -relief (good)} -body { .p configure -relief groove list [lindex [.p configure -relief] 4] [.p cget -relief] } -cleanup { .p configure -relief [lindex [.p configure -relief] 3] } -result {groove groove} test panedwindow-1.26 {configuration options: -relief (bad)} -body { |
︙ | ︙ | |||
289 290 291 292 293 294 295 | test panedwindow-1.58 {configuration options: -width (bad)} -body { .p paneconfigure .b -width badValue } -returnCodes error -result {bad screen distance "badValue"} deleteWindows test panedwindow-2.1 {panedwindow widget command} -setup { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > | < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | test panedwindow-1.58 {configuration options: -width (bad)} -body { .p paneconfigure .b -width badValue } -returnCodes error -result {bad screen distance "badValue"} deleteWindows test panedwindow-2.1 {panedwindow widget command} -setup { deleteWindows } -body { panedwindow .p .p foo } -cleanup { deleteWindows } -returnCodes error -result {bad command "foo": must be add, cget, configure, forget, identify, panecget, paneconfigure, panes, proxy, or sash} test panedwindow-3.1 {panedwindow panes subcommand} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] .p add [button .c] set result [list [.p panes]] .p forget .b lappend result [.p panes] } -cleanup { deleteWindows } -result [list [list .b .c] [list .c]] test panedwindow-4.1 {forget subcommand} -setup { deleteWindows } -body { panedwindow .p .p forget } -cleanup { deleteWindows } -returnCodes error -result {wrong # args: should be ".p forget widget ?widget ...?"} test panedwindow-4.2 {forget subcommand, forget one from start} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] .p add [button .c] set result [list [.p panes]] .p forget .b lappend result [.p panes] } -cleanup { deleteWindows } -result [list {.b .c} .c] test panedwindow-4.3 {forget subcommand, forget one from end} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] .p add [button .c] .p add [button .d] set result [list [.p panes]] .p forget .d update lappend result [.p panes] } -cleanup { deleteWindows } -result [list {.b .c .d} {.b .c}] test panedwindow-4.4 {forget subcommand, forget multiple} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] .p add [button .c] .p add [button .d] set result [list [.p panes]] .p forget .b .c update lappend result [.p panes] } -cleanup { deleteWindows } -result [list {.b .c .d} .d] test panedwindow-4.5 {forget subcommand, panes are unmapped} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] .p add [button .c] pack .p update set result [list [winfo ismapped .b] [winfo ismapped .c]] .p forget .b update lappend result [winfo ismapped .b] [winfo ismapped .c] } -cleanup { deleteWindows } -result [list 1 1 0 1] test panedwindow-4.6 {forget subcommand, changes reqsize of panedwindow} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 -showhandle false .p add [frame .f -width 20 -height 20] [frame .g -width 20 -height 20] set result [list [winfo reqwidth .p]] .p forget .f lappend result [winfo reqwidth .p] } -cleanup { deleteWindows } -result [list 44 20] test panedwindow-5.1 {sash subcommand} -setup { deleteWindows } -body { panedwindow .p .p sash } -cleanup { deleteWindows } -returnCodes error -result {wrong # args: should be ".p sash option ?arg ...?"} test panedwindow-5.2 {sash subcommand} -setup { deleteWindows } -body { panedwindow .p .p sash foo } -cleanup { deleteWindows } -returnCodes error -result {bad option "foo": must be coord, dragto, mark, or place} test panedwindow-6.1 {sash coord subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash coord } -cleanup { deleteWindows } -returnCodes error -result {wrong # args: should be ".p sash coord index"} test panedwindow-6.2 {sash coord subcommand, errors} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 .p sash coord 0 } -cleanup { deleteWindows } -returnCodes error -result {invalid sash index} test panedwindow-6.3 {sash coord subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash coord foo } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "foo"} test panedwindow-6.4 {sash coord subcommand sashes correctly placed} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 2 -sashwidth 4 -showhandle false .p add [frame .p.f -width 20 -height 20] \ [frame .p.f2 -width 20 -height 20] \ [frame .p.f3 -width 20 -height 20] .p sash coord 0 } -cleanup { deleteWindows } -result [list 22 0] test panedwindow-6.5 {sash coord subcommand sashes correctly placed} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 2 -sashwidth 4 -showhandle false .p add [frame .p.f -width 20 -height 20] \ [frame .p.f2 -width 20 -height 20] \ [frame .p.f3 -width 20 -height 20] .p sash coord 1 } -cleanup { deleteWindows } -result [list 50 0] test panedwindow-6.6 {sash coord subcommand, sashes correctly placed} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 2 -sashwidth 4 -orient vertical \ -showhandle false .p add [frame .p.f -width 20 -height 20] \ [frame .p.f2 -width 20 -height 20] \ [frame .p.f3 -width 20 -height 20] .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 22] test panedwindow-6.7 {sash coord subcommand, sashes correctly placed} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 2 -sashwidth 4 -orient vertical \ -showhandle false .p add [frame .p.f -width 20 -height 20] \ [frame .p.f2 -width 20 -height 20] \ [frame .p.f3 -width 20 -height 20] .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 50] test panedwindow-6.8 {sash coord subcommand, errors} -setup { deleteWindows } -body { panedwindow .p list [catch {.p sash coord -1} msg] $msg \ [catch {.p sash coord 0} msg] $msg \ [catch {.p sash coord 1} msg] $msg } -cleanup { deleteWindows } -result [list 1 "invalid sash index" 1 "invalid sash index" 1 "invalid sash index"] test panedwindow-6.9 {sash coord subcommand, errors} -setup { deleteWindows } -body { # There are no sashes until you have 2 panes panedwindow .p .p add [frame .p.f] list [catch {.p sash coord -1} msg] $msg \ [catch {.p sash coord 0} msg] $msg \ [catch {.p sash coord 1} msg] $msg } -cleanup { deleteWindows } -result [list 1 "invalid sash index" 1 "invalid sash index" 1 "invalid sash index"] test panedwindow-6.10 {sash coord subcommand, errors} -setup { deleteWindows } -body { # There are no sashes until you have 2 panes panedwindow .p .p add [frame .p.f] [frame .p.f2] list [catch {.p sash coord -1} msg] $msg \ [catch {.p sash coord 0} msg] \ [catch {.p sash coord 1} msg] $msg \ [catch {.p sash coord 2} msg] $msg } -cleanup { deleteWindows } -result [list 1 "invalid sash index" 0 1 "invalid sash index" 1 "invalid sash index"] test panedwindow-7.1 {sash mark subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash mark } -cleanup { deleteWindows } -returnCodes error -result {wrong # args: should be ".p sash mark index ?x y?"} test panedwindow-7.2 {sash mark subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash mark foo } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "foo"} test panedwindow-7.3 {sash mark subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash mark 0 foo bar } -cleanup { deleteWindows } -returnCodes error -result {invalid sash index} test panedwindow-7.4 {sash mark subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p sash mark 0 foo bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "foo"} test panedwindow-7.5 {sash mark subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p sash mark 0 0 bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "bar"} test panedwindow-7.6 {sash mark subcommand, mark defaults to 0 0} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p sash mark 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-7.7 {sash mark subcommand, set mark} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p sash mark 0 10 10 .p sash mark 0 } -cleanup { deleteWindows } -result [list 10 10] test panedwindow-8.1 {sash dragto subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash dragto } -cleanup { deleteWindows } -returnCodes error -result {wrong # args: should be ".p sash dragto index x y"} test panedwindow-8.2 {sash dragto subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash dragto foo bar baz } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "foo"} test panedwindow-8.3 {sash dragto subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash dragto 0 foo bar } -cleanup { deleteWindows } -returnCodes error -result {invalid sash index} test panedwindow-8.4 {sash dragto subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p sash dragto 0 foo bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "foo"} test panedwindow-8.5 {sash dragto subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p sash dragto 0 0 bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "bar"} test panedwindow-9.1 {sash mark/sash dragto interaction} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 -showhandle false .p add [frame .f -width 20 -height 20] [button .c -text foobar] .p sash mark 0 10 10 .p sash dragto 0 20 10 .p sash coord 0 } -cleanup { deleteWindows } -result [list 30 0] test panedwindow-9.2 {sash mark/sash dragto interaction} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 -orient vertical \ -showhandle false .p add [frame .p.f -width 20 -height 20] [button .p.c -text foobar] .p sash mark 0 10 10 .p sash dragto 0 10 20 .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 30] test panedwindow-9.3 {sash mark/sash dragto, respects minsize} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 -showhandle false .p add [frame .f -width 20 -height 20] [button .c] -minsize 15 .p sash mark 0 20 10 .p sash dragto 0 10 10 .p sash coord 0 } -cleanup { deleteWindows } -result [list 15 0] test panedwindow-10.1 {sash place subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash place } -cleanup { deleteWindows } -returnCodes error -result {wrong # args: should be ".p sash place index x y"} test panedwindow-10.2 {sash place subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash place foo bar baz } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "foo"} test panedwindow-10.3 {sash place subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p sash place 0 foo bar } -cleanup { deleteWindows } -returnCodes error -result {invalid sash index} test panedwindow-10.4 {sash place subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p sash place 0 foo bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "foo"} test panedwindow-10.5 {sash place subcommand, errors} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p sash place 0 0 bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "bar"} test panedwindow-10.6 {sash place subcommand, moves sash} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 20] [button .c] .p sash place 0 10 0 .p sash coord 0 } -cleanup { deleteWindows } -result [list 10 0] test panedwindow-10.7 {sash place subcommand, moves sash} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 -orient vertical .p add [frame .f -width 20 -height 20] [button .c] .p sash place 0 0 10 .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 10] test panedwindow-10.8 {sash place subcommand, respects minsize} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 -showhandle false .p add [frame .f -width 20 -height 20] [button .c] -minsize 15 .p sash place 0 10 0 .p sash coord 0 } -cleanup { deleteWindows } -result [list 15 0] test panedwindow-10.9 {sash place subcommand, respects minsize} -setup { deleteWindows } -body { panedwindow .p .p add [frame .f -width 20 -height 20 -bg pink] .p sash place 0 2 0 } -cleanup { deleteWindows } -returnCodes error -result {invalid sash index} test panedwindow-11.1 {moving sash changes size of pane to left} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 -showhandle false .p add [frame .f -width 20 -height 20] [button .c -text foobar] -sticky nsew .p sash place 0 30 0 pack .p update winfo width .f } -result 30 test panedwindow-11.2 {moving sash changes size of pane to right} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 20] [frame .f2 -width 20 -height 20] pack .p update set result [winfo width .f2] .p sash place 0 30 0 update lappend result [winfo width .f2] } -cleanup { deleteWindows } -result {20 10} test panedwindow-11.3 {moving sash does not change reqsize of panedwindow} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 20] [frame .f2 -width 20 -height 20] .p sash place 0 30 0 winfo reqwidth .p } -result 44 test panedwindow-11.4 {moving sash changes size of pane above} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ -orient vertical .p add [frame .f -width 20 -height 10] [button .c -text foobar] -sticky nsew .p sash place 0 0 20 pack .p update set result [winfo height .f] set result } -result 20 test panedwindow-11.5 {moving sash changes size of pane below} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ -orient vertical .p add [frame .f -width 20 -height 10] [frame .f2 -width 20 -height 10] pack .p update set result [winfo height .f2] .p sash place 0 0 15 update lappend result [winfo height .f2] set result } -cleanup { deleteWindows } -result {10 5} test panedwindow-11.6 {moving sash does not change reqsize of panedwindow} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ -orient vertical .p add [frame .f -width 20 -height 10] [frame .f2 -width 20 -height 10] set result [winfo reqheight .p] .p sash place 0 0 20 lappend result [winfo reqheight .p] set result } -cleanup { deleteWindows } -result [list 24 24] test panedwindow-11.7 {moving sash does not alter reqsize of widget} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ -orient vertical .p add [frame .f -width 20 -height 10] [frame .f2 -width 20 -height 10] set result [winfo reqheight .f] .p sash place 0 0 20 lappend result [winfo reqheight .f] } -cleanup { deleteWindows } -result [list 10 10] test panedwindow-11.8 {moving sash restricted to minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 20] [button .c] -minsize 15 .p sash place 0 10 0 pack .p update winfo width .f } -result 15 test panedwindow-11.9 {moving sash restricted to minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ -orient vertical .p add [frame .f -width 20 -height 30] [button .c] -minsize 10 .p sash place 0 0 5 pack .p update winfo height .f } -result 10 test panedwindow-11.10 {moving sash in unmapped window restricted to reqsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 30] [frame .f2 -width 20 -height 20] set result [list [.p sash coord 0]] .p sash place 0 100 0 lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list {20 0} {40 0}] test panedwindow-11.11 {moving sash right pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 30] [frame .f2 -width 20 -height 20] \ [frame .f3 -width 20 -height 30] .p sash place 0 80 0 list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result {{60 0} {64 0}} test panedwindow-11.12 {moving sash left pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 30] [frame .f2 -width 20 -height 20] \ [frame .f3 -width 20 -height 30] .p sash place 1 0 0 list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result {{0 0} {4 0}} test panedwindow-11.13 {move sash in mapped window restricted to visible win} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 30] [frame .f2 -width 20 -height 20] \ [frame .f3 -width 20 -height 30] place .p -width 50 update .p sash place 1 100 0 update .p sash coord 1 } -cleanup { deleteWindows } -result {46 0} test panedwindow-11.14 {move sash in mapped window restricted to visible win} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 30] [frame .f2 -width 20 -height 20] \ [frame .f3 -width 20 -height 30] place .p -width 100 update .p sash place 1 200 0 update .p sash coord 1 } -cleanup { deleteWindows } -result {96 0} test panedwindow-11.15 {moving sash into "virtual" space on last pane increases reqsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .f -width 20 -height 30] [frame .f2 -width 20 -height 20] \ [frame .f3 -width 20 -height 30] place .p -width 100 set result [winfo reqwidth .p] update .p sash place 1 200 0 update lappend result [winfo reqwidth .p] } -cleanup { deleteWindows } -result {68 100} test panedwindow-12.1 {horizontal panedwindow lays out widgets properly} -setup { deleteWindows set result {} } -body { panedwindow .p -showhandle false -borderwidth 2 -sashpad 2 -sashwidth 2 foreach win {.p.f .p.f2 .p.f3} {.p add [frame $win -width 20 -height 10]} pack .p update foreach w [.p panes] {lappend result [winfo x $w] [winfo y $w]} return $result } -cleanup { deleteWindows } -result [list 2 2 28 2 54 2] test panedwindow-12.2 {vertical panedwindow lays out widgets properly} -setup { deleteWindows set result {} } -body { panedwindow .p -showhandle false -borderwidth 2 -sashpad 2 -sashwidth 2 \ -orient vertical foreach win {.p.f .p.f2 .p.f3} {.p add [frame $win -width 20 -height 10]} pack .p update foreach w [.p panes] {lappend result [winfo x $w] [winfo y $w]} return $result } -cleanup { deleteWindows } -result [list 2 2 2 18 2 34] test panedwindow-12.3 {horizontal panedwindow lays out widgets properly} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 foreach {win color} {.p.f blue .p.f2 green} { .p add [frame $win -width 20 -height 20 -bg $color] -padx 10 -pady 5 \ -sticky "" } pack .p update set result [list [winfo reqwidth .p] [winfo reqheight .p]] foreach win {.p.f .p.f2} {lappend result [winfo x $win] [winfo y $win]} .p paneconfigure .p.f -padx 0 -pady 0 update lappend result [winfo reqwidth .p] [winfo reqheight .p] foreach win {.p.f .p.f2} {lappend result [winfo x $win] [winfo y $win]} return $result } -cleanup { deleteWindows } -result [list 80 30 10 5 50 5 60 30 0 5 30 5] test panedwindow-12.4 {vertical panedwindow lays out widgets properly} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 \ -orient vertical foreach win {.p.f .p.f2} { .p add [frame $win -width 20 -height 20] -padx 10 -pady 5 -sticky "" } pack .p update set result [list [winfo reqwidth .p] [winfo reqheight .p]] foreach win {.p.f .p.f2} {lappend result [winfo x $win] [winfo y $win]} .p paneconfigure .p.f -padx 0 -pady 0 update lappend result [winfo reqwidth .p] [winfo reqheight .p] foreach win {.p.f .p.f2} {lappend result [winfo x $win] [winfo y $win]} return $result } -cleanup { deleteWindows } -result [list 40 60 10 5 10 35 40 50 10 0 10 25] test panedwindow-12.5 {panedwindow respects reqsize of panes when possible} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 .p add [frame .p.f -width 20 -height 20] -sticky "" place .p -width 40 update set result [list [winfo width .p.f]] .p.f configure -width 30 update lappend result [winfo width .p.f] } -cleanup { deleteWindows } -result [list 20 30] test panedwindow-12.6 {panedwindow takes explicit widget width over reqwidth} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 .p add [frame .p.f -width 20 -height 20] -width 20 -sticky "" place .p -width 40 update set result [list [winfo width .p.f]] .p.f configure -width 30 update lappend result [winfo width .p.f] } -cleanup { deleteWindows } -result [list 20 20] test panedwindow-12.7 {horizontal panedwindow reqheight is max pane height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 .p add [frame .p.f -width 20 -height 20] [frame .p.f2 -width 20 -height 20] set result [winfo reqheight .p] .p.f config -height 40 lappend result [winfo reqheight .p] } -cleanup { deleteWindows } -result {20 40} test panedwindow-12.8 {horizontal panedwindow reqheight is max pane height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 foreach win {.p.f .p.f2} {.p add [frame $win -width 20 -height 20]} .p paneconfigure .p.f -height 15 set result [winfo reqheight .p] .p.f config -height 40 lappend result [winfo reqheight .p] } -cleanup { deleteWindows } -result {20 20} test panedwindow-12.9 {panedwindow pane width overrides widget width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 foreach win {.p.f .p.f2} {.p add [frame $win -width 20 -height 20]} .p sash place 0 10 0 pack .p update set result [winfo width .p.f] .p paneconfigure .p.f -width 30 lappend result [winfo width .p.f] } -cleanup { deleteWindows } -result [list 10 10] test panedwindow-12.10 {panedwindow respects reqsize of panes when possible} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 .p add [frame .p.f -width 20 -height 20] -sticky "" place .p -height 40 update set result [list [winfo height .p.f]] .p.f configure -height 30 update lappend result [winfo height .p.f] } -cleanup { deleteWindows } -result [list 20 30] test panedwindow-12.11 {panedwindow takes explicit height over reqheight} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 .p add [frame .p.f -width 20 -height 20] -height 20 -sticky "" place .p -height 40 update set result [list [winfo height .p.f]] .p.f configure -height 30 update lappend result [winfo height .p.f] } -cleanup { deleteWindows } -result [list 20 20] test panedwindow-12.12 {vertical panedwindow reqwidth is max pane width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ -orient vertical .p add [frame .p.f -width 20 -height 20] [frame .p.f2 -width 20 -height 20] set result [winfo reqwidth .p] .p.f config -width 40 lappend result [winfo reqwidth .p] } -cleanup { deleteWindows } -result {20 40} test panedwindow-12.13 {vertical panedwindow reqwidth is max pane width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ -orient vertical foreach win {.p.f .p.f2} {.p add [frame $win -width 20 -height 20]} .p paneconfigure .p.f -width 15 set result [winfo reqwidth .p] .p.f config -width 40 lappend result [winfo reqwidth .p] } -cleanup { deleteWindows } -result {20 20} test panedwindow-12.14 {panedwindow pane height overrides widget width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ -orient vertical foreach win {.p.f .p.f2} {.p add [frame $win -width 20 -height 20]} .p sash place 0 0 10 pack .p update set result [winfo height .p.f] .p paneconfigure .p.f -height 30 lappend result [winfo height .p.f] } -cleanup { deleteWindows } -result [list 10 10] test panedwindow-13.1 {PanestructureProc, widget yields managements} -setup { deleteWindows } -body { # Check that the panedwindow correctly yields geometry management of # a pane when the pane is destroyed. # This test should not cause a core dump, and it should not cause # a memory leak. panedwindow .p .p add [button .b] destroy .p pack .b destroy .b set result "" } -result {} test panedwindow-13.2 {PanedWindowLostPaneProc, widget yields management} -setup { deleteWindows } -body { # Check that the paned window correctly yields geometry management of # a pane when some other geometry manager steals the pane from us. # This test should not cause a core dump, and it should not cause a # memory leak. panedwindow .p |
︙ | ︙ | |||
1491 1492 1493 1494 1495 1496 1497 | list news [winfo x .p.f] [winfo y .p.f] [winfo width .p.f] [winfo height .p.f] } -cleanup { deleteWindows } -result {news 0 0 40 40} test panedwindow-16.1 {setting minsize when pane is too small snaps width} -setup { | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > | | < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > | | < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 | list news [winfo x .p.f] [winfo y .p.f] [winfo width .p.f] [winfo height .p.f] } -cleanup { deleteWindows } -result {news 0 0 40 40} test panedwindow-16.1 {setting minsize when pane is too small snaps width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .p.f -height 20 -width 20 -bg red] set result [winfo reqwidth .p] .p paneconfigure .p.f -minsize 40 lappend result [winfo reqwidth .p] } -cleanup { deleteWindows } -result [list 20 40] test panedwindow-17.1 {MoveSash, move right} -setup { deleteWindows set result {} } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqwidth .p] .p sash place 0 30 0 # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqwidth .p] # Check that the sash moved lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list 42 42 {30 0}] test panedwindow-17.2 {MoveSash, move right (unmapped) clipped by reqwidth} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 100 0 # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 40 0] test panedwindow-17.3 {MoveSash, move right (mapped, width < reqwidth) clipped by width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Put the panedwindow up on the display and give it a width < reqwidth place .p -x 0 -y 0 -width 32 update .p sash place 0 100 0 # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 30 0] test panedwindow-17.4 {MoveSash, move right (mapped, width > reqwidth) clipped by width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Put the panedwindow up on the display and give it a width > reqwidth place .p -x 0 -y 0 -width 102 update .p sash place 0 200 0 # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 100 0] test panedwindow-17.5 {MoveSash, move right respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 30 0] test panedwindow-17.6 {MoveSash, move right respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible. .p sash coord 0 } -cleanup { deleteWindows } -result [list 40 0] test panedwindow-17.7 {MoveSash, move right pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 62 0] test panedwindow-17.8 {MoveSash, move right pushes other sashes, respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 52 0] test panedwindow-17.9 {MoveSash, move right respects minsize, exludes pad} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize 10 -padx 5 } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 50 0] test panedwindow-17.10 {MoveSash, move right, negative minsize becomes 0} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize -50 } .p sash place 0 50 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result [list [list 50 0] [list 52 0]] test panedwindow-17.11 {MoveSash, move left} -setup { deleteWindows } -body { set result {} panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqwidth .p] .p sash place 0 10 0 # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqwidth .p] # Check that the sash moved lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list 42 42 {10 0}] test panedwindow-17.12 {MoveSash, move left, can't move outside of window} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 -100 0 # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-17.13 {MoveSash, move left respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 10 0] test panedwindow-17.14 {MoveSash, move left respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible. .p sash coord 1 } -cleanup { deleteWindows } -result [list 22 0] test panedwindow-17.15 {MoveSash, move left pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-17.16 {MoveSash, move left pushes other sashes, respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 10 0] test panedwindow-17.17 {MoveSash, move left respects minsize, exludes pad} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize 10 -padx 5 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 42 0] test panedwindow-17.18 {MoveSash, move left, negative minsize becomes 0} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue green} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize -50 } .p sash place 1 10 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result [list [list 8 0] [list 10 0]] test panedwindow-18.1 {MoveSash, move down} -setup { deleteWindows } -body { set result {} panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqheight .p] .p sash place 0 0 30 # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqheight .p] # Check that the sash moved lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list 42 42 {0 30}] test panedwindow-18.2 {MoveSash, move down (unmapped) clipped by reqheight} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 0 100 # Get the new sash coord; it should be clipped by the reqheight of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 40] test panedwindow-18.3 {MoveSash, move down (mapped, height < reqheight) clipped by height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Put the panedwindow up on the display and give it a height < reqheight place .p -x 0 -y 0 -height 32 update .p sash place 0 0 100 # Get the new sash coord; it should be clipped by the visible height of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 30] test panedwindow-18.4 {MoveSash, move down (mapped, height > reqheight) clipped by height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Put the panedwindow up on the display and give it a width > reqwidth place .p -x 0 -y 0 -height 102 update .p sash place 0 0 200 # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 100] test panedwindow-18.5 {MoveSash, move down respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 30] test panedwindow-18.6 {MoveSash, move down respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 40] test panedwindow-18.7 {MoveSash, move down pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 62] test panedwindow-18.8 {MoveSash, move down pushes other sashes, respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 52] test panedwindow-18.9 {MoveSash, move down respects minsize, exludes pad} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize 10 -pady 5 } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 50] test panedwindow-18.10 {MoveSash, move right, negative minsize becomes 0} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize -50 } .p sash place 0 0 50 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result [list [list 0 50] [list 0 52]] test panedwindow-18.11 {MoveSash, move up} -setup { deleteWindows } -body { set result {} panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqheight .p] .p sash place 0 0 10 # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqheight .p] # Check that the sash moved lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list 42 42 {0 10}] test panedwindow-18.12 {MoveSash, move up, can't move outside of window} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 0 -100 # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-18.13 {MoveSash, move up respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 10] test panedwindow-18.14 {MoveSash, move up respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible. .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 22] test panedwindow-18.15 {MoveSash, move up pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-18.16 {MoveSash, move up pushes other sashes, respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 10] test panedwindow-18.17 {MoveSash, move up respects minsize, exludes pad} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize 10 -pady 5 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 42] test panedwindow-18.18 {MoveSash, move up, negative minsize becomes 0} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue green} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize -50 } .p sash place 1 0 10 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result [list [list 0 8] [list 0 10]] # The following tests check that the panedwindow is correctly computing its # geometry based on the various configuration options that can affect the # geometry. test panedwindow-19.1 {ComputeGeometry, reqheight taken from widgets} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 foreach w {.f1 .f2 .f3} { .p add [frame $w -width 20 -height 20 -bg blue] } set result [list [list [winfo reqwidth .p] [winfo reqheight .p]]] .f3 configure -height 40 lappend result [list [winfo reqwidth .p] [winfo reqheight .p]] } -cleanup { deleteWindows } -result [list [list 60 20] [list 60 40]] test panedwindow-19.2 {ComputeGeometry, reqheight taken from widgets} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 foreach w {.f1 .f2 .f3} { .p add [frame $w -width 20 -height 20 -bg blue] } set result [list [list [winfo reqwidth .p] [winfo reqheight .p]]] .p paneconfigure .f3 -height 40 lappend result [list [winfo reqwidth .p] [winfo reqheight .p]] } -cleanup { deleteWindows } -result [list [list 60 20] [list 60 40]] test panedwindow-19.3 {ComputeGeometry, reqheight taken from widgets} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 foreach w {.f1 .f2 .f3} { .p add [frame $w -width 20 -height 20 -bg blue] -pady 20 } set result [list [list [winfo reqwidth .p] [winfo reqheight .p]]] .p paneconfigure .f3 -height 40 lappend result [list [winfo reqwidth .p] [winfo reqheight .p]] } -cleanup { deleteWindows } -result [list [list 60 60] [list 60 80]] test panedwindow-19.4 {ComputeGeometry, reqwidth taken from widgets} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 \ -orient vertical foreach w {.f1 .f2 .f3} { .p add [frame $w -width 20 -height 20 -bg blue] } set result [list [list [winfo reqwidth .p] [winfo reqheight .p]]] .f3 configure -width 40 lappend result [list [winfo reqwidth .p] [winfo reqheight .p]] } -cleanup { deleteWindows } -result [list [list 20 60] [list 40 60]] test panedwindow-19.5 {ComputeGeometry, reqwidth taken from widgets} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 \ -orient vertical foreach w {.f1 .f2 .f3} { .p add [frame $w -width 20 -height 20 -bg blue] } set result [list [list [winfo reqwidth .p] [winfo reqheight .p]]] .p paneconfigure .f3 -width 40 lappend result [list [winfo reqwidth .p] [winfo reqheight .p]] } -cleanup { deleteWindows } -result [list [list 20 60] [list 40 60]] test panedwindow-19.6 {ComputeGeometry, reqwidth taken from widgets} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 0 \ -orient vertical foreach w {.f1 .f2 .f3} { .p add [frame $w -width 20 -height 20 -bg blue] -padx 20 } set result [list [list [winfo reqwidth .p] [winfo reqheight .p]]] .p paneconfigure .f3 -width 40 lappend result [list [winfo reqwidth .p] [winfo reqheight .p]] } -cleanup { deleteWindows } -result [list [list 60 60] [list 80 60]] test panedwindow-19.7 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should |
︙ | ︙ | |||
4304 4305 4306 4307 4308 4309 4310 | return $result } -cleanup { deleteWindows } -result {{5 13 20 20} {5 71 20 20} {5 129 20 20}} test panedwindow-20.1 {destroyed widgets are removed from panedwindow} -setup { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 | return $result } -cleanup { deleteWindows } -result {{5 13 20 20} {5 71 20 20} {5 129 20 20}} test panedwindow-20.1 {destroyed widgets are removed from panedwindow} -setup { deleteWindows } -body { panedwindow .p .p add [frame .f -width 20 -height 20 -bg blue] destroy .f .p panes } -cleanup { deleteWindows } -result {} test panedwindow-20.2 {destroyed pane causes geometry recomputation} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .f -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] destroy .f winfo reqwidth .p } -cleanup { deleteWindows } -result 20 test panedwindow-21.1 {ArrangePanes, extra space is given to the last pane} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] -sticky nsew place .p -width 100 -x 0 -y 0 update winfo width .f2 } -cleanup { deleteWindows } -result 78 test panedwindow-21.2 {ArrangePanes, extra space is given to the last pane} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] -sticky nsew place .p -height 100 -x 0 -y 0 update winfo height .f2 } -cleanup { deleteWindows } -result 78 test panedwindow-21.3 {ArrangePanes, explicit height/width are preferred} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] -sticky "" .p paneconfigure .f1 -width 10 -height 15 pack .p update list [winfo width .f1] [winfo height .f1] } -cleanup { deleteWindows } -result {10 15} test panedwindow-21.4 {ArrangePanes, panes clipped by size of pane} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] .p sash place 0 10 0 pack .p update list [winfo width .f1] [winfo height .f1] } -cleanup { deleteWindows } -result {10 20} test panedwindow-21.5 {ArrangePanes, panes clipped by size of pane} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] .p sash place 0 0 10 pack .p update list [winfo width .f1] [winfo height .f1] } -cleanup { deleteWindows } -result {20 10} test panedwindow-21.6 {ArrangePanes, height of pane taken from total height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .p.f1 -width 20 -height 20 -bg blue] \ [frame .p.f2 -width 20 -height 40 -bg red] -sticky "" pack .p update winfo y .p.f1 } -cleanup { deleteWindows } -result 10 test panedwindow-21.7 {ArrangePanes, width of pane taken from total width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical .p add [frame .p.f1 -width 20 -height 20 -bg blue] \ [frame .p.f2 -width 40 -height 40 -bg red] -sticky "" pack .p update winfo x .p.f1 } -cleanup { deleteWindows } -result 10 test panedwindow-21.8 {ArrangePanes, panes with width <= 0 are unmapped} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 40 -bg red] pack .p update set result [winfo ismapped .f1] .p sash place 0 0 0 update lappend result [winfo ismapped .f1] } -cleanup { deleteWindows } -result {1 0} test panedwindow-21.9 {ArrangePanes, panes with width <= 0 are unmapped} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .p.f1 -width 20 -height 20 -bg blue] \ [frame .p.f2 -width 20 -height 40 -bg red] pack .p update set result [winfo ismapped .p.f1] .p sash place 0 0 0 update lappend result [winfo ismapped .p.f1] } -cleanup { deleteWindows } -result {1 0} test panedwindow-21.10 {ArrangePanes, panes with width <= 0 are unmapped} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 -orient vertical .p add [frame .p.f1 -width 20 -height 20 -bg blue] \ [frame .p.f2 -width 20 -height 40 -bg red] pack .p update set result [winfo ismapped .p.f1] .p sash place 0 0 0 update lappend result [winfo ismapped .p.f1] } -cleanup { deleteWindows } -result {1 0} test panedwindow-21.11 {ArrangePanes, last pane shrinks} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] -sticky nsew place .p -width 40 -x 0 -y 0 update winfo width .f2 } -cleanup { deleteWindows } -result 18 test panedwindow-21.12 {ArrangePanes, last pane shrinks} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] -sticky nsew place .p -height 40 -x 0 -y 0 update winfo height .f2 } -cleanup { deleteWindows } -result 18 test panedwindow-21.13 {ArrangePanes, panedwindow resizes} -setup { deleteWindows } -body { panedwindow .p -width 200 -borderwidth 0 frame .f1 -height 50 -bg blue set result [list] lappend result [winfo reqwidth .p] [winfo reqheight .p] .p add .f1 pack .p lappend result [winfo reqwidth .p] [winfo reqheight .p] } -cleanup { deleteWindows } -result {200 1 200 50} test panedwindow-21.14 {ArrangePanes, panedwindow resizes} -setup { deleteWindows } -body { panedwindow .p -height 200 -borderwidth 0 -orient vertical frame .f1 -width 50 -bg blue set result [list] lappend result [winfo reqwidth .p] [winfo reqheight .p] .p add .f1 pack .p lappend result [winfo reqwidth .p] [winfo reqheight .p] } -cleanup { deleteWindows } -result {1 200 50 200} test panedwindow-21.15 {ArrangePanes, last pane grows} -setup { deleteWindows } -body { panedwindow .p -showhandle false -height 50 .p add [frame .f1 -width 50 -bg red] [frame .f2 -width 50 -bg white] \ [frame .f3 -width 50 -bg blue] [frame .f4 -width 50 -bg green] .p sash place 1 250 0 pack .p update set result [list] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] [winfo width .p] .p configure -width 300 update lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] [winfo width .p] } -cleanup { deleteWindows } -result {50 150 1 1 211 50 150 1 89 300} test panedwindow-22.1 {PanedWindowReqProc, react to pane geometry changes} -setup { deleteWindows } -body { # Basically just want to make sure that the PanedWindowReqProc is called panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 40 -bg red] set result [winfo reqheight .p] .f1 configure -height 80 lappend result [winfo reqheight .p] } -cleanup { deleteWindows } -result {40 80} test panedwindow-22.2 {PanedWindowReqProc, react to pane geometry changes} -setup { deleteWindows } -body { panedwindow .p -orient horizontal -sashpad 0 -sashwidth 2 .p add [frame .f1 -width 10] [frame .f2 -width 10] set result [winfo reqwidth .p] .f1 configure -width 20 lappend result [winfo reqwidth .p] destroy .p .f1 .f2 expr {[lindex $result 1] - [lindex $result 0]} } -cleanup { deleteWindows } -result 10 test panedwindow-23.1 {ConfigurePanes, can't add panedwindow to itself} -setup { deleteWindows } -body { panedwindow .p .p add .p } -cleanup { deleteWindows } -returnCodes error -result {can't add .p to itself} test panedwindow-23.2 {ConfigurePanes, bad window throws error} -setup { deleteWindows } -body { panedwindow .p .p add .b } -cleanup { deleteWindows } -returnCodes error -result {bad window path name ".b"} test panedwindow-23.3 {ConfigurePanes, bad window aborts processing} -setup { deleteWindows } -body { panedwindow .p button .b catch {.p add .b .a} .p panes } -cleanup { deleteWindows } -result {} test panedwindow-23.4 {ConfigurePanes, bad option aborts processing} -setup { deleteWindows } -body { panedwindow .p button .b catch {.p add .b -sticky foobar} .p panes } -cleanup { deleteWindows } -result {} test panedwindow-23.5 {ConfigurePanes, after win isn't managed by panedwin} -setup { deleteWindows } -body { panedwindow .p button .b button .c .p add .b -after .c } -cleanup { deleteWindows } -returnCodes error -result {window ".c" is not managed by .p} test panedwindow-23.6 {ConfigurePanes, before win isn't managed by panedwin} -setup { deleteWindows } -body { panedwindow .p button .b button .c .p add .b -before .c } -cleanup { deleteWindows } -returnCodes error -result {window ".c" is not managed by .p} test panedwindow-23.7 {ConfigurePanes, -after {} is a no-op} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p paneconfigure .b -after {} .p panes } -cleanup { deleteWindows } -result {.b .c} test panedwindow-23.8 {ConfigurePanes, -before {} is a no-op} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p paneconfigure .b -before {} .p panes } -cleanup { deleteWindows } -result {.b .c} test panedwindow-23.9 {ConfigurePanes, new panes are added} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] .p panes } -cleanup { deleteWindows } -result {.b .c} test panedwindow-23.10 {ConfigurePanes, options applied to all panes} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] [button .c] -sticky ne -height 5 -width 5 -minsize 10 set result {} foreach w {.b .c} { set val {} foreach option {-sticky -height -width -minsize} { lappend val $option [.p panecget $w $option] } lappend result $w $val } return $result } -cleanup { deleteWindows } -result {.b {-sticky ne -height 5 -width 5 -minsize 10} .c {-sticky ne -height 5 -width 5 -minsize 10}} test panedwindow-23.11 {ConfigurePanes, existing panes are reconfigured} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] -sticky nw -height 10 .p add .b [button .c] -sticky se -height 2 list [.p panes] [.p panecget .b -sticky] [.p panecget .b -height] \ [.p panecget .c -sticky] [.p panecget .c -height] } -cleanup { deleteWindows } -result [list {.b .c} es 2 es 2] test panedwindow-23.12 {ConfigurePanes, widgets added to end by default} -setup { deleteWindows } -body { panedwindow .p .p add [button .b] .p add [button .c] .p add [button .d] .p panes } -cleanup { deleteWindows } -result {.b .c .d} test panedwindow-23.13 {ConfigurePanes, -after, single addition} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c .p add .a .b .p add .c -after .a .p panes } -cleanup { deleteWindows } -result {.a .c .b} test panedwindow-23.14 {ConfigurePanes, -after, multiple additions} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c button .d .p add .a .b .p add .c .d -after .a .p panes } -cleanup { deleteWindows } -result {.a .c .d .b} test panedwindow-23.15 {ConfigurePanes, -after, relocates existing widget} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c button .d .p add .a .b .c .d .p add .d -after .a .p panes } -cleanup { deleteWindows } -result {.a .d .b .c} test panedwindow-23.16 {ConfigurePanes, -after, relocates existing widgets} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c button .d .p add .a .b .c .d .p add .b .d -after .a .p panes } -cleanup { deleteWindows } -result {.a .b .d .c} test panedwindow-23.17 {ConfigurePanes, -after, relocates existing widgets} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c button .d .p add .a .b .c .d .p add .d .a -after .b .p panes } -cleanup { deleteWindows } -result {.b .d .a .c} test panedwindow-23.18 {ConfigurePanes, -after, relocates existing widgets} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c button .d .p add .a .b .c .d .p add .d .a -after .a .p panes } -cleanup { deleteWindows } -result {.d .a .b .c} test panedwindow-23.19 {ConfigurePanes, -after, after last window} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c button .d .p add .a .b .c .p add .d -after .c .p panes } -cleanup { deleteWindows } -result {.a .b .c .d} test panedwindow-23.20 {ConfigurePanes, -before, before first window} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c button .d .p add .a .b .c .p add .d -before .a .p panes } -cleanup { deleteWindows } -result {.d .a .b .c} test panedwindow-23.21 {ConfigurePanes, -before, relocate existing windows} -setup { deleteWindows } -body { panedwindow .p button .a button .b button .c button .d .p add .a .b .c .p add .d .b -before .a .p panes } -cleanup { deleteWindows } -result {.d .b .a .c} test panedwindow-23.22 {ConfigurePanes, pane specified multiple times} -setup { deleteWindows } -body { # This test should not cause a core dump panedwindow .p button .a button .b button .c .p add .a .a .b .c .p panes } -cleanup { deleteWindows } -result {.a .b .c} test panedwindow-23.23 {ConfigurePanes, pane specified multiple times} -setup { deleteWindows } -body { # This test should not cause a core dump panedwindow .p button .a button .b button .c .p add .a .a .b .c .p add .a .b .a -after .c .p panes } -cleanup { deleteWindows } -result {.c .a .b} test panedwindow-23.24 {ConfigurePanes, panedwindow cannot manage toplevels} -setup { deleteWindows } -body { panedwindow .p toplevel .t .p add .t } -cleanup { deleteWindows } -returnCodes error -result {can't add toplevel .t to .p} test panedwindow-23.25 {ConfigurePanes, restrict possible panes} -setup { deleteWindows } -body { panedwindow .p frame .f button .f.b .p add .f.b } -cleanup { deleteWindows } -returnCodes error -result {can't add .f.b to .p} test panedwindow-23.26 {ConfigurePanes, restrict possible panes} -setup { deleteWindows } -body { frame .f panedwindow .f.p button .b .f.p add .b } -cleanup { deleteWindows } -result {} test panedwindow-23.27 {ConfigurePanes, restrict possible panes} -setup { deleteWindows } -body { panedwindow .p button .p.b .p add .p.b } -cleanup { deleteWindows } -result {} test panedwindow-23.28 {ConfigurePanes, restrict possible panes} -setup { deleteWindows } -body { frame .f frame .f.f frame .f.f.f panedwindow .f.f.f.p button .b .f.f.f.p add .b } -cleanup { deleteWindows } -result {} test panedwindow-23.29 {ConfigurePanes, -hide works} -setup { deleteWindows } -body { panedwindow .p -showhandle false frame .f1 -width 40 -height 100 -bg red frame .f2 -width 40 -height 100 -bg white frame .f3 -width 40 -height 100 -bg blue frame .f4 -width 40 -height 100 -bg green .p add .f1 .f2 .f3 .f4 pack .p update set result [list] lappend result [winfo ismapped .f1] [winfo ismapped .f2] \ [winfo ismapped .f3] [winfo ismapped .f4] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] [winfo width .p] .p paneconfigure .f2 -hide 1 update lappend result [winfo ismapped .f1] [winfo ismapped .f2] \ [winfo ismapped .f3] [winfo ismapped .f4] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] [winfo width .p] } -cleanup { deleteWindows } -result {1 1 1 1 40 40 40 40 171 1 0 1 1 40 40 40 40 128} test panedwindow-23.30 {ConfigurePanes, -hide works} -setup { deleteWindows } -body { panedwindow .p -showhandle false -width 130 -height 100 frame .f1 -width 40 -bg red frame .f2 -width 40 -bg white frame .f3 -width 40 -bg blue frame .f4 -width 40 -bg green .p add .f1 .f2 .f3 .f4 pack .p update set result [list] lappend result [winfo ismapped .f1] [winfo ismapped .f2] \ [winfo ismapped .f3] [winfo ismapped .f4] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] [winfo width .p] .p paneconfigure .f2 -hide 1 update lappend result [winfo ismapped .f1] [winfo ismapped .f2] \ [winfo ismapped .f3] [winfo ismapped .f4] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] [winfo width .p] } -cleanup { deleteWindows } -result {1 1 1 0 39 40 40 1 130 1 0 1 1 40 40 40 42 130} test panedwindow-23.30a {ConfigurePanes, hidden panes are unmapped} -setup { deleteWindows } -body { panedwindow .p1 -sashrelief raised panedwindow .p2 -sashrelief raised label .l1 -text Label1 label .l2 -text Label2 label .l3 -text Label3 .p2 add .l2 -sticky nsew .p2 add .l3 -sticky nsew .p1 add .p2 -sticky nsew .p1 add .l1 -sticky nsew pack .p1 -side top -expand 1 -fill both update set result [list] lappend result [list [winfo ismapped .p1] [winfo ismapped .p2] \ [winfo ismapped .l1] [winfo ismapped .l2] [winfo ismapped .l3]] .p2 paneconfigure .l1 -hide 1 update lappend result [list [winfo ismapped .p1] [winfo ismapped .p2] \ [winfo ismapped .l1] [winfo ismapped .l2] [winfo ismapped .l3]] .p1 paneconfigure .p2 -hide 1 update lappend result [list [winfo ismapped .p1] [winfo ismapped .p2] \ [winfo ismapped .l1] [winfo ismapped .l2] [winfo ismapped .l3]] .p1 paneconfigure .p2 -hide 0 update lappend result [list [winfo ismapped .p1] [winfo ismapped .p2] \ [winfo ismapped .l1] [winfo ismapped .l2] [winfo ismapped .l3]] } -cleanup { deleteWindows } -result {{1 1 1 1 1} {1 1 0 1 1} {1 0 0 0 0} {1 1 0 1 1}} test panedwindow-23.31 {ConfigurePanes, -hide works, last pane stretches} -setup { deleteWindows } -body { panedwindow .p -showhandle false -width 200 -height 200 -borderwidth 0 frame .f1 -width 50 -bg red frame .f2 -width 50 -bg green frame .f3 -width 50 -bg blue .p add .f1 .f2 .f3 pack .p update set result [list] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] .p paneconfigure .f2 -hide 1 update lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] } -cleanup { deleteWindows } -result {50 50 94 50 50 147} test panedwindow-23.32 {ConfigurePanes, -hide works, last pane stretches} -setup { deleteWindows } -body { panedwindow .p -showhandle false -width 200 -height 200 \ -borderwidth 0 -orient vertical frame .f1 -height 50 -bg red frame .f2 -height 50 -bg green frame .f3 -height 50 -bg blue .p add .f1 .f2 .f3 pack .p update set result [list] lappend result [winfo height .f1] [winfo height .f2] [winfo height .f3] .p paneconfigure .f2 -hide 1 update lappend result [winfo height .f1] [winfo height .f2] [winfo height .f3] } -cleanup { deleteWindows } -result {50 50 94 50 50 147} test panedwindow-23.33 {ConfigurePanes, -stretch first} -setup { deleteWindows } -body { panedwindow .p -showhandle false -height 100 -width 182 frame .f1 -width 40 -bg red frame .f2 -width 40 -bg white frame .f3 -width 40 -bg blue frame .f4 -width 40 -bg green .p add .f1 .f2 .f3 .f4 -stretch first pack .p update set result [list] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] .p paneconfigure .f2 -hide 1 update lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] } -cleanup { deleteWindows } -result {51 40 40 40 94 40 40 40} test panedwindow-23.34 {ConfigurePanes, -stretch middle} -setup { deleteWindows } -body { panedwindow .p -showhandle false -height 100 -width 182 frame .f1 -width 40 -bg red frame .f2 -width 40 -bg white frame .f3 -width 40 -bg blue frame .f4 -width 40 -bg green .p add .f1 .f2 .f3 .f4 -stretch middle pack .p update set result [list] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] .p paneconfigure .f2 -hide 1 update lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] } -cleanup { deleteWindows } -result {40 45 46 40 40 45 94 40} test panedwindow-23.35 {ConfigurePanes, -stretch always} -setup { deleteWindows } -body { panedwindow .p -showhandle false -height 100 -width 182 frame .f1 -width 40 -bg red frame .f2 -width 40 -bg white frame .f3 -width 40 -bg blue frame .f4 -width 40 -bg green .p add .f1 .f2 .f3 .f4 -stretch always pack .p update set result [list] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] .p paneconfigure .f2 -hide 1 update lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] } -cleanup { deleteWindows } -result {42 43 43 43 58 43 58 58} test panedwindow-23.36 {ConfigurePanes, -stretch never} -setup { deleteWindows } -body { panedwindow .p -showhandle false -height 100 -width 182 frame .f1 -width 40 -bg red frame .f2 -width 40 -bg white frame .f3 -width 40 -bg blue frame .f4 -width 40 -bg green .p add .f1 .f2 .f3 .f4 -stretch never pack .p update set result [list] lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] .p paneconfigure .f2 -hide 1 update lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] \ [winfo width .f4] } -cleanup { deleteWindows } -result {40 40 40 40 40 40 40 40} test panedwindow-24.1 {Unlink, remove a paned with -before/-after refs} -setup { deleteWindows } -body { # Bug 928413 set result {} panedwindow .pw label .pw.l1 -text Label1 label .pw.l2 -text Label2 label .pw.l3 -text Label3 .pw add .pw.l1 .pw add .pw.l3 .pw add .pw.l2 -before .pw.l3 lappend result [.pw panecget .pw.l2 -before] destroy .pw.l3 lappend result [.pw panecget .pw.l2 -before] .pw paneconfigure .pw.l2 -before .pw.l1 lappend result [.pw panecget .pw.l2 -before] } -cleanup { deleteWindows } -result {.pw.l3 {} .pw.l1} test panedwindow-25.1 {DestroyPanedWindow} -setup { deleteWindows } -body { # This test should not result in any memory leaks. panedwindow .p foreach w {.a .b .c .d .e .f .g .h .i .j .k .l .m .n .o .q .r .s .t} { .p add [button $w] } foreach w {.a .b .c .d .e .f .g .h .i .j .k .l .m .n .o .p .q .r .s .t} { destroy $w } set result {} } -result {} test panedwindow-25.2 {UnmapNotify and MapNotify events are propagated to panes} -setup { deleteWindows } -body { panedwindow .pw |
︙ | ︙ | |||
5161 5162 5163 5164 5165 5166 5167 | pack .pw update lappend result [winfo ismapped .pw] lappend result [winfo ismapped .pw.b] destroy .pw .pw.b set result } -cleanup { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 | pack .pw update lappend result [winfo ismapped .pw] lappend result [winfo ismapped .pw.b] destroy .pw .pw.b set result } -cleanup { deleteWindows } -result {1 0 0 1 1} test panedwindow-26.1 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 0 0 } -cleanup { deleteWindows } -result {} test panedwindow-26.2 {PanedWindowIdentifyCoords, padding is included} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 20 0 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.3 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 22 0 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.4 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 24 0 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.5 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 26 0 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.6 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 26 -1 } -cleanup { deleteWindows } -result {} test panedwindow-26.7 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 26 100 } -cleanup { deleteWindows } -result {} test panedwindow-26.8 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -showhandle 1 -handlepad 5 \ -handlesize 6 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 22 4 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.9 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -showhandle 1 -handlepad 5 \ -handlesize 6 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 22 5 } -cleanup { deleteWindows } -result {0 handle} test panedwindow-26.10 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -showhandle 1 -handlepad 5 \ -handlesize 8 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 20 5 } -cleanup { deleteWindows } -result {0 handle} test panedwindow-26.11 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -showhandle 1 -handlepad 5 \ -handlesize 8 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 20 0 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.12 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -showhandle false -bd 0 -sashwidth 2 -sashpad 2 .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] \ [frame .f3 -bg green -width 20 -height 20] .p identify 48 0 } -cleanup { deleteWindows } -result {1 sash} test panedwindow-26.13 {identify subcommand errors} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 2 -sashwidth 4 .p identify } -cleanup { deleteWindows } -returnCodes error -result {wrong # args: should be ".p identify x y"} test panedwindow-26.14 {identify subcommand errors} -setup { deleteWindows } -body { panedwindow .p .p identify foo bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "foo"} test panedwindow-26.15 {identify subcommand errors} -setup { deleteWindows } -body { panedwindow .p .p identify 0 bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "bar"} test panedwindow-26.16 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 0 0 } -cleanup { deleteWindows } -result {} test panedwindow-26.17 {PanedWindowIdentifyCoords, padding is included} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 0 20 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.18 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 0 22 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.19 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 0 24 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.20 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 0 26 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.21 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify -1 26 } -cleanup { deleteWindows } -result {} test panedwindow-26.22 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 100 26 } -cleanup { deleteWindows } -result {} test panedwindow-26.23 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -showhandle 1 -handlepad 5 \ -handlesize 6 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 4 22 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.24 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -showhandle 1 -handlepad 5 \ -handlesize 6 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 5 22 } -cleanup { deleteWindows } -result {0 handle} test panedwindow-26.25 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -showhandle 1 -handlepad 5 \ -handlesize 8 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 5 20 } -cleanup { deleteWindows } -result {0 handle} test panedwindow-26.26 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -bd 0 -sashwidth 2 -sashpad 2 -showhandle 1 -handlepad 5 \ -handlesize 8 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] .p identify 0 20 } -cleanup { deleteWindows } -result {0 sash} test panedwindow-26.27 {PanedWindowIdentifyCoords} -setup { deleteWindows } -body { panedwindow .p -showhandle false -bd 0 -sashwidth 2 -sashpad 2 -orient vertical .p add [frame .f -bg red -width 20 -height 20] \ [frame .f2 -bg blue -width 20 -height 20] \ [frame .f3 -bg green -width 20 -height 20] .p identify 0 48 } -cleanup { deleteWindows } -result {1 sash} test panedwindow-27.1 {destroy the window cleanly on error [Bug #616589]} -setup { deleteWindows } -body { panedwindow .p -bogusopt bogus } -cleanup { deleteWindows } -returnCodes error -result {unknown option "-bogusopt"} test panedwindow-27.2 {destroy the window cleanly on rename [Bug #616589]} -setup { deleteWindows } -body { destroy .p panedwindow .p rename .p {} winfo exists .p } -cleanup { deleteWindows } -result 0 test panedwindow-28.1 {resizing width} -setup { deleteWindows } -body { panedwindow .p -bd 5 frame .f1 -width 100 -height 50 -bg blue frame .f2 -width 100 -height 50 -bg red .p add .f1 -sticky news .p add .f2 -sticky news |
︙ | ︙ | |||
5484 5485 5486 5487 5488 5489 5490 | update set b "$a [winfo width .f2]" } -cleanup { deleteWindows } -result {100 110} test panedwindow-28.2 {resizing height} -setup { | | | 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 | update set b "$a [winfo width .f2]" } -cleanup { deleteWindows } -result {100 110} test panedwindow-28.2 {resizing height} -setup { deleteWindows } -body { panedwindow .p -orient vertical -bd 5 frame .f1 -width 50 -height 100 -bg blue frame .f2 -width 50 -height 100 -bg red .p add .f1 -sticky news .p add .f2 -sticky news |
︙ | ︙ | |||
5510 5511 5512 5513 5514 5515 5516 | deleteWindows } -result {100 110} test panedwindow-29.1 {display on depths other than the default one} -constraints { pseudocolor8 haveTruecolor24 } -setup { | | | | | | | | | | | | | | | | | | 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 | deleteWindows } -result {100 110} test panedwindow-29.1 {display on depths other than the default one} -constraints { pseudocolor8 haveTruecolor24 } -setup { deleteWindows } -body { toplevel .t -visual {truecolor 24} pack [panedwindow .t.p] .t.p add [frame .t.p.f1] [frame .t.p.f2] update # If we got here, we didn't crash and that's good } -cleanup { deleteWindows } -result {} test panedwindow-29.2 {display on depths other than the default one} -constraints { pseudocolor8 haveTruecolor24 } -setup { deleteWindows } -body { toplevel .t -visual {pseudocolor 8} pack [frame .t.f -visual {truecolor 24}] pack [panedwindow .t.f.p] .t.f.p add [frame .t.f.p.f1 -width 5] [frame .t.f.p.f2 -width 5] update .t.f.p proxy place 1 1 update .t.f.p proxy forget update # If we got here, we didn't crash and that's good } -cleanup { deleteWindows } -result {} # cleanup cleanupTests return |
Changes to tests/pkgconfig.test.
1 2 3 4 5 6 7 8 9 | # -*- tcl -*- # Commands covered: pkgconfig # # This file contains a collection of tests for one or more of the Tk # built-in commands. Sourcing this file into Tk runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1991-1993 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | < < | | | > | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # -*- tcl -*- # Commands covered: pkgconfig # # This file contains a collection of tests for one or more of the Tk # built-in commands. Sourcing this file into Tk runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1991-1993 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 2017 Stuart Cassoff <[email protected]> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands test pkgconfig-1.1 {query keys} -constraints {nonwin} -body { lsort [::tk::pkgconfig list] } -match glob -result [list \ *bindir,install bindir,runtime *demodir,install \ demodir,runtime*docdir,install docdir,runtime fontsystem \ includedir,install includedir,runtime \ libdir,install libdir,runtime*\ scriptdir,install scriptdir,runtime*\ ] test pkgconfig-1.2 {query keys multiple times} { string compare [::tk::pkgconfig list] [::tk::pkgconfig list] } 0 test pkgconfig-1.3 {query value multiple times} { string compare \ [::tk::pkgconfig get fontsystem] \ [::tk::pkgconfig get fontsystem] } 0 test pkgconfig-2.0 {error: missing subcommand} { catch {::tk::pkgconfig} msg set msg } {wrong # args: should be "::tk::pkgconfig subcommand ?arg?"} |
︙ | ︙ |
Changes to tests/place.test.
1 2 3 4 | # This file is a Tcl script to test out the "place" command. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1995 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # This file is a Tcl script to test out the "place" command. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # XXX - This test file is woefully incomplete. At present, only a # few of the features are tested. # Widgets used in tests 1.* - 8.* toplevel .t -width 300 -height 200 -bd 0 |
︙ | ︙ | |||
75 76 77 78 79 80 81 | update winfo height .t.f2 } -result 60 test place-3.1 {ConfigureContent procedure, -relheight option} -body { place .t.f2 -relheight abcd | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | update winfo height .t.f2 } -result 60 test place-3.1 {ConfigureContent procedure, -relheight option} -body { place .t.f2 -relheight abcd } -returnCodes error -result {expected floating-point number or "" but got "abcd"} test place-3.2 {ConfigureContent procedure, -relheight option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relheight .5 update winfo height .t.f2 } -result 40 |
︙ | ︙ | |||
140 141 142 143 144 145 146 | place .t.f1 -in .t.f2 place .t.f2 -in .t.f3 place .t.f3 -in .t.f1 } -returnCodes error -result {can't put ".t.f3" inside ".t.f1": would cause management loop} test place-5.1 {ConfigureContent procedure, -relwidth option} -body { place .t.f2 -relwidth abcd | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | place .t.f1 -in .t.f2 place .t.f2 -in .t.f3 place .t.f3 -in .t.f1 } -returnCodes error -result {can't put ".t.f3" inside ".t.f1": would cause management loop} test place-5.1 {ConfigureContent procedure, -relwidth option} -body { place .t.f2 -relwidth abcd } -returnCodes error -result {expected floating-point number or "" but got "abcd"} test place-5.2 {ConfigureContent procedure, -relwidth option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relwidth .5 update winfo width .t.f2 } -result 75 |
︙ | ︙ | |||
257 258 259 260 261 262 263 | } -body { place .t.f2 -in .t.f -width 10 -relwidth .4 -height -4 -relheight .5 place .t.f2 -width {} -relwidth {} -height {} -relheight {} update list [winfo width .t.f2] [winfo height .t.f2] } -result {30 60} | | | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | } -body { place .t.f2 -in .t.f -width 10 -relwidth .4 -height -4 -relheight .5 place .t.f2 -width {} -relwidth {} -height {} -relheight {} update list [winfo width .t.f2] [winfo height .t.f2] } -result {30 60} if {[tk windowingsystem] ne "aqua"} { proc placeUpdate {} { update } } else { proc placeUpdate {} { } } |
︙ | ︙ | |||
412 413 414 415 416 417 418 | test place-10.3 {ConfigureContent} -setup { destroy .foo } -body { frame .foo place .foo -bordermode j } -cleanup { destroy .foo | | | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | test place-10.3 {ConfigureContent} -setup { destroy .foo } -body { frame .foo place .foo -bordermode j } -cleanup { destroy .foo } -returnCodes error -result {bad bordermode "j": must be inside, ignore, or outside} test place-10.4 {ConfigureContent} -setup { destroy .foo } -body { frame .foo place configure .foo -x 0 -y } -cleanup { destroy .foo |
︙ | ︙ | |||
503 504 505 506 507 508 509 | return $res } } -body { # Test all manners of forgetting content frame .f frame .f.f stress { | | | | | > | | | | | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | return $res } } -body { # Test all manners of forgetting content frame .f frame .f.f stress { place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}] place forget .f.f } { place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}] pack .f.f update; # Needed because of TIP #518, handle <<NoManagedChild>> event. } { place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}] destroy .f frame .f frame .f.f } } -cleanup { destroy .f rename getbytes {} rename stress {} } -result {0 0 0} |
︙ | ︙ |
Changes to tests/raise.test.
1 2 3 4 5 6 7 | # This file is a Tcl script to test out Tk's "raise" and # "lower" commands, plus associated code to manage window # stacking order. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1993-1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # This file is a Tcl script to test out Tk's "raise" and # "lower" commands, plus associated code to manage window # stacking order. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1993-1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test # Procedure to create a bunch of overlapping windows, which should # make it easy to detect differences in order. proc raise_setup {} { foreach i [winfo child .raise] { destroy $i } update idletasks foreach i {a b c d e} { label .raise.$i -text $i -relief raised -bd 2 } place .raise.a -x 20 -y 60 -width 60 -height 80 place .raise.b -x 60 -y 60 -width 60 -height 80 place .raise.c -x 100 -y 60 -width 60 -height 80 place .raise.d -x 40 -y 20 -width 100 -height 60 |
︙ | ︙ |
Changes to tests/safe.test.
1 2 3 4 5 | # This file is a Tcl script to test the Safe Tk facility. It is organized in # the standard fashion for Tk tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test the Safe Tk facility. It is organized in # the standard fashion for Tk tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/safePrimarySelection.test.
1 2 3 4 5 | # This file is a Tcl script to test entry widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test entry widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
59 60 61 62 63 64 65 | interp create $name $name eval [list set argv [list -name $name]] catch {{*}$TkLoadCmd $name} } set ::_test_tmp::script { | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | interp create $name $name eval [list set argv [list -name $name]] catch {{*}$TkLoadCmd $name} } set ::_test_tmp::script { package require tk namespace eval ::_test_tmp {} proc ::_test_tmp::getPrimarySelection {} { if {[catch {::tk::GetSelection . PRIMARY} sel]} { set sel {} } return $sel |
︙ | ︙ |
Changes to tests/scale.test.
1 2 3 4 5 | # This file is a Tcl script to test out the "scale" command # of Tk. It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the "scale" command # of Tk. It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 | } msg] $msg } -cleanup { unset ::error rename bgerror {} destroy .s } -result {0 {}} test scale-19 {Bug [3529885fff] - Click in through goes in wrong direction} \ -setup { catch {destroy .s} catch {destroy .s1 .s2 .s3 .s4} unset -nocomplain x1 x2 x3 x4 x y scale .s1 -from 0 -to 100 -resolution 1 -variable x1 -digits 4 -orient horizontal -length 100 | > > > > > > > > > > > > > > > > > > > | 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | } msg] $msg } -cleanup { unset ::error rename bgerror {} destroy .s } -result {0 {}} test scale-18.4 {Bug [415415ffff] - Long callback: One click -> Several steps} -setup { catch {destroy .s} scale .s -from 0 -to 5 -resolution 1 -variable x1 -orient horizontal -length 100 \ -command longCmd -repeatdelay 300 pack .s update proc longCmd {unused} { after 500 ; # larger than -repeatdelay } } -body { foreach {x y} [.s coord 50] {} event generate .s <Button-1> -x $x -y $y update event generate .s <ButtonRelease-1> -x $x -y $y update set x1 } -cleanup { destroy .s } -result {1} test scale-19 {Bug [3529885fff] - Click in through goes in wrong direction} \ -setup { catch {destroy .s} catch {destroy .s1 .s2 .s3 .s4} unset -nocomplain x1 x2 x3 x4 x y scale .s1 -from 0 -to 100 -resolution 1 -variable x1 -digits 4 -orient horizontal -length 100 |
︙ | ︙ | |||
1469 1470 1471 1472 1473 1474 1475 | set res [list [.s get] $commandedVar] } -cleanup { destroy .s } -result {10 -1} test scale-20.4 {Bug [2262543fff] - Scale widget unexpectedly fires command callback, case 4} -setup { catch {destroy .s} set res {} | < < > > > < > > > > > | 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 | set res [list [.s get] $commandedVar] } -cleanup { destroy .s } -result {10 -1} test scale-20.4 {Bug [2262543fff] - Scale widget unexpectedly fires command callback, case 4} -setup { catch {destroy .s} set res {} } -body { scale .s -from 1 -to 50 -command {set commandedVar} pack .s update idletasks .s set 10 set timeout [after 500 {set $commandedVar "timeout"}] set commandedVar -1 vwait commandedVar ; # -command callback shall fire set res [list [.s get] $commandedVar] } -cleanup { after cancel $timeout destroy .s } -result {10 10} test scale-20.5 {Bug [2262543fff] - Scale widget unexpectedly fires command callback, case 5} -setup { catch {destroy .s} set res {} set commandedVar -1 } -body { scale .s -from 1 -to 50 pack .s update idletasks .s set 10 .s configure -command {set commandedVar} update ; # -command callback shall NOT fire set res [list [.s get] $commandedVar] } -cleanup { destroy .s } -result {10 -1} test scale-20.6 {Bug [2262543fff] - Scale widget unexpectedly fires command callback, case 6} -setup { catch {destroy .s} set res {} set commandedVar -1 } -body { scale .s -from 1 -to 50 pack .s update idletasks .s configure -command {set commandedVar} .s set 10 set timeout [after 500 {set $commandedVar "timeout"}] vwait commandedVar ; # -command callback shall fire set res [list [.s get] $commandedVar] } -cleanup { destroy .s after cancel $timeout } -result {10 10} test scale-20.7 {Bug [2262543fff] - Scale widget unexpectedly fires command callback, case 7} -setup { catch {destroy .s} set res {} set commandedVar -1 } -body { scale .s -from 1 -to 50 -command {set commandedVar} pack .s update idletasks .s set 10 set timeout [after 500 {set $commandedVar "timeout"}] vwait commandedVar ; # -command callback shall fire set res [list [.s get] $commandedVar] } -cleanup { destroy .s after cancel $timeout } -result {10 10} test scale-20.8 {Bug [2262543fff] - Scale widget unexpectedly fires command callback, case 8} -setup { catch {destroy .s} set res {} set commandedVar -1 set scaleVar 7 } -body { scale .s -from 1 -to 50 -variable scaleVar -command {set commandedVar} pack .s update idletasks .s set 10 set timeout [after 500 {set $commandedVar "timeout"}] vwait commandedVar ; # -command callback shall fire set res [list [.s get] $commandedVar] } -cleanup { destroy .s after cancel $timeout |
︙ | ︙ |
Changes to tests/scrollbar.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out scrollbar widgets and # the "scrollbar" command of Tk. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # This file is a Tcl script to test out scrollbar widgets and # the "scrollbar" command of Tk. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] proc scroll args { global scrollInfo set scrollInfo $args } proc getTroughSize {w} { |
︙ | ︙ | |||
314 315 316 317 318 319 320 | test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.t.s fraction 100 0] } 0 destroy .t test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} { list [catch {.s get a} msg] $msg } {1 {wrong # args: should be ".s get"}} | | | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.t.s fraction 100 0] } 0 destroy .t test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} { list [catch {.s get a} msg] $msg } {1 {wrong # args: should be ".s get"}} test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} deprecated { .s set 100 10 13 14 .s get } {100 10 13 14} test scrollbar-3.45 {ScrollbarWidgetCmd procedure, "get" option} { .s set 0.6 0.8 set result {} foreach element [.s get] { |
︙ | ︙ | |||
399 400 401 402 403 404 405 | .s set .4 .3 set result {} foreach element [.s get] { lappend result [format %.1f $element] } set result } {0.4 0.4} | | | | | | | | | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | .s set .4 .3 set result {} foreach element [.s get] { lappend result [format %.1f $element] } set result } {0.4 0.4} test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} deprecated { list [catch {.s set abc def ghi jkl} msg] $msg } {1 {expected integer but got "abc"}} test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} deprecated { list [catch {.s set 1 def ghi jkl} msg] $msg } {1 {expected integer but got "def"}} test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} deprecated { list [catch {.s set 1 2 ghi jkl} msg] $msg } {1 {expected integer but got "ghi"}} test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} deprecated { list [catch {.s set 1 2 3 jkl} msg] $msg } {1 {expected integer but got "jkl"}} test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} deprecated { .s set -10 50 20 30 .s get } {0 50 0 0} test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} deprecated { .s set 100 -10 20 30 .s get } {100 0 20 30} test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} deprecated { .s set 100 50 30 20 .s get } {100 50 30 30} test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3} msg] $msg } {1 {wrong # args: should be ".s set firstFraction lastFraction"}} test scrollbar-3.72 {ScrollbarWidgetCmd procedure, "set" option} { |
︙ | ︙ | |||
698 699 700 701 702 703 704 | update focus -force .s event generate .s <MouseWheel> -delta -120 after 200 {set eventprocessed 1} ; vwait eventprocessed .t index @0,0 } -cleanup { destroy .t .s | | | | | | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | update focus -force .s event generate .s <MouseWheel> -delta -120 after 200 {set eventprocessed 1} ; vwait eventprocessed .t index @0,0 } -cleanup { destroy .t .s } -result {4.0} test scrollbar-10.2 {<MouseWheel> event on scrollbar} -setup { destroy .t .s } -body { pack [text .t -xscrollcommand {.s set} -wrap none] -side top for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top update focus -force .s event generate .s <Shift-MouseWheel> -delta -120 after 200 {set eventprocessed 1} ; vwait eventprocessed .t index @0,0 } -cleanup { destroy .t .s } -result {1.3} test scrollbar-10.3 {<MouseWheel> event on horizontal scrollbar} -setup { destroy .t .s } -body { pack [text .t -xscrollcommand {.s set} -wrap none] -side top for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top update focus -force .s event generate .s <MouseWheel> -delta -120 after 200 {set eventprocessed 1} ; vwait eventprocessed .t index @0,0 } -cleanup { destroy .t .s } -result {1.3} test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body { proc destroy_scrollbar {} { if {[winfo exists .top.s]} { destroy .top.s } } |
︙ | ︙ |
Changes to tests/select.test.
1 2 3 4 5 | # This file is a Tcl script to test out Tk's selection management code, # especially the "selection" command. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1994 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # This file is a Tcl script to test out Tk's selection management code, # especially the "selection" command. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. # # Note: Multiple display selection handling will only be tested if the # environment variable TK_ALT_DISPLAY is set to an alternate display. # package require tcltest 2.2 namespace import ::tcltest::* namespace import ::tk::test:loadTkCommand eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint cliboardManagerPresent 0 if {![catch {selection get -selection CLIPBOARD_MANAGER -type TARGETS}]} { if {"SAVE_TARGETS" in [selection get -selection CLIPBOARD_MANAGER -type TARGETS]} { testConstraint cliboardManagerPresent 1 } } testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] global longValue selValue selInfo set selValue {} set selInfo {} proc handler {type offset count} { |
︙ | ︙ |
Changes to tests/send.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the "send" command and the # other procedures in the file tkSend.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file is a Tcl script to test out the "send" command and the # other procedures in the file tkSend.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 2001 ActiveState Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint xhost [llength [auto_execok xhost]] testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # Compute a script that will load Tk into a child interpreter. foreach pkg [info loaded] { if {[lindex $pkg 1] == "Tk"} { set loadTk "load $pkg" break |
︙ | ︙ | |||
293 294 295 296 297 298 299 | } {1 {couldn't open "bogus_file_name": no such file or directory} {couldn't open "bogus_file_name": no such file or directory while executing "open bogus_file_name" invoked from within "if 1 {open bogus_file_name}" invoked from within "send t_s_1 {if 1 {open bogus_file_name}}"} {POSIX ENOENT {no such file or directory}}} | | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | } {1 {couldn't open "bogus_file_name": no such file or directory} {couldn't open "bogus_file_name": no such file or directory while executing "open bogus_file_name" invoked from within "if 1 {open bogus_file_name}" invoked from within "send t_s_1 {if 1 {open bogus_file_name}}"} {POSIX ENOENT {no such file or directory}}} test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend failsOnUbuntu failsOnXQuarz} { testsend prop root InterpRegistry "10234 bogus\n" set result [list [catch {send bogus bogus command} msg] $msg] winfo interps tk appname tktest set result } {1 {no application named "bogus"}} |
︙ | ︙ | |||
519 520 521 522 523 524 525 | setupbg dobg {tk appname t_s_3} set x [list [catch {send t_s_3 exit} msg] $msg] cleanupbg set x } {1 {target application died}} | | | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | setupbg dobg {tk appname t_s_3} set x [list [catch {send t_s_3 exit} msg] $msg] cleanupbg set x } {1 {target application died}} test send-11.1 {AppendPropCarefully and AppendErrorProc procedures} -constraints {secureserver testsend} -body { testsend prop root InterpRegistry "0x21447 dummy\n" send dummy foo } -returnCodes 1 -match regexp -result {^(target application died|no application named "dummy")$} test send-11.2 {AppendPropCarefully and AppendErrorProc procedures} {secureserver testsend} { testsend prop comm Comm "c\n-r0x123 44\n-n tktest\n-s concat a b c\n" update } {} winfo interps tk appname tktest |
︙ | ︙ |
Changes to tests/spinbox.test.
1 2 3 4 5 | # This file is a Tcl script to test spinbox widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file is a Tcl script to test spinbox widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] # For xscrollcommand set scrollInfo {} proc scroll args { global scrollInfo set scrollInfo $args |
︙ | ︙ | |||
915 916 917 918 919 920 921 | update } -body { .e configure -values {bad {}list} } -cleanup { destroy .e } -returnCodes {error} -result {list element in braces followed by "list" instead of space} | | | | | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 | update } -body { .e configure -values {bad {}list} } -cleanup { destroy .e } -returnCodes {error} -result {list element in braces followed by "list" instead of space} test spinbox-1.80 {configuration option: "validatecommand"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken pack .e update } -body { .e configure -validatecommand "a command" .e cget -validatecommand } -cleanup { destroy .e } -result {a command} test spinbox-1.81 {configuration option: "width"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken |
︙ | ︙ | |||
1448 1449 1450 1451 1452 1453 1454 | spinbox .e pack .e update } -body { .e scan foobar 20 } -cleanup { destroy .e | | | 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 | spinbox .e pack .e update } -body { .e scan foobar 20 } -cleanup { destroy .e } -returnCodes error -result {bad scan option "foobar": must be dragto or mark} test spinbox-3.45 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e update } -body { .e scan mark 20.1 } -cleanup { |
︙ | ︙ | |||
1871 1872 1873 1874 1875 1876 1877 | pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 0 update | | | 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 | pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 0 update .e xview {} .e index @0 } -cleanup { destroy .e } -result 0 test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e |
︙ | ︙ | |||
2013 2014 2015 2016 2017 2018 2019 | test spinbox-5.7 {ConfigureSpinbox procedure} -setup { spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -width 4 -xscrollcommand scroll .e insert end "01234567890" | | | | < | | 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 | test spinbox-5.7 {ConfigureSpinbox procedure} -setup { spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -width 4 -xscrollcommand scroll .e insert end "01234567890" update set scrollInfo wrong .e configure -width 5 update format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.000000 0.454545} test spinbox-5.8 {ConfigureSpinbox procedure} -constraints { fonts } -setup { spinbox .e -borderwidth 2 -highlightthickness 2 pack .e } -body { |
︙ | ︙ | |||
2220 2221 2222 2223 2224 2225 2226 | unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde | | | | < | | | < | 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 | unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde update set scrollInfo wrong .e insert 2 XXX update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abXXXcde abXXXcde {0.000000 1.000000}} test spinbox-7.2 {InsertChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde update set scrollInfo wrong .e insert 500 XXX update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abcdeXXX abcdeXXX {0.000000 1.000000}} test spinbox-7.3 {InsertChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789 .e select from 2 |
︙ | ︙ | |||
2373 2374 2375 2376 2377 2378 2379 | unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde | | | | < | | | | < | | | < | 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 | unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde update set scrollInfo wrong .e delete 2 4 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abe abe {0.000000 1.000000}} test spinbox-8.2 {DeleteChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde update set scrollInfo wrong .e delete {} 2 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {cde cde {0.000000 1.000000}} test spinbox-8.3 {DeleteChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde update set scrollInfo wrong .e delete 3 1000 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abc abc {0.000000 1.000000}} test spinbox-8.4 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde |
︙ | ︙ | |||
3121 3122 3123 3124 3125 3126 3127 | test spinbox-13.23 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update | | | 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 | test spinbox-13.23 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index {} } -cleanup { destroy .e } -result 0 test spinbox-13.24 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e |
︙ | ︙ | |||
3209 3210 3211 3212 3213 3214 3215 | destroy .e } -result {0.000000 1.000000} test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body { spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e | | | | < | | | < | | | < | > | | 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 | destroy .e } -result {0.000000 1.000000} test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body { spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e update set scrollInfo wrong .e delete 0 end .e insert 0 123 update format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.000000 1.000000} test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body { spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e .e insert 0 0123456789abcdef update set scrollInfo wrong .e xview 3 update format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.187500 0.812500} test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body { spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e update set scrollInfo wrong .e insert 0 abcdefghijklmnopqrs .e xview update format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.000000 0.526316} test spinbox-17.4 {SpinboxUpdateScrollbar procedure} -setup { proc bgerror msg { global x set x $msg } } -body { spinbox .e -width 5 pack .e update set scrollInfo wrong .e configure -xscrollcommand thisisnotacommand update list $x $errorInfo } -cleanup { destroy .e rename bgerror {} } -result {{invalid command name "thisisnotacommand"} {invalid command name "thisisnotacommand" while executing "thisisnotacommand 0.0 1.0" |
︙ | ︙ |
Added tests/systray.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | # This file is a Tcl script to test systray and sysnotify features in Tk. # It is organized in the standard fashion for Tcl tests. # # Copyright © 2020 Kevin Walzer/WordTech Communications LLC. # Copyright © 2020 Francois Vogel. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands test systray-1 {systray icon creation, all options} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -text "Systray sample" \ -button1 {puts "button 1 click"} -button3 {puts "button 3 click"} } -cleanup { tk systray destroy image delete _book } -result {} test systray-2 {systray create, argument checking} -body { tk systray create } -returnCodes {error} -result {missing required option "-image"} test systray-3 {systray create, argument checking} -body { tk systray create -text Hell } -returnCodes {error} -result {missing required option "-image"} test systray-4 {systray create, argument checking} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -gorp invalidOption } -returnCodes {error} -result {unknown option "-gorp": must be -image, -text, -button1 or -button3} test systray-5 {systray icon creation, only required option present} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book } -cleanup { tk systray destroy image delete _book } -result {} test systray-6 {systray icon creation, some options present} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -button3 {puts b3} } -cleanup { tk systray destroy image delete _book } -result {} test systray-7 {systray icon, all parameters modification, introspection} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== image create photo _page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7 } -body { tk systray create -image _book -text "Systray icon text" tk systray configure -image _page tk systray configure -text "Another text for my icon" tk systray configure -button1 {set a 1} tk systray configure -button3 {set b 2} tk systray configure } -cleanup { tk systray destroy image delete _book image delete _page } -result {-image _page -text {Another text for my icon} -button1 {set a 1} -button3 {set b 2}} test systray-8 {systray icon, single parameter modification, introspection} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -text "Systray icon text" -button1 {puts b1} tk systray configure -button1 {set a 1} tk systray configure -button1 } -cleanup { tk systray destroy image delete _book } -result {set a 1} test systray-9 {systray icon, several parameters modification at once, introspection} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -text "Systray icon text" -button1 {puts b1} tk systray configure -button1 {set a 1} -text NewText list [tk systray configure -button1] [tk systray configure -text] } -cleanup { tk systray destroy image delete _book } -result {{set a 1} NewText} test systray-10 {configure non-existing systray icon} -setup { catch {tk systray destroy} } -body { tk systray configure } -returnCodes {error} -result {systray not created} test systray-11 {destroy non-existing systray icon} -setup { catch {tk systray destroy} } -body { tk systray destroy } -returnCodes {error} -result {systray not created} test systray-12 {destroy systray icon works} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book tk systray destroy tk systray create -image _book } -result {} test systray-13 {systray icon creation, attempt to create more than one in an interp} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book tk systray create -image _book } -cleanup { tk systray destroy image delete _book } -returnCodes {error} -result {only one system tray icon supported per interpeter} test systray-14 {systray icon creation, create one per interp, visibiliy checks} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -text "first interp" interp create second # load Tk into the 'second' interp foreach pkg [info loaded] { if {[lindex $pkg 1] == "Tk"} { set loadTk "load $pkg" break } } eval $loadTk second # create the icon in the 'second' interp second eval { # should trigger an error: image _book unknown in 'second' interp' # image from higer interp should not be visible by 'tk systray' tk systray create -image _book -text "second interp" } } -cleanup { tk systray destroy image delete _book interp delete second } -returnCodes {error} -result {image "_book" doesn't exist} test systray-15 {systray icon creation, create one per interp} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -text "first interp" interp create second # load Tk into the 'second' interp foreach pkg [info loaded] { if {[lindex $pkg 1] == "Tk"} { set loadTk "load $pkg" break } } eval $loadTk second # create the icon in the 'second' interp second eval { image create photo _page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7 tk systray create -image _page -text "second interp" } } -cleanup { second eval { tk systray destroy image delete _page } interp delete second tk systray destroy image delete _book } -result {} test systray-16 {systray icon creation from a bitmap, on Linux and macOS only} -constraints { nonwin } -setup { set data1 { #define foo_width 16 #define foo_height 16 static unsigned char foo_bits[] = { 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff, 0xff }; } image create bitmap cross -data $data1 } -body { tk systray create -image cross } -cleanup { tk systray destroy image delete cross } -result {} test sysnotify-1 {system notification popup} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== tk systray create -image _book -text "Systray sample" } -body { tk sysnotify {Alert} {This is an alert} } -cleanup { tk systray destroy image delete _book } -result {} test sysnotify-2.1 {system notification stems from a systray icon on Windows} -constraints { win } -setup { catch {tk systray destroy} } -body { tk sysnotify {Alert} {This is an alert} } -returnCodes {error} -result {must create a system tray icon with the "tk systray" command first} test sysnotify-2.2 {system notification is not linked to any systray icon on X11 or aqua} -constraints { nonwin } -setup { catch {tk systray destroy} } -body { tk sysnotify {Alert} {This is an alert} } -result {} cleanupTests |
Changes to tests/text.test.
1 2 3 4 5 | # This file is a Tcl script to test the code in the file tkText.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test the code in the file tkText.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ | |||
2248 2249 2250 2251 2252 2253 2254 | !@#$% Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 | !@#$% Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displayindices 2.0 3.0 } -cleanup { destroy .t } -result 3 |
︙ | ︙ | |||
2271 2272 2273 2274 2275 2276 2277 | !@#$% Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 | !@#$% Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displayindices 2.2 3.0 } -cleanup { destroy .t } -result 1 |
︙ | ︙ | |||
2296 2297 2298 2299 2300 2301 2302 | .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 .t mark set a 2.2 | | | 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 | .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 .t mark set a 2.2 # Creating this window here means that the elided text # now starts at 2.3, but 'a' is automatically moved to 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displayindices a 3.0 } -cleanup { destroy .t } -result 0 |
︙ | ︙ | |||
2320 2321 2322 2323 2324 2325 2326 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displayindices 2.0 4.2 } -cleanup { destroy .t } -result 6 |
︙ | ︙ | |||
2344 2345 2346 2347 2348 2349 2350 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displaychars 2.0 3.0 } -cleanup { destroy .t } -result 2 |
︙ | ︙ | |||
2368 2369 2370 2371 2372 2373 2374 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displaychars 2.2 3.0 } -cleanup { destroy .t } -result 1 |
︙ | ︙ | |||
2393 2394 2395 2396 2397 2398 2399 | .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 .t mark set a 2.2 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 | .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 .t mark set a 2.2 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3, but 'a' is automatically moved to 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displaychars a 3.0 } -cleanup { destroy .t } -result 0 |
︙ | ︙ | |||
2417 2418 2419 2420 2421 2422 2423 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displaychars 2.0 4.2 } -cleanup { destroy .t } -result 5 |
︙ | ︙ | |||
2441 2442 2443 2444 2445 2446 2447 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displaychars 2.0 4.2 list [.t count -indices 2.2 3.0] [.t count 2.2 3.0] } -cleanup { destroy .t |
︙ | ︙ | |||
2467 2468 2469 2470 2471 2472 2473 | .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 .t mark set a 2.2 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 | .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 .t mark set a 2.2 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3, but 'a' is automatically moved to 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 list [.t count -indices a 3.0] [.t count a 3.0] } -cleanup { destroy .t } -result {9 9} |
︙ | ︙ | |||
2491 2492 2493 2494 2495 2496 2497 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displaychars 2.0 4.2 .t count -indices 2.0 4.2 } -cleanup { destroy .t |
︙ | ︙ | |||
2516 2517 2518 2519 2520 2521 2522 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displaychars 2.0 4.2 .t count -chars 2.2 3.0 } -cleanup { destroy .t |
︙ | ︙ | |||
2542 2543 2544 2545 2546 2547 2548 | .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 .t mark set a 2.2 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 | .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 .t mark set a 2.2 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3, but 'a' is automatically moved to 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -chars a 3.0 } -cleanup { destroy .t } -result 9 |
︙ | ︙ | |||
2566 2567 2568 2569 2570 2571 2572 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 | | | 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 | Line 7" .t tag configure elide -elide 1 .t tag add elide 2.2 3.4 .t tag add elide 4.0 4.1 # Create one visible and one invisible window frame .t.w1 frame .t.w2 # Creating this window here means that the elided text # now starts at 2.3 .t window create 2.1 -window .t.w1 .t window create 3.1 -window .t.w2 .t count -displaychars 2.0 4.2 .t count -chars 2.0 4.2 } -cleanup { destroy .t |
︙ | ︙ | |||
7488 7489 7490 7491 7492 7493 7494 | .t configure -startline 5 .pt configure -startline 3 # the following delete shall not crash # (it did before fixing bug 1630262) .pt delete 2.0 3.0 # moreover -startline shall be correct # (was wrong before fixing bug 1630262) | | | | 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 | .t configure -startline 5 .pt configure -startline 3 # the following delete shall not crash # (it did before fixing bug 1630262) .pt delete 2.0 3.0 # moreover -startline shall be correct # (was wrong before fixing bug 1630262) lappend res [.t cget -start] [.pt cget -start] [.t get @0,0 "@0,0 lineend"] } -cleanup { destroy .pt } -result {4 3 {Line 5}} test text-32.4 {peer widget -start, -endline and deletion (bug 1630262)} -setup { destroy .t .pt set res {} } -body { text .t .t peer create .pt |
︙ | ︙ |
Changes to tests/textBTree.test.
1 2 3 4 5 6 7 | # This file is a Tcl script to test out the B-tree facilities of # Tk's text widget (the contents of the file "tkTextBTree.c". There are # several file with additional tests for other features of text widgets. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # This file is a Tcl script to test out the B-tree facilities of # Tk's text widget (the contents of the file "tkTextBTree.c". There are # several file with additional tests for other features of text widgets. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
253 254 255 256 257 258 259 260 261 262 263 264 265 266 | } -result "Line 1\nLine 2\nLine 3\n" test btree-2.21 {deleting with negative range} -body { .t delete 1.0 100000.0 .t insert 1.0 "Line 1\nLine 2\nLine 3" .t delete 3.2 3.2 .t get 1.0 1000000.0 } -result "Line 1\nLine 2\nLine 3\n" test btree-3.1 {inserting with tags} -body { setup .t insert 1.0 XXX list [.t tag ranges x] [.t tag ranges y] } -result {{1.4 1.5 1.8 1.16 2.2 2.6} {1.8 1.9}} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | } -result "Line 1\nLine 2\nLine 3\n" test btree-2.21 {deleting with negative range} -body { .t delete 1.0 100000.0 .t insert 1.0 "Line 1\nLine 2\nLine 3" .t delete 3.2 3.2 .t get 1.0 1000000.0 } -result "Line 1\nLine 2\nLine 3\n" test btree-2.22 {deleting into beginning of elided range} -setup { .t delete 1.0 end } -body { for {set n 1} {$n <= 10} {incr n} { .t insert end "Line $n\n" } .t tag configure Elided -elide 1 .t tag add Elided 6.0 end .t delete 5.0 "5.0 + 8 chars" .t get 4.0 7.0 } -cleanup { .t tag delete Elided .t delete 1.0 end } -result "Line 4\nine 6\nLine 7\n" test btree-2.23 {deleting from within elided range} -body { for {set n 1} {$n <= 10} {incr n} { .t insert end "Line $n\n" } .t tag configure Elided -elide 1 .t tag add Elided 6.0 8.0 .t delete 7.0 9.0 .t get 6.0 8.0 } -cleanup { .t tag delete Elided .t delete 1.0 end } -result "Line 6\nLine 9\n" test btree-2.24 {deleting whole elided range} -body { for {set n 1} {$n <= 10} {incr n} { .t insert end "Line $n\n" } .t tag configure Elided -elide 1 .t tag add Elided 6.0 8.0 .t delete 5.0 9.0 .t get 4.0 6.0 } -cleanup { .t tag delete Elided .t delete 1.0 end } -result "Line 4\nLine 9\n" test btree-2.25 {deleting several elided ranges} -body { for {set n 1} {$n <= 10} {incr n} { .t insert end "Line $n\n" } .t tag configure Elided -elide 1 .t tag add Elided 6.0 6.2 6.4 6.5 7.2 7.6 .t delete 5.0 9.0 .t get 4.0 7.0 } -cleanup { .t tag delete Elided .t delete 1.0 end } -result "Line 4\nLine 9\nLine 10\n" test btree-2.26 {deleting first char of elided range} -body { for {set n 1} {$n <= 10} {incr n} { .t insert end "Line $n\n" } .t tag configure Elided -elide 1 .t tag add Elided 6.0 end .t delete 6.0 6.1 .t get 5.0 7.0 } -cleanup { .t tag delete Elided .t delete 1.0 end } -result "Line 5\nine 6\n" test btree-3.1 {inserting with tags} -body { setup .t insert 1.0 XXX list [.t tag ranges x] [.t tag ranges y] } -result {{1.4 1.5 1.8 1.16 2.2 2.6} {1.8 1.9}} |
︙ | ︙ |
Changes to tests/textDisp.test.
1 2 3 4 5 | # This file is a Tcl script to test the code in the file tkTextDisp.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | < < | < | < < < < | < < < < < < | < < < | | < > > > > > > > > > > > > > > > | < < | | > > < < < < < < < < < < < | < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | # This file is a Tcl script to test the code in the file tkTextDisp.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test # The delay procedure needs to wait long enough for the asynchronous updates # performed by the text widget to run. proc delay {} { update after 100 update } # The procedure below is used as the scrolling command for the text; # it just saves the scrolling information in a variable "scrollInfo". proc scroll args { global scrollInfo set scrollInfo $args } # The procedure below is used to generate errors during scrolling commands. proc scrollError args { error "scrolling error" } # Return 1 if the two given lists are the same, otherwise return the two lists. # This is used to compare a test actual result with a test expected result. proc lequal {res expected} { if {[llength $res] != [llength $expected]} { return [list "Lengths differ" result: $res - expected: $expected] } for {set i 0} {$i < [llength $res]} {incr i} { if {[lindex $res $i] ne [lindex $expected $i]} { return [list result: $res - expected: $expected] } } return 1 } # Create entries in the option database to be sure that geometry options # like border width have selected values. option add *Text.borderWidth 2 ; # tests work with [1-3] option add *Text.highlightThickness 2 ; # tests work with [0-5] option add *Text.padX 1 ; # same padding in x and y, see proc bo; tests work with [0-4] option add *Text.padY 1 ; # same padding in x and y, see proc bo; tests work with [0-4] # The frame .f is needed to make sure that the overall window is always # fairly wide, even if the text window is very narrow. This is needed # because some window managers don't allow the overall width of a window # to get very narrow. catch {destroy .f .t} frame .f -width 100 -height 20 pack .f -side left # On macOS the font "Courier New" has different metrics than "Courier", # and this causes tests 20.1 - 20.5 to fail. So we use "Courier" as the # fixed font for testing on Aqua. if {[tk windowingsystem] eq "aqua"} { set fixedFont {Courier -12} } else { set fixedFont {"Courier New" -12} } set fixedHeight [font metrics $fixedFont -linespace] set fixedWidth [font measure $fixedFont m] set fixedAscent [font metrics $fixedFont -ascent] set bigFont {Helvetica -24} ; # note: not a fixed-width font! set bigHeight [font metrics $bigFont -linespace] set bigAscent [font metrics $bigFont -ascent] set ascentDiff [expr {$bigAscent - $fixedAscent}] set heightDiff [expr {$bigHeight - $fixedHeight}] # On Windows at least, the tests do work with {Courier -10}, {Courier -12} or {Courier -14} as fixedFont. # Warn the user if the actual font size is too different from what was requested. if {[font metrics [font actual $fixedFont] -fixed] != 1} { puts "---> Warning: the font actually used by the tests, which is \"[font actual $fixedFont]\",\ does not seem to be a fixed-width font as expected. If this is really the case, many upcoming\ tests will fail." } if {$fixedHeight < 12 || $fixedHeight > 17} { puts "---> Warning: the font actually used by the tests, which is \"[font actual $fixedFont]\",\ is $fixedHeight pixels height while the tests expect between 12 and 17 (inclusive) pixels.\ Some of the upcoming tests will probably fail." } if {$fixedWidth < 6 || $fixedWidth > 8} { puts "---> Warning: the font actually used by the tests, which is \"[font actual $fixedFont]\",\ is $fixedWidth pixels in width while the tests expect between 6 and 8 (inclusive) pixels.\ Some of the upcoming tests will probably fail." } # Option -width 20 (characters) below is a fundamental assumption of many # upcoming tests when wrapping enters in play # Also -height 10 (lines) is an important assumption text .t -font $fixedFont -width 20 -height 10 -yscrollcommand scroll pack .t -expand 1 -fill both .t tag configure big -font $bigFont .t debug on wm geometry . {} # full border size of the text widget, i.e. first x or y coordinate inside the text widget # warning: -padx is supposed to be the same as -pady (same border size horizontally and # vertically around the widget) proc bo {{w .t}} { return [expr {[$w cget -borderwidth] + [$w cget -highlightthickness] + [$w cget -padx]}] } # x-width of $n chars, fixed width font proc xw {n} { global fixedWidth return [expr {$n * $fixedWidth}] } # x-coordinate of the first pixel of $n-th char (count starts at zero), left justified proc xchar {n {w .t}} { return [expr {[bo $w] + [xw $n]}] } # x-coordinate in widget $w of the first pixel of $n-th char counted from the right, right justified proc xcharr {n {w .t}} { return [expr {[winfo width $w] - [bo $w] - [xw $n]}] } # y-coordinate of the first pixel of $l-th display line (count starts at 1) proc yline {l {w .t}} { global fixedHeight return [expr {[bo $w] + ($l - 1) * $fixedHeight}] } # x-pixels of empty space in widget $w on a line containing $n chars proc xe {n {w .t}} { return [expr {[winfo width $w] - (2 * [bo $w]) - [xw $n]}] } # The statements below reset the main window; it's needed if the window # manager is mwm to make mwm forget about a previous minimum size setting. wm withdraw . wm minsize . 1 1 wm positionfrom . user wm deiconify . update # Some window managers (like olwm under SunOS 4.1.3) misbehave in a way # that tends to march windows off the top and left of the screen. If # this happens, some tests will fail because parts of the window will # not need to be displayed (because they're off-screen). To keep this # from happening, move the window if it's getting near the left or top # edges of the screen. |
︙ | ︙ | |||
187 188 189 190 191 192 193 | catch {destroy .txt} pack [text .txt] # Note that TRAFFIC should have a higher priority than SYSTEM # in terms of the tag effects. .txt tag configure SYSTEM -elide 0 .txt tag configure TRAFFIC -elide 1 .txt insert end "\n" {TRAFFIC SYSTEM} | | | | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | catch {destroy .txt} pack [text .txt] # Note that TRAFFIC should have a higher priority than SYSTEM # in terms of the tag effects. .txt tag configure SYSTEM -elide 0 .txt tag configure TRAFFIC -elide 1 .txt insert end "\n" {TRAFFIC SYSTEM} update destroy .txt } {} test textDisp-0.4 {double tag elide transition} { catch {destroy .txt} pack [text .txt] # Note that TRAFFIC should have a higher priority than SYSTEM # in terms of the tag effects. .txt tag configure SYSTEM -elide 0 .txt tag configure TRAFFIC -elide 1 .txt insert end "\n" {SYSTEM TRAFFIC} # Crash was here. update destroy .txt } {} test textDisp-0.5 {double tag elide transition} { catch {destroy .txt} pack [text .txt] .txt tag configure WELCOME -elide 1 .txt tag configure SYSTEM -elide 0 .txt tag configure TRAFFIC -elide 1 .txt insert end "\n" {SYSTEM TRAFFIC} .txt insert end "\n" WELCOME # Crash was here. update destroy .txt } {} test textDisp-1.1 {GetStyle procedure, priorities and tab stops} { .t delete 1.0 end .t insert 1.0 "x\ty" .t tag delete x y z |
︙ | ︙ | |||
236 237 238 239 240 241 242 | set x [lindex [.t bbox 1.2] 0] .t tag configure z -tabs {} lappend x [lindex [.t bbox 1.2] 0] .t tag configure z -tabs 30 .t tag raise x update idletasks lappend x [lindex [.t bbox 1.2] 0] | | | | | > > | > | | > | | > | | > | > | > > | | > | | > > > | < > | | | | > > | | > > | | > > | | > | | > > > | | > > > | > > | > | | > > > | | > > > | | > > > | | > | > > > > | > > > > | < > | | > > > | | > > | | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | set x [lindex [.t bbox 1.2] 0] .t tag configure z -tabs {} lappend x [lindex [.t bbox 1.2] 0] .t tag configure z -tabs 30 .t tag raise x update idletasks lappend x [lindex [.t bbox 1.2] 0] } [list [expr {[bo]+70}] [expr {[bo]+50}] [expr {[bo]+50}]] .t tag delete x y z test textDisp-1.2 {GetStyle procedure, wrapmode} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcd\nefg hijkl mnop qrstuv wxyz" .t tag configure x -wrap word .t tag configure y -wrap none .t tag raise y update set result [list [.t bbox 2.20]] .t tag add x 2.0 2.1 lappend result [.t bbox 2.20] .t tag add y 1.end 2.2 lappend result [.t bbox 2.20] } [list [list [xchar 0] [yline 3] $fixedWidth $fixedHeight] \ [list [xchar 5] [yline 3] $fixedWidth $fixedHeight] \ {}] .t tag delete x y test textDisp-2.1 {LayoutDLine, basics} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "This is some sample text for testing." list [.t bbox 1.19] [.t bbox 1.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.2 {LayoutDLine, basics} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "This isx some sample text for testing." list [.t bbox 1.19] [.t bbox 1.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.3 {LayoutDLine, basics} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "This isxxx some sample text for testing." list [.t bbox 1.19] [.t bbox 1.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.4 {LayoutDLine, word wrap} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This is some sample text for testing." list [.t bbox 1.19] [.t bbox 1.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.5 {LayoutDLine, word wrap} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This isx some sample text for testing." list [.t bbox 1.13] [.t bbox 1.19] [.t bbox 1.20] [.t bbox 1.21] } [list [list [xchar 13] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 20] [yline 1] 0 $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.6 {LayoutDLine, word wrap} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This isxxx some sample text for testing." list [.t bbox 1.15] [.t bbox 1.16] } [list [list [xchar 15] [yline 1] [xe 15] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.7 {LayoutDLine, marks and tags} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This isxxx some sample text for testing." .t tag add foo 1.4 1.6 .t mark set insert 1.8 list [.t bbox 1.2] [.t bbox 1.5] [.t bbox 1.11] } [list [list [xchar 2] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 5] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 11] [yline 1] $fixedWidth $fixedHeight]] foreach m [.t mark names] { catch {.t mark unset $m} } test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} -setup { scan [wm geom .] %dx%d width height } -body { wm geom . [expr {$width+1}]x$height update .t configure -wrap char .t delete 1.0 end .t insert 1.0 "This isxx some sample text for testing." .t mark set foo 1.20 list [.t bbox 1.19] [.t bbox 1.20] } -cleanup { wm geom . {} update } -result [list [list [xchar 19] [yline 1] [expr {$fixedWidth+1}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.9 {LayoutDLine, marks and tags} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This is a very_very_long_word_that_wraps." list [.t bbox 1.9] [.t bbox 1.10] [.t bbox 1.25] } [list [list [xchar 9] [yline 1] [xe 9] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 15] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.10 {LayoutDLine, marks and tags} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This is a very_very_long_word_that_wraps." .t tag add foo 1.13 .t tag add foo 1.15 .t tag add foo 1.17 .t tag add foo 1.19 list [.t bbox 1.9] [.t bbox 1.10] [.t bbox 1.25] } [list [list [xchar 9] [yline 1] [xe 9] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 15] [yline 2] $fixedWidth $fixedHeight]] test textDisp-2.11 {LayoutDLine, newline width} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a\nbb\nccc\ndddd" list [.t bbox 2.2] [.t bbox 3.3] } [list [list [xchar 2] [yline 2] [xe 2] $fixedHeight] \ [list [xchar 3] [yline 3] [xe 3] $fixedHeight]] test textDisp-2.12 {LayoutDLine, justification} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "\na\nbb\nccc\ndddd" .t tag configure x -justify center .t tag add x 1.0 end .t tag add y 3.0 3.2 list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 4.0] [.t bbox 4.2] } [list [list [expr {[bo]+[xe 0]/2}] [yline 1] [expr {[xe 0]-[xe 0]/2}] $fixedHeight] \ [list [expr {[bo]+[xe 1]/2}] [yline 2] $fixedWidth $fixedHeight] \ [list [expr {[bo]+[xe 3]/2}] [yline 4] $fixedWidth $fixedHeight] \ [list [expr {[bo]+[xe 3]/2+[xw 2]}] [yline 4] $fixedWidth $fixedHeight]] test textDisp-2.13 {LayoutDLine, justification} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "\na\nbb\nccc\ndddd" .t tag configure x -justify right .t tag add x 1.0 end .t tag add y 3.0 3.2 list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 4.0] [.t bbox 4.2] } [list [list [xcharr 0] [yline 1] 0 $fixedHeight] \ [list [xcharr 1] [yline 2] $fixedWidth $fixedHeight] \ [list [xcharr 3] [yline 4] $fixedWidth $fixedHeight] \ [list [xcharr 1] [yline 4] $fixedWidth $fixedHeight]] test textDisp-2.14 {LayoutDLine, justification} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "\na\nbb\nccc\ndddd" .t tag configure x -justify center .t tag add x 2.0 3.1 .t tag configure y -justify right .t tag add y 3.0 4.0 .t tag raise y list [.t bbox 2.0] [.t bbox 3.0] [.t bbox 3.end] [.t bbox 4.0] } [list [list [expr {[bo]+[xe 1]/2}] [yline 2] $fixedWidth $fixedHeight] \ [list [xcharr 2] [yline 3] $fixedWidth $fixedHeight] \ [list [xcharr 0] [yline 3] 0 $fixedHeight] \ [list [xchar 0] [yline 4] $fixedWidth $fixedHeight]] test textDisp-2.15 {LayoutDLine, justification} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "\na\nbb\nccc\ndddd" .t tag configure x -justify center .t tag add x 2.0 3.1 .t tag configure y -justify right .t tag add y 3.0 4.0 .t tag lower y list [.t bbox 2.0] [.t bbox 3.0] [.t bbox 3.end] [.t bbox 4.0] } [list [list [expr {[bo]+[xe 1]/2}] [yline 2] $fixedWidth $fixedHeight] \ [list [expr {[bo]+[xe 2]/2}] [yline 3] $fixedWidth $fixedHeight] \ [list [expr {[bo]+[xe 2]/2+[xw 2]}] [yline 3] [expr {[xe 2]/2}] $fixedHeight] \ [list [xchar 0] [yline 4] $fixedWidth $fixedHeight]] test textDisp-2.16 {LayoutDLine, justification} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines" .t tag configure x -justify center .t tag add x 1.1 1.20 .t tag add x 1.21 1.end list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.41] [.t bbox 2.0] } [list [list [xchar 0] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [expr {[bo]+[xe 4]/2}] [yline 3] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 4] $fixedWidth $fixedHeight]] test textDisp-2.17 {LayoutDLine, justification} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Lots of very long words, enough to force word wrap\nThen\nmore lines" .t tag configure x -justify center .t tag add x 1.18 list [.t bbox 1.0] [.t bbox 1.18] [.t bbox 1.35] [.t bbox 2.0] } [list [list [xchar 0] [yline 1] $fixedWidth $fixedHeight] \ [list [expr {[bo]+[xe 17]/2}] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 3] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 4] $fixedWidth $fixedHeight]] test textDisp-2.18 {LayoutDLine, justification} { .t configure -wrap none .t delete 1.0 end .t insert 1.0 "Lots of long words, enough to extend out of the window\n" .t insert end "Then\nmore lines\nThat are shorter" .t tag configure x -justify center .t tag configure y -justify right .t tag add x 2.0 .t tag add y 3.0 .t xview scroll 5 units list [.t bbox 2.0] [.t bbox 3.0] } [list [list [expr {[bo]+[xe 4]/2-[xw 5]}] [yline 2] $fixedWidth $fixedHeight] \ [list [expr {[xcharr 10]-[xw 5]}] [yline 3] $fixedWidth $fixedHeight]] .t tag delete x .t tag delete y test textDisp-2.19 {LayoutDLine, margins} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines" # margins in pixels depend on the font width for more flexibility set lm1 [expr {3*$fixedWidth}] set lm2 [expr {2*$lm1}] set rm [expr {2*$fixedWidth}] .t tag configure x -lmargin1 $lm1 -lmargin2 $lm2 -rmargin $rm .t tag add x 1.0 end set expected [list [list [expr {[bo]+$lm1}] [yline 1] $fixedWidth $fixedHeight] \ [list [expr {[bo]+$lm1+[xw 12]}] [yline 1] [expr {[xe 12]-$lm1}] $fixedHeight] \ [list [expr {[bo]+$lm2}] [yline 2] $fixedWidth $fixedHeight] \ [list [expr {[bo]+$lm1}] [yline 6] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.0] [.t bbox 1.12] [.t bbox 1.13] [.t bbox 2.0]] $expected } {1} test textDisp-2.20 {LayoutDLine, margins} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines" .t tag configure x -lmargin1 20 -lmargin2 10 -rmargin 3 .t tag configure y -lmargin1 15 -lmargin2 5 -rmargin 0 .t tag raise y .t tag add x 1.0 end .t tag add y 1.13 list [.t bbox 1.0] [.t bbox 1.13] [.t bbox 1.30] [.t bbox 2.0] } [list [list [expr {[bo]+20}] [yline 1] $fixedWidth $fixedHeight] \ [list [expr {[bo]+5}] [yline 2] $fixedWidth $fixedHeight] \ [list [expr {[bo]+10}] [yline 3] $fixedWidth $fixedHeight] \ [list [expr {[bo]+20}] [yline 4] $fixedWidth $fixedHeight]] test textDisp-2.21 {LayoutDLine, margins} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Sample text" .t tag configure x -lmargin1 80 -lmargin2 80 -rmargin 100 .t tag add x 1.0 end list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 1.2] } [list [list [expr {[bo]+80}] [yline 1] [expr {[xe 0]-80}] $fixedHeight] \ [list [expr {[bo]+80}] [yline 2] [expr {[xe 0]-80}] $fixedHeight] \ [list [expr {[bo]+80}] [yline 3] [expr {[xe 0]-80}] $fixedHeight]] .t tag delete x .t tag delete y test textDisp-2.22 {LayoutDLine, spacing options} { .t configure -wrap word .t delete 1.0 end .t tag delete x y .t insert end "Short line\nLine 2 is long enough " .t insert end "to wrap around a couple of times" .t insert end "\nLine 3\nLine 4" set i [.t dlineinfo 1.0] |
︙ | ︙ | |||
462 463 464 465 466 467 468 | set i [.t dlineinfo 2.end] set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}] set i [.t dlineinfo 3.0] set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}] list $b1 $b2 $b3 $b4 } [list 2 7 10 15] .t configure -spacing1 0 -spacing2 0 -spacing3 0 | | | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | set i [.t dlineinfo 2.end] set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}] set i [.t dlineinfo 3.0] set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}] list $b1 $b2 $b3 $b4 } [list 2 7 10 15] .t configure -spacing1 0 -spacing2 0 -spacing3 0 test textDisp-2.23 {LayoutDLine, spacing options} { .t configure -wrap word .t delete 1.0 end .t tag delete x y .t insert end "Short line\nLine 2 is long enough " .t insert end "to wrap around a couple of times" .t insert end "\nLine 3\nLine 4" set i [.t dlineinfo 1.0] |
︙ | ︙ | |||
494 495 496 497 498 499 500 | set i [.t dlineinfo 2.end] set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}] set i [.t dlineinfo 3.0] set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}] list $b1 $b2 $b3 $b4 } [list 1 5 13 16] .t configure -spacing1 0 -spacing2 0 -spacing3 0 | | | | > > | > | | > | > > > | | | | | | | | | | | | | > > > > | | | | | > > > > | | | | | > > > > | | | | > > > | | > > > | | | | | > > > | | | | | | < | > > | < < < < | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | > > > | | | | > | | | | > | | | | > | | | | | | > | | > > | | | | > > > < | | | | | | | | | | | > | | | > > | | | | | | | | | | | | | < < < < | > | | | > | | | | > | | | | > | | | | > | | | > | | | > | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | | > > | | | | | | | | | | | > | | | > > > | | | | | | | | | | | > > | | | | > > | | | | | | | | | | | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 | set i [.t dlineinfo 2.end] set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}] set i [.t dlineinfo 3.0] set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}] list $b1 $b2 $b3 $b4 } [list 1 5 13 16] .t configure -spacing1 0 -spacing2 0 -spacing3 0 test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} { .t delete 1.0 end .t tag delete x y .t tag configure x -tabs 70 .t tag configure y -tabs 80 .t insert 1.0 "ab\tcde" .t tag add x 1.0 end .t tag add y 1.1 end lindex [.t bbox 1.3] 0 } [expr {[bo]+70}] test textDisp-2.25 {LayoutDLine, tabs, breaking chunks at tabs} { .t delete 1.0 end .t tag delete x # compute a tab width allowing to let 4 tab stops (followed by a single char) on a single line set tw [expr {([winfo width .t]-2*[bo]-$fixedWidth)/4}] .t tag configure x -tabs [list $tw [expr {$tw*2}] [expr {$tw*3}] [expr {$tw*4}]] .t insert 1.0 "a\tb\tc\td\te" .t mark set dummy1 1.1 .t mark set dummy2 1.2 .t tag add x 1.0 end set expected [list [expr {[bo]+$tw}] [expr {[bo]+2*$tw}] [expr {[bo]+3*$tw}] [expr {[bo]+4*$tw}]] set res [list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \ [lindex [.t bbox 1.6] 0] [lindex [.t bbox 1.8] 0]] lequal $res $expected } {1} # Next test is currently constrained to not run on mac (aqua) because on # aqua it fails due to wrong implementation of tabs with right justification # (the text is not rendered at all). This is a bug. test textDisp-2.26 {LayoutDLine, tabs, breaking chunks at tabs} {notAqua} { .t delete 1.0 end .t tag delete x .t tag configure x -tabs [list 30 60 90 120] -justify right .t insert 1.0 "a\tb\tc\td\te" .t mark set dummy1 1.1 .t mark set dummy2 1.2 .t tag add x 1.0 end list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \ [lindex [.t bbox 1.6] 0] [lindex [.t bbox 1.8] 0] } [list [xcharr 4] [xcharr 3] [xcharr 2] [xcharr 1]] test textDisp-2.27 {LayoutDLine, tabs, calling AdjustForTab} { .t delete 1.0 end .t tag delete x .t tag configure x -tabs [list 30 60] .t insert 1.0 "a\tb\tcd" .t tag add x 1.0 end list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] } [list [expr {[bo]+30}] [expr {[bo]+60}]] test textDisp-2.28 {LayoutDLine, tabs, running out of space in dline} { .t delete 1.0 end .t insert 1.0 "a\tb\tc\td" .t bbox 1.6 } [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] test textDisp-2.29 {LayoutDLine, tabs, running out of space in dline} { .t delete 1.0 end .t insert 1.0 "a\tx\tabcd" .t bbox 1.4 } [list [xchar [expr {2*8}]] [yline 1] $fixedWidth $fixedHeight] test textDisp-2.30 {LayoutDLine, tabs, running out of space in dline} { .t delete 1.0 end .t insert 1.0 "a\tx\tabc" .t bbox 1.4 } [list [xchar [expr {2*8}]] [yline 1] $fixedWidth $fixedHeight] test textDisp-3.1 {different character sizes} { .t configure -wrap word .t delete 1.0 end .t insert end "Some sample text, including both large\n" .t insert end "characters and\nsmall\n" .t insert end "abc\nd\ne\nfghij" .t tag add big 1.5 1.10 .t tag add big 2.11 2.14 list [.t bbox 1.1] [.t bbox 1.6] [.t dlineinfo 1.0] [.t dlineinfo 3.0] } [list [list [xchar 1] [expr {[yline 1]+$ascentDiff}] $fixedWidth $fixedHeight] \ [list [expr {[xchar 5]+[font measure $bigFont s]}] [yline 1] [font measure $bigFont a] $bigHeight] \ [list [bo] [yline 1] [expr {[xw 5]+[font measure $bigFont sampl]+[xw 2]}] $bigHeight $bigAscent] \ [list [bo] [expr {[bo]+2*$bigHeight+2*$fixedHeight}] [xw 5] $fixedHeight $fixedAscent]] .t configure -wrap char test textDisp-4.1 {UpdateDisplayInfo, basic} { .t delete 1.0 end .t insert end "Line 1\nLine 2\nLine 3\n" update .t delete 2.0 2.end update set res $tk_textRelayout .t insert 2.0 "New Line 2" update lappend res [.t bbox 1.0] [.t bbox 2.0] [.t bbox 3.0] $tk_textRelayout } [list 2.0 \ [list [xchar 0] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 3] $fixedWidth $fixedHeight] \ 2.0] test textDisp-4.2 {UpdateDisplayInfo, re-use tail of text line} { .t delete 1.0 end .t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3" update .t mark set x 2.21 .t delete 2.2 update set res $tk_textRelayout .t insert 2.0 X update lappend res [.t bbox 2.0] [.t bbox x] [.t bbox 3.0] $tk_textRelayout } [list 2.0 2.20 \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 1] [yline 3] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 4] $fixedWidth $fixedHeight] \ {2.0 2.20}] test textDisp-4.3 {UpdateDisplayInfo, tail of text line shifts} { .t delete 1.0 end .t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3" update .t mark set x 2.21 .t delete 2.2 update list [.t bbox 2.0] [.t bbox x] [.t bbox 3.0] $tk_textRelayout } [list [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 3] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 4] $fixedWidth $fixedHeight] \ {2.0 2.20}] .t mark unset x test textDisp-4.4 {UpdateDisplayInfo, wrap-mode "none"} { .t configure -wrap none .t delete 1.0 end .t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3" update list [.t bbox 2.0] [.t bbox 2.25] [.t bbox 3.0] $tk_textRelayout } [list [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ {} \ [list [xchar 0] [yline 3] $fixedWidth $fixedHeight] \ {1.0 2.0 3.0}] test textDisp-4.5 {UpdateDisplayInfo, tiny window} { if {[tk windowingsystem] == "win32"} { wm overrideredirect . 1 } wm geom . 103x$height update .t configure -wrap none .t delete 1.0 end .t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3" update list [.t bbox 2.0] [.t bbox 2.1] [.t bbox 3.0] $tk_textRelayout } [list [list [xchar 0] [yline 2] 1 $fixedHeight] \ {} \ [list [xchar 0] [yline 3] 1 $fixedHeight] \ {1.0 2.0 3.0}] if {[tk windowingsystem] == "win32"} { wm overrideredirect . 0 } test textDisp-4.6 {UpdateDisplayInfo, tiny window} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size # requested. The "overrideredirect" gets rid of the titlebar so # the toplevel can shrink to the appropriate size. On Unix, setting # the overrideredirect on "." confuses the window manager and # causes subsequent tests to fail. if {[tk windowingsystem] == "win32"} { wm overrideredirect . 1 } frame .f2 -width 20 -height 100 pack .f2 -before .f wm geom . 103x103 update .t configure -wrap none -borderwidth 2 .t delete 1.0 end .t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3" update set x [list [.t bbox 1.0] [.t bbox 2.0] $tk_textRelayout] wm overrideredirect . 0 update set expected [list [list [xchar 0] [yline 1] 1 1] {} 1.0] lequal $x $expected } {1} catch {destroy .f2} .t configure -borderwidth 0 -wrap char wm geom . {} update test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size # requested. The "overrideredirect" gets rid of the titlebar so # the toplevel can shrink to the appropriate size. On Unix, setting # the overrideredirect on "." confuses the window manager and # causes subsequent tests to fail. if {[tk windowingsystem] == "win32"} { wm overrideredirect . 1 } .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17" .t yview 1.0 update .t yview 16.0 update set x [list [.t index @0,0] $tk_textRelayout $tk_textRedraw] wm overrideredirect . 0 update set x } {8.0 {16.0 17.0 15.0 14.0 13.0 12.0 11.0 10.0 9.0 8.0} {8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0}} test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17" .t yview 16.0 update .t delete 5.0 14.0 update set x [list [.t index @0,0] $tk_textRelayout $tk_textRedraw] } {1.0 {5.0 4.0 3.0 2.0 1.0} {1.0 2.0 3.0 4.0 5.0 eof}} test textDisp-4.9 {UpdateDisplayInfo, filling in extra vertical space} { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17" .t yview 16.0 update .t delete 15.0 end list [.t bbox 7.0] [.t bbox 12.0] } [list [list [xchar 0] [yline 3] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 8] $fixedWidth $fixedHeight]] test textDisp-4.10 {UpdateDisplayInfo, filling in extra vertical space} { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17" .t yview end update .t delete 13.0 end update list [.t index @0,0] $tk_textRelayout $tk_textRedraw } {5.0 {12.0 7.0 6.40 6.20 6.0 5.0} {5.0 6.0 6.20 6.40 7.0 12.0}} test textDisp-4.11 {UpdateDisplayInfo, filling in extra vertical space} { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around, not once but really quite a few times.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17" .t yview end update .t delete 14.0 end update list [.t index @0,0] $tk_textRelayout $tk_textRedraw } {6.40 {13.0 7.0 6.80 6.60 6.40} {6.40 6.60 6.80 7.0 13.0}} test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16" button .b -text "Test" -bd 2 -highlightthickness 2 .t window create 3.end -window .b .t yview moveto 1 update .t yview moveto 0 update .t yview moveto 1 update winfo ismapped .b } 0 .t configure -wrap word .t delete 1.0 end .t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\n" .t insert end "Line 8\nLine 9\nLine 10\nLine 11\nLine 12\nLine 13\n" .t insert end "Line 14\nLine 15\nLine 16" .t tag delete x .t tag configure x -relief raised -borderwidth 2 -background white test textDisp-4.13 {UpdateDisplayInfo, special handling for top/bottom lines} { .t tag add x 1.0 end .t yview 1.0 update .t yview scroll 3 units update list $tk_textRelayout $tk_textRedraw } {{11.0 12.0 13.0} {4.0 10.0 11.0 12.0 13.0}} test textDisp-4.14 {UpdateDisplayInfo, special handling for top/bottom lines} { .t tag remove x 1.0 end .t yview 1.0 update .t yview scroll 3 units update list $tk_textRelayout $tk_textRedraw } {{11.0 12.0 13.0} {11.0 12.0 13.0}} test textDisp-4.15 {UpdateDisplayInfo, special handling for top/bottom lines} { .t tag add x 1.0 end .t yview 4.0 update .t yview scroll -2 units update list $tk_textRelayout $tk_textRedraw } {{2.0 3.0} {2.0 3.0 4.0 11.0}} test textDisp-4.16 {UpdateDisplayInfo, special handling for top/bottom lines} { .t tag remove x 1.0 end .t yview 4.0 update .t yview scroll -2 units update list $tk_textRelayout $tk_textRedraw } {{2.0 3.0} {2.0 3.0}} test textDisp-4.17 {UpdateDisplayInfo, horizontal scrolling} { .t configure -wrap none .t delete 1.0 end .t insert end "Short line 1\nLine 2 is long enough to scroll horizontally" .t insert end "\nLine 3\nLine 4" update .t xview scroll 3 units update list $tk_textRelayout $tk_textRedraw [.t bbox 2.0] [.t bbox 2.5] \ [.t bbox 2.23] } [list {} {1.0 2.0 3.0 4.0} \ {} \ [list [expr {[xchar 5]-[xw 3]}] [yline 2] $fixedWidth $fixedHeight] \ {}] test textDisp-4.18 {UpdateDisplayInfo, horizontal scrolling} { .t configure -wrap none .t delete 1.0 end .t insert end "Short line 1\nLine 2 is long enough to scroll horizontally" .t insert end "\nLine 3\nLine 4" update .t xview scroll 100 units update list $tk_textRelayout $tk_textRedraw [.t bbox 2.25] } [list {} {1.0 2.0 3.0 4.0} \ [list [xcharr 19] [yline 2] $fixedWidth $fixedHeight]] test textDisp-4.19 {UpdateDisplayInfo, horizontal scrolling} { .t configure -wrap none .t delete 1.0 end .t insert end "Short line 1\nLine 2 is long enough to scroll horizontally" .t insert end "\nLine 3\nLine 4" update .t xview moveto 0 .t xview scroll -10 units update list $tk_textRelayout $tk_textRedraw [.t bbox 2.5] } [list {} {1.0 2.0 3.0 4.0} \ [list [xchar 5] [yline 2] $fixedWidth $fixedHeight]] test textDisp-4.20 {UpdateDisplayInfo, horizontal scrolling} { .t configure -wrap none .t delete 1.0 end .t insert end "Short line 1\nLine 2 is long enough to scroll horizontally" .t insert end "\nLine 3\nLine 4" .t xview moveto 0.0 .t xview scroll 100 units update .t delete 2.30 2.44 update list $tk_textRelayout $tk_textRedraw [.t bbox 2.25] } [list 2.0 {1.0 2.0 3.0 4.0} \ [list [xcharr 5] [yline 2] $fixedWidth $fixedHeight]] test textDisp-4.21 {UpdateDisplayInfo, horizontal scrolling} { .t configure -wrap none .t delete 1.0 end .t insert end "Short line 1\nLine 2 is long enough to scroll horizontally" .t insert end "\nLine 3\nLine 4" .t xview moveto .9 update .t xview moveto .6 update list $tk_textRelayout $tk_textRedraw } {{} {}} test textDisp-4.22 {UpdateDisplayInfo, no horizontal scrolling except for -wrap none} { .t configure -wrap none .t delete 1.0 end .t insert end "Short line 1\nLine 2 is long enough to scroll horizontally" .t insert end "\nLine 3\nLine 4" .t xview scroll 25 units update .t configure -wrap word list [.t bbox 2.0] [.t bbox 2.16] } [list [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 1] [yline 3] $fixedWidth $fixedHeight]] test textDisp-4.23 {UpdateDisplayInfo, no horizontal scrolling except for -wrap none} { .t configure -wrap none .t delete 1.0 end .t insert end "Short line 1\nLine 2 is long enough to scroll horizontally" .t insert end "\nLine 3\nLine 4" .t xview scroll 25 units update .t configure -wrap char list [.t bbox 2.0] [.t bbox 2.16] } [list [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 16] [yline 2] $fixedWidth $fixedHeight]] test textDisp-5.1 {DisplayDLine, handling of spacing} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijkl\nmnopqrstuvwzyz" .t tag configure spacing -spacing1 8 -spacing3 2 .t tag add spacing 1.0 end frame .t.f1 -width 10 -height 4 -bg black frame .t.f2 -width 10 -height 4 -bg black frame .t.f3 -width 10 -height 4 -bg black frame .t.f4 -width 10 -height 4 -bg black .t window create 1.3 -window .t.f1 -align top .t window create 1.7 -window .t.f2 -align center .t window create 2.1 -window .t.f3 -align bottom .t window create 2.10 -window .t.f4 -align baseline update list [winfo geometry .t.f1] [winfo geometry .t.f2] \ [winfo geometry .t.f3] [winfo geometry .t.f4] } [list 10x4+[xchar 3]+[expr {[yline 1]+8}] \ 10x4+[expr {[xchar 6]+10}]+[expr {[yline 1]+8+($fixedHeight-4)/2}] \ 10x4+[xchar 1]+[expr {[yline 2]+8+2+8+($fixedHeight-4)}] \ 10x4+[expr {[xchar 9]+10}]+[expr {[yline 2]+8+2+8+($fixedAscent-4)}]] .t tag delete spacing # Although the following test produces a useful result, its main # effect is to produce a core dump if Tk doesn't handle display # relayout that occurs during redisplay. test textDisp-5.2 {DisplayDLine, line resizes during display} { .t delete 1.0 end frame .t.f -width 20 -height 20 -bd 2 -relief raised bind .t.f <Configure> {.t.f configure -width 30 -height 30} .t window create insert -window .t.f update list [winfo width .t.f] [winfo height .t.f] } [list 30 30] .t configure -wrap char test textDisp-6.1 {scrolling in DisplayText, scroll up} { .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 2.0 3.0 update list $tk_textRelayout $tk_textRedraw } {{2.0 10.0} {2.0 10.0}} test textDisp-6.2 {scrolling in DisplayText, scroll down} { .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t insert 2.0 "New Line 2\n" update list $tk_textRelayout $tk_textRedraw } {{2.0 3.0} {2.0 3.0}} test textDisp-6.3 {scrolling in DisplayText, multiple scrolls} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t insert 2.end "is so long that it wraps" .t insert 4.end "is so long that it wraps" update list $tk_textRelayout $tk_textRedraw } {{2.0 2.20 4.0 4.20} {2.0 2.20 4.0 4.20}} test textDisp-6.4 {scrolling in DisplayText, scrolls interfere} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t insert 2.end "is so long that it wraps around, not once but three times" .t insert 4.end "is so long that it wraps" update list $tk_textRelayout $tk_textRedraw } {{2.0 2.20 2.40 2.60 4.0 4.20} {2.0 2.20 2.40 2.60 4.0 4.20 6.0}} test textDisp-6.5 {scrolling in DisplayText, scroll source obscured} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed .t configure -wrap char frame .f2 -bg red place .f2 -in .t -relx 0.5 -rely 0.5 -relwidth 0.5 -relheight 0.5 .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, a couple of times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 1.6 1.end update destroy .f2 list $tk_textRelayout $tk_textRedraw } {{1.0 9.0 10.0} {1.0 4.0 5.0 9.0 10.0}} test textDisp-6.6 {scrolling in DisplayText, Expose events after scroll} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed # this test depends on all of the expose events being handled at once .t configure -wrap char frame .f2 -bg #ff0000 place .f2 -in .t -relx 0.2 -rely 0.5 -relwidth 0.5 -relheight 0.5 .t configure -bd 2 -relief raised .t delete 1.0 end # Line 1 must wrap exactly twice to get the expected result .t insert 1.0 "Line 1 is so long that it occupies 3 display lines" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 1.6 1.end destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{1.0 9.0 10.0} {1.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0}} .t configure -bd 0 test textDisp-6.7 {DisplayText, vertical scrollbar updates} { .t configure -wrap char .t delete 1.0 end update .t count -update -ypixels 1.0 end update set scrollInfo } {0.0 1.0} test textDisp-6.8 {DisplayText, vertical scrollbar updates} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" update set scrollInfo "unchanged" foreach i {2 3 4 5 6 7 8 9 10 11 12 13} { .t insert end "\nLine $i" } update .t count -update -ypixels 1.0 end ; update set scrollInfo } [list 0.0 [expr {10.0/13}]] .t configure -yscrollcommand {} -xscrollcommand scroll test textDisp-6.9 {DisplayText, horizontal scrollbar updates} { .t configure -wrap none .t delete 1.0 end update set scrollInfo unchanged .t insert end xxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx update set scrollInfo } [list 0.0 [expr {4.0/11}]] test textDisp-6.10 {DisplayText, redisplay embedded windows after scroll} {aqua} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4} { .t insert end "\nLine $i" } .t insert end "\n" .t window create end -create { button %W.button_one -text "Button 1"} .t insert end "\nLine 6\n" .t window create end -create { button %W.button_two -text "Button 2"} .t insert end "\nLine 8\n" .t window create end -create { button %W.button_three -text "Button 3"} update .t delete 2.0 3.0 update list $tk_textEmbWinDisplay } {{4.0 6.0}} .t configure -bd 2 -relief raised -wrap char .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, a couple of times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } test textDisp-7.1 {TkTextRedrawRegion} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed frame .f2 -bg #ff0000 place .f2 -in .t -relx 0.2 -relwidth 0.6 -rely 0.22 -relheight 0.55 update destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{} {1.40 2.0 3.0 4.0 5.0 6.0}} test textDisp-7.2 {TkTextRedrawRegion} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed frame .f2 -bg #ff0000 place .f2 -in .t -relx 0 -relwidth 0.5 -rely 0 -relheight 0.5 update destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{} {1.0 1.20 1.40 2.0 3.0}} test textDisp-7.3 {TkTextRedrawRegion} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed frame .f2 -bg #ff0000 place .f2 -in .t -relx 0.5 -relwidth 0.5 -rely 0.5 -relheight 0.5 update destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{} {4.0 5.0 6.0 7.0 8.0}} test textDisp-7.4 {TkTextRedrawRegion} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed frame .f2 -bg #ff0000 place .f2 -in .t -relx 0.4 -relwidth 0.2 -rely 0 -relheight 0.2 \ -bordermode ignore update destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{} {borders 1.0 1.20}} test textDisp-7.5 {TkTextRedrawRegion} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed frame .f2 -bg #ff0000 place .f2 -in .t -relx 0.4 -relwidth 0.2 -rely 1.0 -relheight 0.2 \ -anchor s -bordermode ignore update destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{} {borders 7.0 8.0}} test textDisp-7.6 {TkTextRedrawRegion} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed frame .f2 -bg #ff0000 place .f2 -in .t -relx 0 -relwidth 0.2 -rely 0.55 -relheight 0.2 \ -anchor w -bordermode ignore update destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{} {borders 3.0 4.0 5.0}} test textDisp-7.7 {TkTextRedrawRegion} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed frame .f2 -bg #ff0000 place .f2 -in .t -relx 1.0 -relwidth 0.2 -rely 0.55 -relheight 0.2 \ -anchor e -bordermode ignore update destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{} {borders 3.0 4.0 5.0}} test textDisp-7.8 {TkTextRedrawRegion} {aquaKnownBug} { # constrained by aquaKnownBug until ticket [aad0231f07] is fixed .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\n" frame .f2 -bg #ff0000 place .f2 -in .t -relx 0.0 -relwidth 0.4 -rely 0.35 -relheight 0.4 \ -anchor nw -bordermode ignore update destroy .f2 update list $tk_textRelayout $tk_textRedraw } {{} {borders 4.0 5.0 6.0 7.0 eof}} .t configure -bd 0 test textDisp-8.1 {TkTextChanged: redisplay whole lines} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is so long that it wraps around, two times" foreach i {3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 2.36 2.38 update list $tk_textRelayout $tk_textRedraw [.t bbox 2.32] } [list {2.0 2.18 2.38} {2.0 2.18 2.38} [list [xchar 14] [yline 3] $fixedWidth $fixedHeight]] .t configure -wrap char test textDisp-8.2 {TkTextChanged, redisplay whole lines} { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t insert 1.2 xx update list $tk_textRelayout $tk_textRedraw } {{1.0 1.20 1.40} {1.0 1.20 1.40}} test textDisp-8.3 {TkTextChanged} { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t insert 2.0 xx update list $tk_textRelayout $tk_textRedraw } {2.0 2.0} test textDisp-8.4 {TkTextChanged} { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 1.5 update list $tk_textRelayout $tk_textRedraw } {{1.0 1.20 1.40} {1.0 1.20 1.40}} test textDisp-8.5 {TkTextChanged} { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 1.40 1.44 update list $tk_textRelayout $tk_textRedraw } {{1.0 1.20 1.40} {1.0 1.20 1.40}} test textDisp-8.6 {TkTextChanged} { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 1.41 1.44 update list $tk_textRelayout $tk_textRedraw } {{1.0 1.20 1.40} {1.0 1.20 1.40}} test textDisp-8.7 {TkTextChanged} { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 1.2 1.end update list $tk_textRelayout $tk_textRedraw } {{1.0 9.0 10.0} {1.0 9.0 10.0}} test textDisp-8.8 {TkTextChanged} { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 2.2 update list $tk_textRelayout $tk_textRedraw } {2.0 2.0} test textDisp-8.9 {TkTextChanged} { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } update .t delete 2.0 3.0 update list $tk_textRelayout $tk_textRedraw } {{2.0 8.0} {2.0 8.0}} test textDisp-8.10 {TkTextChanged} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" .t tag add big 2.19 update .t delete 2.19 update set tk_textRedraw } {2.0 2.20 eof} test textDisp-8.11 {TkTextChanged, scrollbar notification when changes are off-screen} { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n" .t configure -yscrollcommand scroll update set scrollInfo "" .t insert end "a\nb\nc\n" # We need to wait for our asychronous callbacks to update the # scrollbar update .t count -update -ypixels 1.0 end update .t configure -yscrollcommand "" set scrollInfo } {0.0 0.625} test textDisp-8.12 {TkTextChanged, moving the insert cursor redraws only past and new lines} { .t delete 1.0 end .t configure -wrap none for {set i 1} {$i < 25} {incr i} { .t insert end "Line $i Line $i\n" } .t tag add hidden 5.0 8.0 .t tag configure hidden -elide true .t mark set insert 9.0 update .t mark set insert 8.0 ; # up one line update set res [list $tk_textRedraw] .t mark set insert 12.2 ; # in the visible text update lappend res $tk_textRedraw .t mark set insert 6.5 ; # in the hidden text update lappend res $tk_textRedraw .t mark set insert 3.5 ; # in the visible text again update lappend res $tk_textRedraw .t mark set insert 3.8 ; # within the same line update lappend res $tk_textRedraw } {{8.0 9.0} {8.0 12.0} {8.0 12.0} {3.0 8.0} {3.0 4.0}} test textDisp-8.13 {TkTextChanged, used to crash, see [06c1433906]} { .t delete 1.0 end .t insert 1.0 \nLine2\nLine3\n update .t insert 3.0 "" .t delete 1.0 2.0 update idletasks } {} test textDisp-9.1 {TkTextRedrawTag} -body { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" update .t tag add big 2.2 2.4 update list $tk_textRelayout $tk_textRedraw # glob matching is to have some tolerance on actually used font size # while still testing what we want to test } -match glob -result {{2.0 2.1[78]} {2.0 2.1[78]}} test textDisp-9.2 {TkTextRedrawTag} -body { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" update .t tag add big 1.2 2.4 update list $tk_textRelayout $tk_textRedraw # glob matching is to have some tolerance on actually used font size # while still testing what we want to test } -match glob -result {{1.0 2.0 2.1[678]} {1.0 2.0 2.1[678]}} test textDisp-9.3 {TkTextRedrawTag} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" update .t tag add big 2.2 2.4 update .t tag remove big 1.0 end update list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} test textDisp-9.4 {TkTextRedrawTag} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" update .t tag add big 2.2 2.20 update .t tag remove big 1.0 end update list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} test textDisp-9.5 {TkTextRedrawTag} -setup { .t configure -wrap char -height [expr {[.t cget -height]+10}] } -body { .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" update .t tag add big 2.2 2.end update .t tag remove big 1.0 end update list $tk_textRelayout $tk_textRedraw } -cleanup { .t configure -height [expr {[.t cget -height]-10}] update } -result {{2.0 2.20} {2.0 2.20 eof}} test textDisp-9.6 {TkTextRedrawTag} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap" update .t tag add big 2.2 3.5 update .t tag remove big 1.0 end update list $tk_textRelayout $tk_textRedraw } {{2.0 2.20 3.0 3.20} {2.0 2.20 3.0 3.20 eof}} test textDisp-9.7 {TkTextRedrawTag} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" .t tag add big 2.19 update .t tag remove big 2.19 update set tk_textRedraw } {2.0 2.20 eof} test textDisp-9.8 {TkTextRedrawTag} -body { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" .t tag add big 1.0 2.0 update .t tag add big 2.0 2.5 update set tk_textRedraw # glob matching is to have some tolerance on actually used font size # while still testing what we want to test } -match glob -result {2.0 2.1[678]} test textDisp-9.9 {TkTextRedrawTag} -body { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" .t tag add big 1.0 2.0 update .t tag add big 1.5 2.5 update set tk_textRedraw # glob matching is to have some tolerance on actually used font size # while still testing what we want to test } -match glob -result {2.0 2.1[678]} test textDisp-9.10 {TkTextRedrawTag} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" .t tag add big 1.0 2.0 update set tk_textRedraw none .t tag add big 1.3 1.5 update set tk_textRedraw } none test textDisp-9.11 {TkTextRedrawTag} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" .t tag add big 1.0 2.0 update .t tag add big 1.0 2.0 update set tk_textRedraw } {} test textDisp-9.12 {TkTextRedrawTag} { .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 5} {incr i} { .t insert end "Line $i+++Line $i\n" } .t tag configure hidden -elide true .t tag add hidden 2.6 3.6 update .t tag add hidden 3.11 4.6 update list $tk_textRelayout $tk_textRedraw } {2.0 {2.0 eof}} test textDisp-9.13 {TkTextRedrawTag} { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { .t insert end "Line $i - This is Line [format %c [expr {64+$i}]]\n" } .t tag add hidden 2.8 2.17 .t tag add hidden 6.8 7.17 .t tag configure hidden -background red .t tag configure hidden -elide true update .t tag configure hidden -elide false update list $tk_textRelayout $tk_textRedraw } {{2.0 6.0 7.0} {2.0 6.0 7.0}} test textDisp-9.14 {TkTextRedrawTag} { pack [text .tnocrash] for {set i 1} {$i < 6} {incr i} { .tnocrash insert end \nfoo$i } .tnocrash tag configure mytag1 -relief raised .tnocrash tag configure mytag2 -relief solid update proc doit {} { .tnocrash tag add mytag1 4.0 5.0 .tnocrash tag add mytag2 4.0 5.0 after idle { .tnocrash tag remove mytag1 1.0 end .tnocrash tag remove mytag2 1.0 end } |
︙ | ︙ | |||
1417 1418 1419 1420 1421 1422 1423 | vwait done } {} test textDisp-10.1 {TkTextRelayoutWindow} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 | vwait done } {} test textDisp-10.1 {TkTextRelayoutWindow} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" update .t configure -bg black update list $tk_textRelayout $tk_textRedraw } {{1.0 2.0 2.20 3.0 3.20 4.0} {borders 1.0 2.0 2.20 3.0 3.20 4.0 eof}} .t configure -bg [lindex [.t configure -bg] 3] catch {destroy .top} test textDisp-10.2 {TkTextRelayoutWindow} { toplevel .top -width 300 -height 200 wm geometry .top +0+0 text .top.t -font $fixedFont -width 20 -height 10 -relief raised -bd 2 place .top.t -x 0 -y 0 -width 20 -height 20 .top.t insert end "First line" .top.t see insert tkwait visibility .top.t place .top.t -width 150 -height 100 update .top.t index @0,0 } {1.0} catch {destroy .top} .t delete 1.0 end .t insert end "Line 1" for {set i 2} {$i <= 200} {incr i} { .t insert end "\nLine $i" } update test textDisp-11.1 {TkTextSetYView} { .t yview 30.0 update .t index @0,0 } {30.0} test textDisp-11.2 {TkTextSetYView} { .t yview 30.0 update .t yview 32.0 update list [.t index @0,0] $tk_textRedraw } {32.0 {40.0 41.0}} test textDisp-11.3 {TkTextSetYView} { .t yview 30.0 update .t yview 28.0 update list [.t index @0,0] $tk_textRedraw } {28.0 {28.0 29.0}} test textDisp-11.4 {TkTextSetYView} { .t yview 30.0 update .t yview 31.4 update list [.t index @0,0] $tk_textRedraw } {31.0 40.0} test textDisp-11.5 {TkTextSetYView} { .t yview 30.0 update set tk_textRedraw {} .t yview -pickplace 31.0 update list [.t index @0,0] $tk_textRedraw } {30.0 {}} test textDisp-11.6 {TkTextSetYView} { .t yview 30.0 update set tk_textRedraw {} .t yview -pickplace 28.0 update list [.t index @0,0] $tk_textRedraw } {28.0 {28.0 29.0}} test textDisp-11.7 {TkTextSetYView} { .t yview 30.0 update set tk_textRedraw {} .t yview -pickplace 26.0 update list [.t index @0,0] $tk_textRedraw } {21.0 {21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0}} test textDisp-11.8 {TkTextSetYView} { .t yview 30.0 update set tk_textRedraw {} .t yview -pickplace 41.0 update list [.t index @0,0] $tk_textRedraw } {32.0 {40.0 41.0}} test textDisp-11.9 {TkTextSetYView} { .t yview 30.0 update set tk_textRedraw {} .t yview -pickplace 43.0 update list [.t index @0,0] $tk_textRedraw } {38.0 {40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0}} test textDisp-11.10 {TkTextSetYView} { .t yview 30.0 update set tk_textRedraw {} .t yview 10000.0 update list [.t index @0,0] $tk_textRedraw } {191.0 {191.0 192.0 193.0 194.0 195.0 196.0 197.0 198.0 199.0 200.0}} test textDisp-11.11 {TkTextSetYView} { .t yview 195.0 update set tk_textRedraw {} .t yview 197.0 update list [.t index @0,0] $tk_textRedraw } {191.0 {191.0 192.0 193.0 194.0 195.0 196.0}} test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} { .t insert 10.0 "Long line with enough text to wrap\n" .t yview 1.0 update set tk_textRedraw {} .t see 10.30 update list [.t index @0,0] $tk_textRedraw } {2.0 10.20} .t delete 10.0 11.0 test textDisp-11.13 {TkTestSetYView, partially visible last line} { catch {destroy .top} toplevel .top wm geometry .top +0+0 text .top.t -width 20 -height 5 pack .top.t .top.t insert end "Line 1" for {set i 2} {$i <= 100} {incr i} { .top.t insert end "\nLine $i" } update scan [wm geometry .top] "%dx%d" w2 h2 wm geometry .top ${w2}x[expr {$h2-2}] update .top.t yview 1.0 update set tk_textRedraw {} .top.t see 5.0 update # Note, with smooth scrolling, the results of this test # have changed, and the old '2.0 {5.0 6.0}' is quite wrong. list [.top.t index @0,0] $tk_textRedraw } {1.0 5.0} catch {destroy .top} toplevel .top wm geometry .top +0+0 text .top.t -width 30 -height 3 pack .top.t .top.t insert end "Line 1" for {set i 2} {$i <= 20} {incr i} { .top.t insert end "\nLine $i" } update test textDisp-11.14 {TkTextSetYView, only a few lines visible} { .top.t yview 5.0 update .top.t see 10.0 .top.t index @0,0 } {8.0} test textDisp-11.15 {TkTextSetYView, only a few lines visible} { .top.t yview 5.0 update .top.t see 11.0 .top.t index @0,0 # The index 9.0 should be just visible by a couple of pixels } {9.0} test textDisp-11.16 {TkTextSetYView, only a few lines visible} { .top.t yview 8.0 update .top.t see 5.0 .top.t index @0,0 } {5.0} test textDisp-11.17 {TkTextSetYView, only a few lines visible} { .top.t yview 8.0 update .top.t see 4.0 .top.t index @0,0 # The index 2.0 should be just visible by a couple of pixels } {2.0} test textDisp-11.18 {TkTextSetYView, see in elided lines} { .top.t delete 1.0 end for {set i 1} {$i < 20} {incr i} { .top.t insert end [string repeat "Line $i" 10] .top.t insert end "\n" } .top.t yview 4.0 .top.t tag add hidden 4.10 "4.10 lineend" .top.t tag add hidden 5.15 10.3 .top.t tag configure hidden -elide true update .top.t see "8.0 lineend" # The index "8.0 lineend" is on screen despite elided -> no scroll .top.t index @0,0 } {4.0} test textDisp-11.19 {TkTextSetYView, see in elided lines} { .top.t delete 1.0 end for {set i 1} {$i < 50} {incr i} { .top.t insert end "Line $i\n" } # button just for having a line with a larger height button .top.t.b -text "Test" -bd 2 -highlightthickness 2 .top.t window create 21.0 -window .top.t.b .top.t tag add hidden 15.36 21.0 .top.t tag configure hidden -elide true .top.t configure -height 15 wm geometry .top 300x200+0+0 # Indices 21.0, 17.0 and 15.0 are all on the same display line # therefore index @0,0 shall be the same for all of them .top.t see end update .top.t see 21.0 update set ind1 [.top.t index @0,0] .top.t see end update .top.t see 17.0 update set ind2 [.top.t index @0,0] .top.t see end update .top.t see 15.0 update set ind3 [.top.t index @0,0] list [expr {$ind1 == $ind2}] [expr {$ind1 == $ind3}] } {1 1} test textDisp-11.20 {TkTextSetYView, see in elided lines} { .top.t delete 1.0 end .top.t configure -wrap none for {set i 1} {$i < 5} {incr i} { |
︙ | ︙ | |||
1660 1661 1662 1663 1664 1665 1666 | test textDisp-11.21 {TkTextSetYView, window height smaller than the line height} { .top.t delete 1.0 end for {set i 1} {$i <= 10} {incr i} { .top.t insert end "Line $i\n" } set lineheight [font metrics [.top.t cget -font] -linespace] wm geometry .top 200x[expr {$lineheight / 2}] | | > > > > > > > > > > > > > > > | | | | | | | | | | | 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 | test textDisp-11.21 {TkTextSetYView, window height smaller than the line height} { .top.t delete 1.0 end for {set i 1} {$i <= 10} {incr i} { .top.t insert end "Line $i\n" } set lineheight [font metrics [.top.t cget -font] -linespace] wm geometry .top 200x[expr {$lineheight / 2}] update .top.t see 1.0 .top.t index @0,[expr {$lineheight - 2}] } {1.0} test textDisp-11.22 {TkTextSetYView, peer has -startline} { .top.t delete 1.0 end for {set i 1} {$i <= 50} {incr i} { .top.t insert end "Line $i\n" } pack [.top.t peer create .top.p] -side left pack [scrollbar .top.sb -command {.top.p yview}] -side left -fill y .top.p configure -startline 5 -endline 35 -yscrollcommand {.top.sb set} update .top.p yview moveto 0 update set res [.top.p get @0,0 "@0,0 lineend"] destroy .top.p set res } {Line 5} .t configure -wrap word .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" test textDisp-12.1 {MeasureUp} { .t yview 100.0 update .t yview -pickplace 52.0 update .t index @0,0 } {49.0} test textDisp-12.2 {MeasureUp} { .t yview 100.0 update .t yview -pickplace 53.0 update .t index @0,0 } {50.0} test textDisp-12.3 {MeasureUp} { .t yview 100.0 update .t yview -pickplace 50.10 update .t index @0,0 } {45.0} .t configure -wrap none test textDisp-12.4 {MeasureUp} { .t yview 100.0 update .t yview -pickplace 53.0 update .t index @0,0 } {48.0} test textDisp-12.5 {MeasureUp} { .t yview 100.0 update .t yview -pickplace 50.10 update .t index @0,0 } {45.0} .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 99} {incr i} { .t insert end "Line $i\n" |
︙ | ︙ | |||
1724 1725 1726 1727 1728 1729 1730 | } {1 {wrong # args: should be ".t see index"}} test textDisp-13.3 {TkTextSeeCmd procedure} { list [catch {.t see badIndex} msg] $msg } {1 {bad text index "badIndex"}} test textDisp-13.4 {TkTextSeeCmd procedure} { .t xview moveto 0 .t yview moveto 0 | | | | | | | > > > | | | > > > > > > > > | | | > > > > > > > > | | < | | | | | | | | | | | | | | 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 | } {1 {wrong # args: should be ".t see index"}} test textDisp-13.3 {TkTextSeeCmd procedure} { list [catch {.t see badIndex} msg] $msg } {1 {bad text index "badIndex"}} test textDisp-13.4 {TkTextSeeCmd procedure} { .t xview moveto 0 .t yview moveto 0 update .t see 4.2 .t index @0,0 } {1.0} test textDisp-13.5 {TkTextSeeCmd procedure} { .t configure -wrap char .t xview moveto 0 .t yview moveto 0 update .t see 12.1 .t index @0,0 } {3.0} test textDisp-13.6 {TkTextSeeCmd procedure} { .t configure -wrap char .t xview moveto 0 .t yview moveto 0 update .t see 30.50 set x [.t index @0,0] .t configure -wrap none set x } {27.0} test textDisp-13.7 {TkTextSeeCmd procedure} { .t xview moveto 0 .t yview moveto 0 .t tag add sel 30.20 .t tag add sel 30.40 update .t see 30.50 .t yview 25.0 .t see 30.50 set x [list [.t bbox 30.50]] .t see 30.39 lappend x [.t bbox 30.39] .t see 30.38 lappend x [.t bbox 30.38] .t see 30.20 lappend x [.t bbox 30.20] } [list [list [xchar 10] [yline 6] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 6] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 6] $fixedWidth $fixedHeight] \ [list [xchar 10] [yline 6] $fixedWidth $fixedHeight]] test textDisp-13.8 {TkTextSeeCmd procedure} { .t xview moveto 0 .t yview moveto 0 .t tag add sel 30.20 .t tag add sel 30.50 update .t see 30.50 set x [list [.t bbox 30.50]] .t see 30.60 lappend x [.t bbox 30.60] .t see 30.65 lappend x [.t bbox 30.65] .t see 30.90 lappend x [.t bbox 30.90] # contrary to textDisp-13.7 above there is no yview command in this test # therefore take into account that the top line is partially hidden set y [expr {[yline 6] + [lindex [.t bbox @0,0] 1] - [bo]}] set expected [list [list [xchar 10] $y $fixedWidth $fixedHeight] \ [list [xchar 19] $y $fixedWidth $fixedHeight] \ [list [xchar 19] $y $fixedWidth $fixedHeight] \ [list [xchar 10] $y $fixedWidth $fixedHeight]] lequal $x $expected } {1} test textDisp-13.9 {TkTextSeeCmd procedure} { wm geom . [expr {$width-2}]x$height .t xview moveto 0 .t yview moveto 0 .t tag add sel 30.20 .t tag add sel 30.50 update .t see 30.50 set x [list [.t bbox 30.50]] .t see 30.60 lappend x [.t bbox 30.60] .t see 30.65 lappend x [.t bbox 30.65] .t see 30.90 lappend x [.t bbox 30.90] # contrary to textDisp-13.7 above there is no yview command in this test # therefore take into account that the top line is partially hidden set y [expr {[yline 6] + [lindex [.t bbox @0,0] 1] - [bo]}] set expected [list [list [expr {[bo]+round([winfo width .t]-2*[bo])/2}] $y $fixedWidth $fixedHeight] \ [list [xcharr 1] $y $fixedWidth $fixedHeight] \ [list [xcharr 1] $y $fixedWidth $fixedHeight] \ [list [expr {[bo]+round([winfo width .t]-2*[bo])/2}] $y $fixedWidth $fixedHeight]] lequal $x $expected } {1} test textDisp-13.10 {TkTextSeeCmd procedure} { # SF Bug 641778 set w .tsee destroy $w text $w -font {Helvetica 8 normal} -bd 16 $w insert end Hello $w see end set res [$w bbox end] destroy $w set res } {} test textDisp-13.11 {TkTextSeeCmd procedure} {} { # insertion of a character at end of a line containing multi-byte # characters and calling see at the line end shall actually show # this character toplevel .top2 pack [text .top2.t2 -wrap none] for {set i 1} {$i < 5} {incr i} { .top2.t2 insert end [string repeat "Line $i: éèàçù" 5]\n } wm geometry .top2 300x200+0+0 update .top2.t2 see "1.0 lineend" update set ref [.top2.t2 index @0,0] .top2.t2 insert "1.0 lineend" ç .top2.t2 see "1.0 lineend" update set new [.top2.t2 index @0,0] set res [.top2.t2 compare $ref == $new] destroy .top2 set res } 0 wm geom . {} .t configure -wrap none test textDisp-14.1 {TkTextXviewCmd procedure} { .t delete 1.0 end update .t insert end xxxxxxxxx\n .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto .5 .t xview } [list 0.5 [expr {6./7.}]] .t configure -wrap char test textDisp-14.2 {TkTextXviewCmd procedure} { .t delete 1.0 end update .t insert end xxxxxxxxx\n .t insert end "xxxxx\n" .t insert end "xxxx" .t xview } {0.0 1.0} .t configure -wrap none test textDisp-14.3 {TkTextXviewCmd procedure} { .t delete 1.0 end update .t insert end xxxxxxxxx\n .t insert end "xxxxx\n" .t insert end "xxxx" .t xview } {0.0 1.0} test textDisp-14.4 {TkTextXviewCmd procedure} { list [catch {.t xview moveto} msg] $msg } {1 {wrong # args: should be ".t xview moveto fraction"}} test textDisp-14.5 {TkTextXviewCmd procedure} { list [catch {.t xview moveto a b} msg] $msg } {1 {wrong # args: should be ".t xview moveto fraction"}} test textDisp-14.6 {TkTextXviewCmd procedure} { list [catch {.t xview moveto a} msg] $msg } {1 {expected floating-point number but got "a"}} test textDisp-14.7 {TkTextXviewCmd procedure} { .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" ; # 56 chars on this line .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto .3 .t xview } [list [expr {round(0.3*(56*$fixedWidth))/(56.0*$fixedWidth)}] [expr {round(0.3*(56*$fixedWidth)+20*$fixedWidth)/(56.0*$fixedWidth)}]] test textDisp-14.8 {TkTextXviewCmd procedure} { .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" ; # 56 chars on this line .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto -.4 .t xview } [list 0.0 [expr {20.0/56}]] test textDisp-14.9 {TkTextXviewCmd procedure} { .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" ; # 56 chars on this line .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview m 1.4 .t xview } [list [expr {(56.0-20)/56}] 1.0] test textDisp-14.10 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a} msg] $msg } {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}} test textDisp-14.11 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a b c} msg] $msg } {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}} test textDisp-14.12 {TkTextXviewCmd procedure} { |
︙ | ︙ | |||
1945 1946 1947 1948 1949 1950 1951 | .t insert end "Line $i\n" } .t insert end "Line 100" .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" test textDisp-15.1 {ScrollByLines procedure, scrolling backwards} { .t yview 45.0 | | | | | | | | | 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 | .t insert end "Line $i\n" } .t insert end "Line 100" .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" test textDisp-15.1 {ScrollByLines procedure, scrolling backwards} { .t yview 45.0 update .t yview scroll -3 units .t index @0,0 } {42.0} test textDisp-15.2 {ScrollByLines procedure, scrolling backwards} { .t yview 51.0 update .t yview scroll -2 units .t index @0,0 } {50.20} test textDisp-15.3 {ScrollByLines procedure, scrolling backwards} { .t yview 51.0 update .t yview scroll -4 units .t index @0,0 } {49.0} test textDisp-15.4 {ScrollByLines procedure, scrolling backwards} { .t yview 50.20 update .t yview scroll -2 units .t index @0,0 } {49.0} test textDisp-15.5 {ScrollByLines procedure, scrolling backwards} { .t yview 50.40 update .t yview scroll -2 units .t index @0,0 } {50.0} test textDisp-15.6 {ScrollByLines procedure, scrolling backwards} { .t yview 3.2 update .t yview scroll -5 units .t index @0,0 } {1.0} test textDisp-15.7 {ScrollByLines procedure, scrolling forwards} { .t yview 48.0 update .t yview scroll 4 units .t index @0,0 } {50.40} test textDisp-15.8 {Scrolling near end of window} { set textheight 12 set textwidth 30 |
︙ | ︙ | |||
2007 2008 2009 2010 2011 2012 2013 | .tf.f.t tag configure Header -font {Helvetica 14 bold italic} \ -wrap word -spacing1 12 -spacing3 4 .tf.f.t insert end "Foo" Header for {set i 1} {$i < $textheight} {incr i} { .tf.f.t insert end "\nLine $i" } | | | | | > > > > > > | | | | > > > > > > > > > | | | > | > > > > > > > > > > | | | < < > | > > > > > > > > > > | | | | | | | | | > > > > > | | | > > | | | | | > > > > > | < < < < | | | | | | | 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 | .tf.f.t tag configure Header -font {Helvetica 14 bold italic} \ -wrap word -spacing1 12 -spacing3 4 .tf.f.t insert end "Foo" Header for {set i 1} {$i < $textheight} {incr i} { .tf.f.t insert end "\nLine $i" } update set refind [.tf.f.t index @0,[winfo height .tf.f.t]] # Should scroll and should not crash! .tf.f.t yview scroll 1 unit # Check that it has scrolled set newind [.tf.f.t index @0,[winfo height .tf.f.t]] set res [.tf.f.t compare $newind > $refind] destroy .tf set res } 1 .t configure -wrap char .t delete 1.0 end .t insert insert "Line 1" for {set i 2} {$i <= 200} {incr i} { .t insert end "\nLine $i" } .t tag add big 100.0 105.0 .t insert 151.end { has a lot of extra text, so that it wraps around on the screen several times over.} .t insert 153.end { also has largely enough extra text to wrap.} update set totpix [.t count -update -ypixels 1.0 end] # check that the wrapping lines wrap exactly 6 times in total (4 times for line 151, and twice for line 153), # this is an assumption of the upcoming tests if {[expr {double(($totpix-5*$heightDiff)/$fixedHeight)}] != 206.0} { puts "---> Warning: the font actually used by the tests, which is \"[font actual [.t cget -font]]\",\ is too different from the requested \"[.t cget -font]\". Some of the upcoming tests will probably fail." } test textDisp-16.1 {TkTextYviewCmd procedure} { .t yview 21.0 set x [.t yview] .t yview 1.0 list [expr {int([lindex $x 0]*100)}] [expr {int([lindex $x 1]*100)}] } {9 14} test textDisp-16.2 {TkTextYviewCmd procedure} { list [catch {.t yview 2 3} msg] $msg } {1 {bad option "2": must be moveto or scroll}} test textDisp-16.3 {TkTextYviewCmd procedure} { list [catch {.t yview -pickplace} msg] $msg } {1 {wrong # args: should be ".t yview -pickplace lineNum|index"}} test textDisp-16.4 {TkTextYviewCmd procedure} { list [catch {.t yview -pickplace 2 3} msg] $msg } {1 {wrong # args: should be ".t yview -pickplace lineNum|index"}} test textDisp-16.5 {TkTextYviewCmd procedure} { list [catch {.t yview -bogus 2} msg] $msg } {1 {bad option "-bogus": must be moveto or scroll}} test textDisp-16.6 {TkTextYviewCmd procedure, integer position} { .t yview 100.0 update .t yview 98 .t index @0,0 } {99.0} test textDisp-16.7 {TkTextYviewCmd procedure} { .t yview 2.0 .t yv -pickplace 13.0 .t index @0,0 } {4.0} test textDisp-16.8 {TkTextYviewCmd procedure} { list [catch {.t yview bad_mark_name} msg] $msg } {1 {bad text index "bad_mark_name"}} test textDisp-16.9 {TkTextYviewCmd procedure, "moveto" option} { list [catch {.t yview moveto a b} msg] $msg } {1 {wrong # args: should be ".t yview moveto fraction"}} test textDisp-16.10 {TkTextYviewCmd procedure, "moveto" option} { list [catch {.t yview moveto gorp} msg] $msg } {1 {expected floating-point number but got "gorp"}} test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} { .t yview moveto 0.5 .t index @0,0 } {103.0} test textDisp-16.12 {TkTextYviewCmd procedure, "moveto" option} { .t yview moveto -1 .t index @0,0 } {1.0} test textDisp-16.13 {TkTextYviewCmd procedure, "moveto" option} { .t yview moveto 1.1 .t index @0,0 } {191.0} test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} { # y move to 3/4 of text widget content height .t yview moveto .75 # target y position is inside line 151, which wraps 4 times # exactly which display line depends on actual font size set ytargetline [expr {150*$fixedHeight+5*$heightDiff}] set expected 151.0 while {[expr {$ytargetline+$fixedHeight}] <= [expr {round(0.75*$totpix)}]} { incr ytargetline $fixedHeight set expected [.t index "$expected + 1 display line"] } lequal [.t index @0,0] $expected } {1} test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} { # y move to 3/4 of text widget content height plus just one line height minus one pixel .t yview moveto .75 set pixtonextline [expr {-[bo] + [lindex [.t bbox @0,0] 1] + [lindex [.t bbox @0,0] 3]}] .t yview moveto [expr {0.75 + ($pixtonextline-1)/double($totpix)}] # target y position is inside line 151, which wraps 4 times # exactly which display line depends on actual font size set ytargetline [expr {150*$fixedHeight+5*$heightDiff}] set expected 151.0 while {[expr {$ytargetline+$fixedHeight}] <= [expr {round(0.75*$totpix + ($pixtonextline-1))}]} { incr ytargetline $fixedHeight set expected [.t index "$expected + 1 display line"] } lequal [.t index @0,0] $expected } {1} test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} { # y move to 3/4 of text widget content height plus exactly one line height .t yview moveto .75 set pixtonextline [expr {-[bo] + [lindex [.t bbox @0,0] 1] + [lindex [.t bbox @0,0] 3]}] .t yview moveto [expr {0.75 + $pixtonextline/double($totpix)}] # target y position is inside line 151, which wraps 4 times # exactly which display line depends on actual font size set ytargetline [expr {150*$fixedHeight+5*$heightDiff}] set expected 151.0 while {[expr {$ytargetline+$fixedHeight}] <= [expr {round(0.75*$totpix + $pixtonextline)}]} { incr ytargetline $fixedHeight set expected [.t index "$expected + 1 display line"] } lequal [.t index @0,0] $expected } {1} test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} { .t yview moveto .755 .t index @0,0 } {151.80} test textDisp-16.18 {TkTextYviewCmd procedure, "moveto" roundoff} { catch {destroy .top1} toplevel .top1 wm geometry .top1 +0+0 text .top1.t -height 3 -width 4 -wrap none -setgrid 1 -padx 6 \ -spacing3 6 pack .top1.t update .top1.t insert end "1\n2\n3\n4\n5\n6" .top1.t yview moveto 0.3333 set result [.top1.t yview] destroy .top1 set result } [list [expr {1.0/3}] [expr {5.0/6}]] test textDisp-16.19 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll a} msg] $msg } {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}} test textDisp-16.20 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll a b c} msg] $msg } {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}} test textDisp-16.21 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll bogus bogus} msg] $msg } {1 {bad argument "bogus": must be pages, pixels, or units}} test textDisp-16.21.2 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll bogus units} msg] $msg } {1 {expected floating-point number but got "bogus"}} test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} { .t yview 50.0 update .t yview scroll -1 pages .t index @0,0 } {42.0} test textDisp-16.22.1 {TkTextYviewCmd procedure, "scroll" option, back pages} { list [catch {.t yview scroll -3 p} res] $res } {1 {ambiguous argument "p": must be pages, pixels, or units}} test textDisp-16.23 {TkTextYviewCmd procedure, "scroll" option, back pages} { .t yview 50.0 update .t yview scroll -3 pa .t index @0,0 } {26.0} test textDisp-16.24 {TkTextYviewCmd procedure, "scroll" option, back pages} { .t yview 5.0 update .t yview scroll -3 pa .t index @0,0 } {1.0} test textDisp-16.25 {TkTextYviewCmd procedure, "scroll" option, back pages} -setup { # this frame is needed because some window managers don't allow the overall # height of a window to get very narrow, triggering false test failure frame .f2 -height 20 pack .f2 -side top } -body { .t configure -height 1 update .t yview 50.0 update .t yview scroll -1 pages set x [.t index @0,0] .t configure -height 10 update set x } -cleanup { destroy .f2 } -result {49.0} test textDisp-16.26 {TkTextYviewCmd procedure, "scroll" option, forward pages} { .t yview 50.0 update .t yview scroll 1 pages .t index @0,0 } {58.0} test textDisp-16.27 {TkTextYviewCmd procedure, "scroll" option, forward pages} { .t yview 50.0 update .t yview scroll 2 pages .t index @0,0 } {66.0} test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} { .t yview 98.0 update # The man page does not say it but the code does: scrolling 1 page actually uses the # window height minus two lines, so that there's some overlap between adjacent pages. # Note: it's a bit tricky but we only need to subtract one [bo] from [winfo height .t] here # because the origin of @x,y coordinates is at borderwidth start, not at text area start. set expected [.t index @0,[expr {[winfo height .t]-[bo]-2*$fixedHeight}]] .t yview scroll 1 page lequal [.t index @0,0] $expected } {1} test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} { .t configure -height 1 update .t yview 50.0 update .t yview scroll 1 pages set x [.t index @0,0] .t configure -height 10 update set x } {51.0} test textDisp-16.30 {TkTextYviewCmd procedure, "scroll units" option} { .t yview 45.0 update .t yview scroll -3 units .t index @0,0 } {42.0} test textDisp-16.31 {TkTextYviewCmd procedure, "scroll units" option} { .t yview 149.0 update .t yview scroll 4 units .t index @0,0 } {151.40} test textDisp-16.32 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 12 bogoids} msg] $msg } {1 {bad argument "bogoids": must be pages, pixels, or units}} test textDisp-16.33 {TkTextYviewCmd procedure} { |
︙ | ︙ | |||
2257 2258 2259 2260 2261 2262 2263 | } {0 {}} test textDisp-16.38 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3blah pixels} msg] $msg } {1 {bad screen distance "1.3blah"}} test textDisp-16.39 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3i pixels} msg] $msg } {0 {}} | | | | 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 | } {0 {}} test textDisp-16.38 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3blah pixels} msg] $msg } {1 {bad screen distance "1.3blah"}} test textDisp-16.39 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3i pixels} msg] $msg } {0 {}} test textDisp-16.40 {text count -xpixels} { set res {} lappend res [.t count -xpixels 1.0 1.5] \ [.t count -xpixels 1.5 1.0] \ [.t count -xpixels 1.0 13.0] \ [.t count -xpixels 1.0 "1.0 displaylineend"] \ [.t count -xpixels 1.0 "1.0 lineend"] \ [.t count -xpixels 1.0 "1.0 displaylineend"] \ [.t count -xpixels 1.0 end] } [list [expr {5*$fixedWidth}] [expr {-5*$fixedWidth}] 0 [expr {6*$fixedWidth}] [expr {6*$fixedWidth}] [expr {6*$fixedWidth}] 0] test textDisp-16.41 {text count -xpixels with indices in elided lines} { set res {} .t delete 1.0 end for {set i 1} {$i < 40} {incr i} { .t insert end [string repeat "Line $i" 20] .t insert end "\n" } |
︙ | ︙ | |||
2301 2302 2303 2304 2305 2306 2307 | .t insert end [string repeat "Line $i" 20] .t insert end "\n" } .t tag add hidden 5.15 20.15 .t tag configure hidden -elide true .t yview 35.0 .t yview scroll [expr {- 15 * $fixedHeight}] pixels | | | | | | 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 | .t insert end [string repeat "Line $i" 20] .t insert end "\n" } .t tag add hidden 5.15 20.15 .t tag configure hidden -elide true .t yview 35.0 .t yview scroll [expr {- 15 * $fixedHeight}] pixels update .t index @0,0 } {5.0} test textDisp-16.43 {TkTextYviewCmd procedure with indices in elided lines} { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { .t insert end [string repeat "Line $i" 20] .t insert end "\n" } .t tag add hidden 5.15 20.15 .t tag configure hidden -elide true .t yview 35.0 .t yview scroll -15 units update .t index @0,0 } {5.0} test textDisp-16.44 {TkTextYviewCmd procedure, scroll down, with elided lines} { .t configure -wrap none .t delete 1.0 end foreach x [list 0 1 2 3 4 5 6 7 8 9 0] { .t insert end "$x aaa1\n$x bbb2\n$x ccc3\n$x ddd4\n$x eee5\n$x fff6" .t insert end "$x 1111\n$x 2222\n$x 3333\n$x 4444\n$x 5555\n$x 6666" hidden } .t tag configure hidden -elide true ; # 5 hidden lines update .t see [expr {5 + [winfo height .t] / $fixedHeight + 1}].0 update .t index @0,0 } {2.0} .t delete 1.0 end foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} { .t insert end "\nLine $i 11111 $i 22222 $i 33333 $i 44444 $i 55555" .t insert end " $i 66666 $i 77777 $i 88888 $i" |
︙ | ︙ | |||
2352 2353 2354 2355 2356 2357 2358 | list [catch {.t scan stupid b 20} msg] $msg } {1 {expected integer but got "b"}} test textDisp-17.4 {TkTextScanCmd procedure} { list [catch {.t scan stupid -2 bogus} msg] $msg } {1 {expected integer but got "bogus"}} test textDisp-17.5 {TkTextScanCmd procedure} { list [catch {.t scan stupid 123 456} msg] $msg | | | > > > | | | > | > > > > | > > > > > > > > > > > | > | | | > > > > | | | > > > > > > > > | | | > > > > > | > | | > | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 | list [catch {.t scan stupid b 20} msg] $msg } {1 {expected integer but got "b"}} test textDisp-17.4 {TkTextScanCmd procedure} { list [catch {.t scan stupid -2 bogus} msg] $msg } {1 {expected integer but got "bogus"}} test textDisp-17.5 {TkTextScanCmd procedure} { list [catch {.t scan stupid 123 456} msg] $msg } {1 {bad scan option "stupid": must be dragto or mark}} test textDisp-17.6 {TkTextScanCmd procedure} { .t yview 1.0 .t xview moveto 0 update set expected [.t index @[expr {[bo]+50}],[expr {[bo]+50}]] .t scan mark 40 60 .t scan dragto 35 55 update lequal [.t index @0,0] $expected } {1} test textDisp-17.7 {TkTextScanCmd procedure} { # 1st result .t yview 1.0 .t xview moveto 0 update set expected [.t index @[expr {[bo]+20*$fixedWidth-50}],[expr {[bo]+9*$fixedHeight-50}]] .t yview 10.0 .t xview scroll 20 units update .t scan mark -10 60 .t scan dragto -5 65 update set x [.t index @0,0] # 2nd result .t yview 1.0 .t xview moveto 0 update lappend expected [.t index @[expr {[bo]+20*$fixedWidth-50-50}],[expr {[bo]+9*$fixedHeight-50-70}]] .t yview 10.0 .t xview scroll 20 units update .t scan mark -10 60 .t scan dragto -5 65 update .t scan dragto 0 72 update lequal [list $x [.t index @0,0]] $expected } {1} test textDisp-17.8 {TkTextScanCmd procedure} { .t yview 1.0 .t xview moveto 0 update set expected [.t index @[expr {[bo]+50}],[expr {[bo]+50}]] .t scan mark 0 60 .t scan dragto 30 100 update .t scan dragto 25 95 update lequal [.t index @0,0] $expected } {1} test textDisp-17.9 {TkTextScanCmd procedure} { .t yview end .t xview moveto 0 update # this brings us at lower right corner of the text .t xview scroll 100 units update # this does not trigger any scroll, we're already at the corner .t scan mark 90 60 .t scan dragto 10 0 update set expected [.t index @[expr {[winfo width .t]-[bo]-40}],[expr {[winfo height .t]-[bo]-50}]] set expected [.t index "$expected - [.t cget -height] lines - [.t cget -width] chars"] .t scan dragto 14 5 update lequal [.t index @0,0] $expected } {1} .t configure -wrap word test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} { .t yview 10.0 update set origin [.t index @0,0] set expected [.t index "$origin - [expr {int(ceil(50.0/$fixedHeight))}] display lines"] .t scan mark -10 60 .t scan dragto -5 65 update set x [.t index @0,0] lappend expected [.t index "$origin - [expr {int(ceil((50.0+70.0)/$fixedHeight))}] display lines"] .t scan dragto 0 72 update lequal [list $x [.t index @0,0]] $expected } {1} .t configure -xscrollcommand scroll -yscrollcommand {} test textDisp-18.1 {GetXView procedure} { .t configure -wrap none .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx update set scrollInfo } [list 0.0 [expr {4.0/11}]] test textDisp-18.2 {GetXView procedure} { .t configure -wrap char .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx update set scrollInfo } {0.0 1.0} test textDisp-18.3 {GetXView procedure} { .t configure -wrap none .t delete 1.0 end update set scrollInfo } {0.0 1.0} test textDisp-18.4 {GetXView procedure} { .t configure -wrap none .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end xxxxxx\n .t insert end xxxxxxxxxxxxxxxxx update set scrollInfo } {0.0 1.0} test textDisp-18.5 {GetXView procedure} { .t configure -wrap none .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx .t xview scroll 31 units update set scrollInfo } [list [expr {31.0/55}] [expr {51.0/55}]] test textDisp-18.6 {GetXView procedure} { .t configure -wrap none .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto 0 .t xview scroll 31 units update set x {} lappend x $scrollInfo .t configure -wrap char update lappend x $scrollInfo .t configure -wrap word update lappend x $scrollInfo .t configure -wrap none update lappend x $scrollInfo } [list [list [expr {31.0/56}] [expr {51.0/56}]] {0.0 1.0} {0.0 1.0} [list 0.0 [expr {5.0/14}]]] test textDisp-18.7 {GetXView procedure} { .t configure -wrap none .t delete 1.0 end update set scrollInfo unchanged .t insert end xxxxxx\n .t insert end xxx update set scrollInfo } {unchanged} test textDisp-18.8 {GetXView procedure} { proc bgerror msg { global x errorInfo set x [list $msg $errorInfo] } proc bogus args { error "bogus scroll proc" } .t configure -wrap none .t delete 1.0 end .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n update .t delete 1.0 end .t configure -xscrollcommand scrollError update set x } {{scrolling error} {scrolling error while executing "error "scrolling error"" (procedure "scrollError" line 2) invoked from within "scrollError 0.0 1.0" (horizontal scrolling command executed by text)}} catch {rename bgerror {}} catch {rename bogus {}} .t configure -xscrollcommand {} -yscrollcommand scroll test textDisp-19.1 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end update set scrollInfo } {0.0 1.0} test textDisp-19.2 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end update set scrollInfo "unchanged" .t insert 1.0 "Line1\nLine2" update set scrollInfo } {unchanged} test textDisp-19.3 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end update set scrollInfo "unchanged" .t insert 1.0 "Line 1\nLine 2 is so long that it wraps around\nLine 3" update set scrollInfo } {unchanged} test textDisp-19.4 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" update set scrollInfo "unchanged" foreach i {2 3 4 5 6 7 8 9 10 11 12 13} { .t insert end "\nLine $i" } update set scrollInfo } [list 0.0 [expr {70.0/91}]] test textDisp-19.5 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13} { .t insert end "\nLine $i" } .t insert 2.end " is really quite long; in fact it's so long that it wraps three times" update set x $scrollInfo } {0.0 0.625} test textDisp-19.6 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13} { .t insert end "\nLine $i" } .t insert 2.end " is really quite long; in fact it's so long that it wraps three times" .t yview 4.0 update set x $scrollInfo } {0.375 1.0} test textDisp-19.7 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13} { .t insert end "\nLine $i" } .t insert 2.end " is really quite long; in fact it's so long that it wraps three times" .t yview 2.26 update set x $scrollInfo } {0.125 0.75} test textDisp-19.8 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13} { .t insert end "\nLine $i" } .t insert 10.end " is really quite long; in fact it's so long that it wraps three times" .t yview 2.0 update .t count -update -ypixels 1.0 end set x $scrollInfo } {0.0625 0.6875} test textDisp-19.9 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t yview 3.0 update set scrollInfo } [list [expr {4.0/30}] 0.8] test textDisp-19.10 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t yview 11.0 update set scrollInfo } [list [expr {1.0/3}] 1.0] test textDisp-19.10.1 {Widget manipulation causes height miscount} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t yview 11.0 update .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t insert end "\nThis last line wraps around four " .t insert end "times with a little bit left on the last line." .t yview insert update .t count -update -ypixels 1.0 end set scrollInfo } {0.5 1.0} test textDisp-19.11 {GetYView procedure} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t insert end "\nThis last line wraps around four " .t insert end "times with a little bit left on the last line." .t yview insert update .t count -update -ypixels 1.0 end set scrollInfo } {0.5 1.0} test textDisp-19.11.2 {TextWidgetCmd procedure, "count -displaylines"} { .t count -displaylines 1.0 end } 20 test textDisp-19.11.3 {TextWidgetCmd procedure, "count -displaylines"} { |
︙ | ︙ | |||
2774 2775 2776 2777 2778 2779 2780 | catch {destroy .top} toplevel .top wm geometry .top +0+0 text .top.t -width 40 -height 5 -font $fixedFont pack .top.t -expand yes -fill both .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5" # Need to wait for asychronous calculations to complete. | | | | | | | | | | | | 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 | catch {destroy .top} toplevel .top wm geometry .top +0+0 text .top.t -width 40 -height 5 -font $fixedFont pack .top.t -expand yes -fill both .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5" # Need to wait for asychronous calculations to complete. update scan [wm geom .top] %dx%d twidth theight wm geom .top ${twidth}x[expr {$theight - 3}] update .top.t yview } [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]] test textDisp-19.13 {GetYView procedure, partially visible last line} { catch {destroy .top} toplevel .top wm geometry .top +0+0 text .top.t -width 40 -height 5 -font $fixedFont pack .top.t -expand yes -fill both .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4 has enough text to wrap around at least once" # Need to wait for asychronous calculations to complete. update scan [wm geom .top] %dx%d twidth theight wm geom .top ${twidth}x[expr {$theight - 3}] update .top.t yview } [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]] catch {destroy .top} test textDisp-19.14 {GetYView procedure} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t insert end "\nThis last line wraps around four " .t insert end "times with a little bit left on the last line." # Need to update so everything is calculated. update .t count -update -ypixels 1.0 end delay set scrollInfo "unchanged" .t mark set insert 3.0 .t tag configure x -background red .t tag add x 1.0 5.0 update .t tag delete x set scrollInfo } {unchanged} test textDisp-19.15 {GetYView procedure} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t insert end "\nThis last line wraps around four " .t insert end "times with a bit little left on the last line." update .t configure -yscrollcommand scrollError proc bgerror args { global x errorInfo errorCode set x [list $args $errorInfo $errorCode] } .t delete 1.0 end update rename bgerror {} .t configure -yscrollcommand scroll set x } {{{scrolling error}} {scrolling error while executing "error "scrolling error"" (procedure "scrollError" line 2) |
︙ | ︙ | |||
2854 2855 2856 2857 2858 2859 2860 | .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t insert end "\nThis last line wraps around four " .t insert end "times with a little bit left on the last line." # Need to update so everything is calculated. | | | | < | > > > | > > | | > | | | > > > > > > > | | > | | | | | | > > > > > | < > > | | > > | | > > | | > > | > | | | | > | > > | | > | | 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 | .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { .t insert end "\nLine $i" } .t insert end "\nThis last line wraps around four " .t insert end "times with a little bit left on the last line." # Need to update so everything is calculated. update .t count -update -ypixels 1.0 end update set res [list \ [.t count -ypixels 1.0 end] \ [.t count -update -ypixels 1.0 end] \ [.t count -ypixels 15.0 16.0] \ [.t count -ypixels 15.0 "16.0 displaylineend +1c"] \ [.t count -ypixels 16.0 "16.0 displaylineend +1c"] \ [.t count -ypixels "16.0 +1 displaylines" "16.0 +4 displaylines +3c"] ] } [list [expr {20 * $fixedHeight}] \ [expr {20 * $fixedHeight}] \ $fixedHeight \ [expr {2*$fixedHeight}] \ $fixedHeight \ [expr {3*$fixedHeight}]] test textDisp-19.17 {count -ypixels with indices in elided lines} { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { .t insert end [string repeat "Line $i" 20] .t insert end "\n" } .t tag add hidden 5.15 20.15 .t tag configure hidden -elide true update .t count -update -ypixels 1.0 end update set res [list \ [.t count -ypixels 1.0 6.0] \ [.t count -ypixels 2.0 7.5] \ [.t count -ypixels 5.0 8.5] \ [.t count -ypixels 6.1 6.2] \ [.t count -ypixels 6.1 18.8] \ [.t count -ypixels 18.0 20.50] \ [.t count -ypixels 5.2 20.60] \ [.t count -ypixels 20.60 20.70] \ [.t count -ypixels 5.0 25.0] \ [.t count -ypixels 25.0 5.0] \ [.t count -ypixels 25.4 27.50] \ [.t count -ypixels 35.0 38.0] ] .t yview 35.0 lappend res [.t count -ypixels 5.0 25.0] } [list [expr {4 * $fixedHeight}] \ [expr {3 * $fixedHeight}] \ 0 0 0 0 0 0 \ [expr {5 * $fixedHeight}] \ [expr {- 5 * $fixedHeight}] \ [expr {2 * $fixedHeight}] \ [expr {3 * $fixedHeight}] \ [expr {5 * $fixedHeight}]] test textDisp-19.18 {count -ypixels with indices in elided lines} { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { .t insert end [string repeat "Line $i" 20] .t insert end "\n" } .t tag add hidden 5.15 20.15 .t tag configure hidden -elide true .t yview 35.0 update .t count -update -ypixels 1.0 end update set res [.t count -ypixels 5.0 25.0] .t yview scroll [expr {- 15 * $fixedHeight}] pixels update lappend res [.t count -ypixels 5.0 25.0] } [list [expr {5 * $fixedHeight}] [expr {5 * $fixedHeight}]] test textDisp-19.19 {count -ypixels with indices in elided lines} { .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 25} {incr i} { .t insert end [string repeat "Line $i -" 6] .t insert end "\n" } .t tag add hidden 5.27 11.0 .t tag configure hidden -elide true .t yview 5.0 update set res [list [.t count -ypixels 5.0 11.0] [.t count -ypixels 5.0 11.20]] } [list [expr {1 * $fixedHeight}] [expr {2 * $fixedHeight}]] .t delete 1.0 end .t insert end "Line 1" for {set i 2} {$i <= 200} {incr i} { .t insert end "\nLine $i" } .t configure -wrap word .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" test textDisp-20.1 {FindDLine} { .t yview 48.0 list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \ [.t dlineinfo 58.0] } [list {} {} [list [bo] [yline 2] [xw 7] $fixedHeight $fixedAscent] {}] test textDisp-20.2 {FindDLine} { .t yview 100.0 .t yview -pickplace 53.0 set centlineY [lindex [.t bbox 53.0] 1] set expectedY [expr {$centlineY - int(($centlineY-[bo])/$fixedHeight)*$fixedHeight - $fixedHeight}] set expected [list [list [bo] $expectedY [xw 20] $fixedHeight $fixedAscent] \ [list [bo] $expectedY [xw 20] $fixedHeight $fixedAscent] \ [list [bo] [expr {$expectedY+$fixedHeight}] [xw 19] $fixedHeight $fixedAscent]] set res [list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21]] lequal $res $expected } {1} test textDisp-20.3 {FindDLine} { .t yview 100.0 .t yview 49.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 57.0] } [list [list [bo] [yline 2] [xw 20] $fixedHeight $fixedAscent] \ [list [bo] [yline 3] [xw 19] $fixedHeight $fixedAscent] \ {}] test textDisp-20.4 {FindDLine} { .t yview 100.0 .t yview 42.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 50.40] } [list [list [bo] [yline 9] [xw 20] $fixedHeight $fixedAscent] \ [list [bo] [yline 10] [xw 19] $fixedHeight $fixedAscent] \ {}] .t config -wrap none test textDisp-20.5 {FindDLine} { .t yview 100.0 .t yview 48.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40] } [list [list [bo] [yline 3] [xw 53] $fixedHeight $fixedAscent] \ [list [bo] [yline 3] [xw 53] $fixedHeight $fixedAscent] \ [list [bo] [yline 3] [xw 53] $fixedHeight $fixedAscent]] .t config -wrap word test textDisp-21.1 {TkTextPixelIndex} { .t yview 48.0 set off [expr {[bo]+3}] list [.t index @-10,-10] [.t index @$off,$off] [.t index @[expr {[xchar 2]+2}],$off] \ [.t index @[expr {[xchar 14]+1}],$off] [.t index @[xchar 5],[yline 5]] } {48.0 48.0 48.2 48.7 50.45} .t insert end \n test textDisp-21.2 {TkTextPixelIndex} { .t yview 195.0 set off [expr {[xchar 1]+1}] list [.t index @$off,[expr {[yline 6]+2}]] \ [.t index @$off,[expr {[yline 7]+2}]] \ [.t index @$off,[expr {[yline 8]+2}]] \ [.t index @$off,1002] } {197.1 198.1 199.1 201.0} test textDisp-21.3 {TkTextPixelIndex, horizontal scrolling} { .t configure -wrap none .t delete 1.0 end .t insert end "12345\n" .t insert end "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" .t xview scroll 2 units set off [expr {[yline 1]+4}] list [.t index @-5,$off] [.t index @[expr {[xchar 1]-2}],$off] [.t index @[expr {[xchar 4]+2}],[expr {[yline 2]+2}]] } {1.2 1.2 2.6} test textDisp-21.4 {count -displaylines regression} { set message { QOTW: "C/C++, which is used by 16% of users, is the most popular programming language, but Tcl, used by 0%, seems to be the language of choice for the highest scoring users." (new line) Use the Up (cursor) key to scroll up one line at a time. At the second press, the cursor either gets locked or jumps several lines. |
︙ | ︙ | |||
3012 3013 3014 3015 3016 3017 3018 | .t insert end "Line 1" for {set i 2} {$i <= 200} {incr i} { .t insert end "\nLine $i" } .t configure -wrap word .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" | | | | > > > > | | > > | > > > | > > | < > | > > > | > > | < > | > > | | | | > > > | > > > | < > | | | | > | | > > > > > | | | > > > > > | | | | | | | > > > > | | | | | | | > | > > > | > > | < > | > > > | > > | < > | | | | > > | | > > | | > | > > > > > > > > | | > > | < > | > > > | > > | < > | | > | > | > > > | | > | > | | | > | > > > > > > > > | | > > | < > | > > > | > > | < > | > > > | > > | < > | > > > | > > | < > | > > | | < | > > | > > > | > > | < > | | | | > > > | > > | < > | > > > | > > | < > | | > > | | > | > | | | | > | | | > | > > | | | > > | | > > > | > > | | | | | | | | | | > > > | | > | | > > > | | | | | | > > | | | | > > | | > > | 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 | .t insert end "Line 1" for {set i 2} {$i <= 200} {incr i} { .t insert end "\nLine $i" } .t configure -wrap word .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" update .t tag add x 50.1 test textDisp-22.1 {TkTextCharBbox} { .t config -wrap word .t yview 48.0 list [.t bbox 47.2] [.t bbox 48.0] [.t bbox 50.5] [.t bbox 50.40] \ [.t bbox 58.0] } [list {} \ [list [xchar 0] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 5] [yline 3] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 5] $fixedWidth $fixedHeight] \ {}] test textDisp-22.2 {TkTextCharBbox} { .t config -wrap none .t yview 48.0 list [.t bbox 50.5] [.t bbox 50.40] [.t bbox 57.0] } [list [list [xchar 5] [yline 3] $fixedWidth $fixedHeight] \ {} \ [list [xchar 0] [yline 10] $fixedWidth $fixedHeight]] test textDisp-22.3 {TkTextCharBbox, cut-off lines} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t config -wrap char .t yview 10.0 wm geom . ${width}x[expr {$height-1}] update set expected [list [list [xchar 1] [yline 10] $fixedWidth $fixedHeight] \ [list [xchar 1] [yline 11] $fixedWidth [expr {($height-1)-$oriHeight}]]] lequal [list [.t bbox 19.1] [.t bbox 20.1]] $expected } {1} test textDisp-22.4 {TkTextCharBbox, cut-off lines} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t config -wrap char .t yview 10.0 wm geom . ${width}x[expr {$height+1}] update set expected [list [list [xchar 1] [yline 10] $fixedWidth $fixedHeight] \ [list [xchar 1] [yline 11] $fixedWidth [expr {($height+1)-$oriHeight}]]] lequal [list [.t bbox 19.1] [.t bbox 20.1]] $expected } {1} test textDisp-22.5 {TkTextCharBbox, cut-off char} { wm geometry . {} update .t config -wrap none .t yview 10.0 wm geom . [expr {$width-(20-7)*$fixedWidth}]x$height update .t bbox 15.6 } [list [xchar 6] [yline 6] $fixedWidth $fixedHeight] test textDisp-22.6 {TkTextCharBbox, line visible but not char} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t config -wrap char .t yview 10.0 .t tag add big 20.2 20.5 wm geom . ${width}x[expr {$height+3}] update set expected [list [list [xchar 1] [yline 10] $fixedWidth $fixedHeight] \ {} \ [list [xchar 2] [yline 11] [font measure $bigFont "n"] [expr {($height+3)-$oriHeight}]]] lequal [list [.t bbox 19.1] [.t bbox 20.1] [.t bbox 20.2]] $expected } {1} wm geom . {} update test textDisp-22.7 {TkTextCharBbox, different character sizes} { .t config -wrap char .t yview 10.0 .t tag add big 12.2 12.5 update list [.t bbox 12.1] [.t bbox 12.2] } [list [list [xchar 1] [expr {[yline 3]+$ascentDiff}] $fixedWidth $fixedHeight] \ [list [xchar 2] [yline 3] [font measure $bigFont "n"] $bigHeight]] .t tag remove big 1.0 end test textDisp-22.8 {TkTextCharBbox, horizontal scrolling} { .t configure -wrap none .t delete 1.0 end .t insert end "12345\n" .t insert end "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" .t xview scroll 4 units list [.t bbox 1.3] [.t bbox 1.4] [.t bbox 2.3] [.t bbox 2.4] \ [.t bbox 2.23] [.t bbox 2.24] } [list {} \ [list [xchar 0] [yline 1] $fixedWidth $fixedHeight] \ {} \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 19] [yline 2] $fixedWidth $fixedHeight] \ {}] test textDisp-22.9 {TkTextCharBbox, handling of spacing} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijkl\nmnopqrstuvwzyz" .t tag configure spacing -spacing1 8 -spacing3 2 .t tag add spacing 1.0 end frame .t.f1 -width 10 -height 4 -bg black frame .t.f2 -width 10 -height 4 -bg black frame .t.f3 -width 10 -height 4 -bg black frame .t.f4 -width 10 -height 4 -bg black .t window create 1.3 -window .t.f1 -align top .t window create 1.7 -window .t.f2 -align center .t window create 2.1 -window .t.f3 -align bottom .t window create 2.10 -window .t.f4 -align baseline update list [.t bbox .t.f1] [.t bbox .t.f2] [.t bbox .t.f3] [.t bbox .t.f4] \ [.t bbox 1.1] [.t bbox 2.9] } [list [list [xchar 3] [expr {[yline 1]+8}] 10 4] \ [list [expr {[xchar 3]+10+[xw 3]}] [expr {[yline 1]+8+($fixedHeight-4)/2}] 10 4] \ [list [xchar 1] [expr {[yline 2]+8+2+8+($fixedHeight-4)}] 10 4] \ [list [expr {[xchar 1]+10+[xw 8]}] [expr {[yline 2]+8+2+8+($fixedAscent-4)}] 10 4] \ [list [xchar 1] [expr {[yline 1]+8}] $fixedWidth $fixedHeight] \ [list [expr {[xchar 1]+10+[xw 7]}] [expr {[yline 2]+8+2+8}] $fixedWidth $fixedHeight]] .t tag delete spacing test textDisp-22.10 {TkTextCharBbox, handling of elided lines} { .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { .t insert end "Line $i - Line [format %c [expr {64+$i}]]\n" } .t tag add hidden 2.8 2.13 .t tag add hidden 6.8 7.13 .t tag configure hidden -elide true update list \ [expr {[lindex [.t bbox 2.9] 0] - [lindex [.t bbox 2.8] 0]}] \ [expr {[lindex [.t bbox 2.10] 0] - [lindex [.t bbox 2.8] 0]}] \ [expr {[lindex [.t bbox 2.13] 0] - [lindex [.t bbox 2.8] 0]}] \ [expr {[lindex [.t bbox 6.9] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 6.10] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 6.13] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 6.14] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 6.15] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 7.0] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 7.1] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 7.12] 0] - [lindex [.t bbox 6.8] 0]}] } [list 0 0 0 0 0 0 0 0 0 0 0] test textDisp-22.11 {TkTextCharBbox, handling of wrapped elided lines} { .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { .t insert end "Line $i - Line _$i - Lines .$i - Line [format %c [expr {64+$i}]]\n" } .t tag add hidden 1.30 2.5 .t tag configure hidden -elide true update list \ [expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.4] 0]}] \ [expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.5] 0]}] } [list 0 0] .t delete 1.0 end .t insert end "Line 1" for {set i 2} {$i <= 200} {incr i} { .t insert end "\nLine $i" } .t configure -wrap word .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" update test textDisp-23.1 {TkTextDLineInfo} { .t config -wrap word .t yview 48.0 list [.t dlineinfo 47.3] [.t dlineinfo 48.0] [.t dlineinfo 50.40] \ [.t dlineinfo 56.0] } [list {} \ [list [bo] [yline 1] [xw 7] $fixedHeight $fixedAscent] \ [list [bo] [yline 5] [xw 13] $fixedHeight $fixedAscent] \ {}] .t config -bd 4 test textDisp-23.2 {TkTextDLineInfo} { .t config -wrap word update .t yview 48.0 .t dlineinfo 50.40 } [list [bo] [yline 5] [xw 13] $fixedHeight $fixedAscent] .t config -bd 0 test textDisp-23.3 {TkTextDLineInfo} { .t config -wrap none update .t yview 48.0 list [.t dlineinfo 50.40] [.t dlineinfo 57.3] } [list [list [bo] [yline 3] [xw 53] $fixedHeight $fixedAscent] \ [list [bo] [yline 10] [xw 7] $fixedHeight $fixedAscent]] test textDisp-23.4 {TkTextDLineInfo, cut-off lines} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t config -wrap char .t yview 10.0 wm geom . ${width}x[expr {$height-1}] update set expected [list [list [bo] [yline 10] [xw 7] $fixedHeight $fixedAscent] \ [list [bo] [yline 11] [xw 7] [expr {($height-1)-$oriHeight}] $fixedAscent]] lequal [list [.t dlineinfo 19.0] [.t dlineinfo 20.0]] $expected } {1} test textDisp-23.5 {TkTextDLineInfo, cut-off lines} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t config -wrap char .t yview 10.0 wm geom . ${width}x[expr {$height+1}] update set expected [list [list [bo] [yline 10] [xw 7] $fixedHeight $fixedAscent] \ [list [bo] [yline 11] [xw 7] [expr {($height+1)-$oriHeight}] $fixedAscent]] lequal [list [.t dlineinfo 19.0] [.t dlineinfo 20.0]] $expected } {1} wm geom . {} update test textDisp-23.6 {TkTextDLineInfo, horizontal scrolling} { .t config -wrap none .t delete 1.0 end .t insert end "First line\n" .t insert end "Second line is a very long one that doesn't all fit.\n" .t insert end "Third" .t xview scroll 6 units update list [.t dlineinfo 1.0] [.t dlineinfo 2.0] [.t dlineinfo 3.0] } [list [list [expr {[xw -6]+[bo]}] [yline 1] [xw 10] $fixedHeight $fixedAscent] \ [list [expr {[xw -6]+[bo]}] [yline 2] [xw 52] $fixedHeight $fixedAscent] \ [list [expr {[xw -6]+[bo]}] [yline 3] [xw 5] $fixedHeight $fixedAscent]] .t xview moveto 0 test textDisp-23.7 {TkTextDLineInfo, centering} { .t config -wrap word .t delete 1.0 end .t insert end "First line\n" .t insert end "Second line is a very long one that doesn't all fit.\n" .t insert end "Third" .t tag configure x -justify center .t tag configure y -justify right .t tag add x 1.0 .t tag add y 3.0 list [.t dlineinfo 1.0] [.t dlineinfo 2.0] [.t dlineinfo 3.0] } [list [list [expr {[bo]+[xe 10]/2}] [yline 1] [xw 10] $fixedHeight $fixedAscent] \ [list [bo] [yline 2] [xw 17] $fixedHeight $fixedAscent] \ [list [xcharr 5] [yline 5] [xw 5] $fixedHeight $fixedAscent]] .t tag delete x y test textDisp-24.1 {TkTextCharLayoutProc} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" list [.t bbox 1.19] [.t bbox 1.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-24.2 {TkTextCharLayoutProc} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" # be tolerant about borderwidth et al. - don't let another char fit on the line set wi $width while {$wi+1-$oriWidth >= $fixedWidth} { incr wi -$fixedWidth } wm geom . [expr {$wi+1}]x$height update set expected [list [list [xchar 19] [yline 1] [expr {$fixedWidth+($wi+1-$oriWidth)}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected } {1} test textDisp-24.3 {TkTextCharLayoutProc} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" wm geom . [expr {$width-1}]x$height update set expected [list [list [xchar 19] [yline 1] [expr {$fixedWidth+($width-1-$oriWidth)}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected } {1} test textDisp-24.4 {TkTextCharLayoutProc, newline not visible} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 01234567890123456789\n012345678901234567890 wm geom . {} update list [.t bbox 1.19] [.t bbox 1.20] [.t bbox 2.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 20] [yline 1] 0 $fixedHeight] \ [list [xchar 0] [yline 3] $fixedWidth $fixedHeight]] test textDisp-24.5 {TkTextCharLayoutProc, char doesn't fit, newline not visible} {nonwin} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 0\n1\n # set text widget width to 1-char width minus [bo] pixels # note: windows refuses to shrink enough therefore the constraint set wi [expr {[winfo width .f]+[bo]+[xw 1]}] wm geom . ${wi}x$height update list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 2.0] } [list [list [xchar 0] [yline 1] [expr {$fixedWidth-[bo]}] $fixedHeight] \ [list [expr {[xchar 1]-[bo]}] [yline 1] 0 $fixedHeight] \ [list [xchar 0] [yline 2] [expr {$fixedWidth-[bo]}] $fixedHeight]] test textDisp-24.6 {TkTextCharLayoutProc, line ends with space} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" wm geom . {} update list [.t bbox 1.19] [.t bbox 1.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" # be tolerant about borderwidth et al. - don't let another char fit on the line set wi $width while {$wi+1-$oriWidth >= $fixedWidth} { incr wi -$fixedWidth } wm geom . [expr {$wi+1}]x$height update set expected [list [list [xchar 19] [yline 1] [expr {$fixedWidth+($wi+1-$oriWidth)}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected } {1} test textDisp-24.8 {TkTextCharLayoutProc, line ends with space} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" wm geom . [expr {$width-1}]x$height update set expected [list [list [xchar 19] [yline 1] [expr {$fixedWidth+($width-1-$oriWidth)}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected } {1} test textDisp-24.9 {TkTextCharLayoutProc, line ends with space} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" wm geom . [expr {$width-6}]x$height update set expected [list [list [xchar 19] [yline 1] [expr {$fixedWidth+($width-6-$oriWidth)}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected } {1} test textDisp-24.10 {TkTextCharLayoutProc, line ends with space} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" wm geom . [expr {$width-7}]x$height update set expected [list [list [xchar 19] [yline 1] [expr {$fixedWidth+($width-7-$oriWidth)}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected } {1} test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't quite fit} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "01234567890123456789 \nabcdefg" # set text widget width to 2 pixels more than 20-char width set wi [expr {[winfo width .f]+2*[bo]+[xw 20]+2}] wm geom . ${wi}x$height update set result [list [.t bbox 1.21] [.t bbox 2.0]] .t mark set insert 1.21 lappend result [.t bbox 1.21] [.t bbox 2.0] } [list [list [expr {[xchar 20]+2}] [yline 1] 0 $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [expr {[xchar 20]+2}] [yline 1] 0 $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] wm geom . {} update test textDisp-24.12 {TkTextCharLayoutProc, tab causes wrap} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghi" .t mark set insert 1.4 .t insert insert \t\t\t set expected [list [list [expr {[xchar 0]+2*8*$fixedWidth}] [yline 1] [expr {[winfo width .t]-([xchar 0]+2*8*$fixedWidth)-[bo]}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox {insert -1c}] [.t bbox insert]] $expected } {1} test textDisp-24.13 {TkTextCharLayoutProc, -wrap none} { .t configure -wrap none .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" wm geom . {} update list [.t bbox 1.19] [.t bbox 1.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] {}] test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t configure -wrap none .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" wm geom . [expr {$width+1}]x$height update set expected [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 20] [yline 1] [expr {$width+1-$oriWidth}] $fixedHeight]] lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected } {1} test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight .t configure -wrap none .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" wm geom . [expr {$width-1}]x$height update set expected [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 20] [yline 1] [expr {$width-1-$oriWidth}] $fixedHeight]] lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected } {1} test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} { if {[tk windowingsystem] == "win32"} { wm overrideredirect . 1 } .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" # set text widget width to [bo] pixels (no chars fit in the widget at all) set wi [expr {[winfo width .f]+[bo]}] wm geom . ${wi}x$height update list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 1.2] } [list [list [xchar 0] [yline 1] 1 $fixedHeight] \ [list [xchar 0] [yline 2] 1 $fixedHeight] \ [list [xchar 0] [yline 3] 1 $fixedHeight]] if {[tk windowingsystem] == "win32"} { wm overrideredirect . 0 } test textDisp-24.17 {TkTextCharLayoutProc, -wrap word} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This is a line that wraps around" wm geom . {} update list [.t bbox 1.19] [.t bbox 1.20] } [list [list [xchar 19] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-24.18 {TkTextCharLayoutProc, -wrap word} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "xxThis is a line that wraps around" wm geom . {} update list [.t bbox 1.15] [.t bbox 1.16] [.t bbox 1.17] [.t bbox 1.21] } [list [list [xchar 15] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 16] [yline 1] [xe 16] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 4] [yline 2] $fixedWidth $fixedHeight]] test textDisp-24.19 {TkTextCharLayoutProc, -wrap word} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "xxThis is a line that wraps around" wm geom . {} update list [.t bbox 1.14] [.t bbox 1.15] [.t bbox 1.16] } [list [list [xchar 14] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 15] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 16] [yline 1] [xe 16] $fixedHeight]] test textDisp-24.20 {TkTextCharLayoutProc, vertical offset} { .t configure -wrap none .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2\nLine 3" set result {} lappend result [.t bbox 2.1] [.t dlineinfo 2.1] .t tag configure up -offset 6 .t tag add up 2.1 lappend result [.t bbox 2.1] [.t dlineinfo 2.1] .t tag configure up -offset -2 lappend result [.t bbox 2.1] [.t dlineinfo 2.1] .t tag delete up set result } [list [list [xchar 1] [yline 2] $fixedWidth $fixedHeight] \ [list [bo] [yline 2] [xw 6] $fixedHeight $fixedAscent] \ [list [xchar 1] [yline 2] $fixedWidth $fixedHeight] \ [list [bo] [yline 2] [xw 6] [expr {$fixedHeight+6}] [expr {$fixedAscent+6}]] \ [list [xchar 1] [expr {[yline 2]+2}] $fixedWidth $fixedHeight] \ [list [bo] [yline 2] [xw 6] [expr {$fixedHeight+2}] $fixedAscent]] .t configure -width 30 update test textDisp-24.21 {TkTextCharLayoutProc, word breaks} { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "Sample text xxxxxxx yyyyy zzzzzzz qqqqq rrrr ssss tt u vvvvv" frame .t.f -width 30 -height 20 -bg black .t window create 1.36 -window .t.f .t bbox 1.26 } [list [xchar 0] [expr {[yline 2]+(20-$fixedHeight)/2}] $fixedWidth $fixedHeight] test textDisp-24.22 {TkTextCharLayoutProc, word breaks} { .t configure -wrap word .t delete 1.0 end frame .t.f -width 30 -height 20 -bg black .t insert 1.0 "Sample text xxxxxxx yyyyyyy" .t window create end -window .t.f .t insert end "zzzzzzz qqqqq rrrr ssss tt u vvvvv" .t bbox 1.28 } [list [expr {[bo]+30}] [expr {[yline 2]+(20-$fixedHeight)/2}] $fixedWidth $fixedHeight] test textDisp-24.23 {TkTextCharLayoutProc, word breaks} { .t configure -wrap word .t delete 1.0 end frame .t.f -width 50 -height 20 -bg black .t insert 1.0 "Sample text xxxxxxx yyyyyyy " .t insert end "zzzzzzz qqqqq rrrr ssss tt" .t window create end -window .t.f .t insert end "u vvvvv" .t bbox .t.f } [list [xchar 0] [yline 3] 50 20] catch {destroy .t.f} .t configure -width 20 update # Next test is currently constrained to not run on mac (aqua) because on # aqua it fails due to wrong implementation of tabs with right justification # (the text is not rendered at all). This is a bug. test textDisp-24.24 {TkTextCharLayoutProc, justification and tabs} notAqua { .t delete 1.0 end .t tag configure x -justify center .t insert 1.0 aa\tbb\tcc\tdd\t .t tag add x 1.0 end list [.t bbox 1.0] [.t bbox 1.10] } [list [list [expr {[bo]+[xe 8]/2}] [yline 1] $fixedWidth $fixedHeight] \ [list [expr {[bo]+[xe 8]/2+[xw 7]}] [yline 1] $fixedWidth $fixedHeight]] test textDisp-24.25 {TkTextCharLayoutProc, justification and tabs} -setup { text .tt -tabs {40 right} -wrap none -font $fixedFont pack .tt } -body { .tt insert end \t9\n\t99\n\t999 update set expected [list [list [expr {[bo .tt]+40-$fixedWidth}] [yline 1 .tt] $fixedWidth $fixedHeight] \ [list [expr {[bo .tt]+40-$fixedWidth}] [yline 2 .tt] $fixedWidth $fixedHeight] \ [list [expr {[bo .tt]+40-$fixedWidth}] [yline 3 .tt] $fixedWidth $fixedHeight]] lequal [list [.tt bbox 1.1] [.tt bbox 2.2] [.tt bbox 3.3]] $expected } -cleanup { destroy .tt } -result {1} .t configure -width 40 -bd 0 -relief flat -highlightthickness 0 \ -tabs 100 update test textDisp-25.1 {CharBboxProc procedure, check tab width} { .t delete 1.0 end .t insert 1.0 abc\td\tfgh list [.t bbox 1.3] [.t bbox 1.5] [.t bbox 1.6] } [list [list [xchar 3] [yline 1] [expr {100-3*$fixedWidth}] $fixedHeight] \ [list [expr {[bo]+100+$fixedWidth}] [yline 1] [expr {200-(100+$fixedWidth)}] $fixedHeight] \ [list [expr {[bo]+200}] [yline 1] $fixedWidth $fixedHeight]] .t configure -width 40 -bd 0 -relief flat -highlightthickness 0 -padx 0 -pady 0 \ -tabs {} update test textDisp-26.1 {AdjustForTab procedure, no tabs} { .t delete 1.0 end .t insert 1.0 a\tbcdefghij\tc\td list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.12] 0] \ [lindex [.t bbox 1.14] 0] } [list [expr {[bo]+8*$fixedWidth}] \ [expr {[bo]+2*8*$fixedWidth+2*$fixedWidth}] \ [expr {[bo]+3*8*$fixedWidth}]] test textDisp-26.1.2 {AdjustForTab procedure, no tabs} { .t delete 1.0 end .t insert 1.0 a\tbcdefghij\tc\td .t configure -tabstyle wordprocessor set res [list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.12] 0] \ [lindex [.t bbox 1.14] 0]] .t configure -tabstyle tabular set res } [list [expr {[bo]+8*$fixedWidth}] \ [expr {[bo]+3*8*$fixedWidth}] \ [expr {[bo]+4*8*$fixedWidth}]] test textDisp-26.2 {AdjustForTab procedure, not enough tabs specified} { .t delete 1.0 end .t insert 1.0 a\tb\tc\td .t tag delete x .t tag configure x -tabs 40 .t tag add x 1.0 end list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \ |
︙ | ︙ | |||
3555 3556 3557 3558 3559 3560 3561 | .t tag delete x .t tag configure x -tabs {120 numeric} .t tag add x 1.0 end .t tag add y 1.7 .t tag add y 1.9 button .b -text "=" .t window create 1.3 -window .b | | | > > > > | > | | > | | > > > > | > | | | | | | | | | > > | | > > | > > > | > > | < > | > > > | > > | < > | > > > | > > | < > | > > > | > > | < > | | | > | | | | > | | < | | | | < | | | | | | | > | | | > | | | > | | | > | > | | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | < > > > | > | | | < < < < < < < < < < < < < < < < < | < < < < < < | < < < < < < < < > | < < < < < < < < < < < < < | < < < < < | < < < < | < < < < < < < < < < | > | < > > | | > | | > > > | > > > | | > > > > > | | > | | > > | > > > > > | | > | | > > | | | | | | | | | > | | > | | > > | | > | | | > | | > > | | > | > > | | > | > > > > > | | | | | | | | | | | | | 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 | .t tag delete x .t tag configure x -tabs {120 numeric} .t tag add x 1.0 end .t tag add y 1.7 .t tag add y 1.9 button .b -text "=" .t window create 1.3 -window .b update lindex [.t bbox 1.5] 0 } 120 test textDisp-26.13 {AdjustForTab procedure, not enough space} { .t delete 1.0 end .t insert 1.0 "abc\txyz\tqrs\txyz\t0" .t tag delete x set t1 [expr { $fixedWidth+3}] set t2 [expr { 4*$fixedWidth+2}] set t3 [expr { 7*$fixedWidth+1}] set t4 [expr {17*$fixedWidth+1}] .t tag configure x -tabs "$t1 $t2 center $t3 right $t4" .t tag add x 1.0 end set expected [list [xchar 4] [xchar 8] [xchar 12] $t4] set res [list [lindex [.t bbox 1.4] 0] [lindex [.t bbox 1.8] 0] \ [lindex [.t bbox 1.12] 0] [lindex [.t bbox 1.16] 0]] lequal $res $expected } {1} test textDisp-26.13.2 {AdjustForTab procedure, not enough space} { .t delete 1.0 end .t insert 1.0 "abc\txyz\tqrs\txyz\t0" .t tag delete x set t1 [expr { $fixedWidth+3}] set t2 [expr { 4*$fixedWidth+2}] set t3 [expr { 7*$fixedWidth+1}] set t4 [expr {17*$fixedWidth+1}] .t tag configure x -tabs "$t1 $t2 center $t3 right $t4" -tabstyle wordprocessor .t tag add x 1.0 end set expected [list [xchar 4] [xchar 8] $t4 [expr {$t4+($t4-$t3)}]] set res [list [lindex [.t bbox 1.4] 0] [lindex [.t bbox 1.8] 0] \ [lindex [.t bbox 1.12] 0] [lindex [.t bbox 1.16] 0]] .t tag configure x -tabstyle tabular lequal $res $expected } {1} test textDisp-26.14 {AdjustForTab procedure, not enough space} { .t delete 1.0 end .t insert end "a \tb \tc \td \te \tf \tg\n" .t insert end "Watch the \tX and the \t\t\tY\n" .t tag configure moop -tabs [expr {8*$fixedWidth}] .t insert end "Watch the \tX and the \t\t\tY\n" moop list [lindex [.t bbox 2.11] 0] [lindex [.t bbox 2.24] 0] \ [lindex [.t bbox 3.11] 0] [lindex [.t bbox 3.24] 0] } [list [xchar 11] [xchar 32] [xchar 11] [xchar 32]] test textDisp-26.14.2 {AdjustForTab procedure, not enough space} { .t delete 1.0 end .t configure -tabstyle wordprocessor .t insert end "a \tb \tc \td \te \tf \tg\n" .t insert end "Watch the \tX and the \t\t\tY\n" .t tag configure moop -tabs [expr {8*$fixedWidth}] .t insert end "Watch the \tX and the \t\t\tY\n" moop set res [list [lindex [.t bbox 2.11] 0] [lindex [.t bbox 2.24] 0] \ [lindex [.t bbox 3.11] 0] [lindex [.t bbox 3.24] 0]] .t configure -tabstyle tabular set res } [list [xchar 16] [xchar 8] [xchar 16] [xchar 8]] .t configure -width 20 -bd 2 -highlightthickness 2 -relief sunken -tabs {} \ -wrap char update test textDisp-27.1 {SizeOfTab procedure, old-style tabs} { .t delete 1.0 end .t insert 1.0 a\tbcdefghij\tc\td list [.t bbox 1.2] [.t bbox 1.10] [.t bbox 1.12] } [list [list [xchar 8] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar [expr {8+8}]] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar [expr {8+8+1+1}]] [yline 1] $fixedWidth $fixedHeight]] test textDisp-27.1.1 {SizeOfTab procedure, old-style tabs} { .t delete 1.0 end .t insert 1.0 a\tbcdefghij\tc\td .t configure -tabstyle wordprocessor set res [list [.t bbox 1.2] [.t bbox 1.10] [.t bbox 1.12]] .t configure -tabstyle tabular set res } [list [list [xchar 8] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar [expr {8+8}]] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] test textDisp-27.2 {SizeOfTab procedure, choosing tabX and alignment} { .t delete 1.0 end .t insert 1.0 a\tbcd .t tag delete x # compute a tab width such that the first display line is just not large enough # to show the last char 'd', which then wraps on display line 2 set tw [expr {(20-2)*$fixedWidth-($fixedWidth-1)}] .t tag configure x -tabs $tw .t tag add x 1.0 end set expected [list [list [expr {[bo]+$tw+[xw 1]}] [yline 1] [expr {[winfo width .t]-([bo]+$tw+[xw 1])-[bo]}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.3] [.t bbox 1.4]] $expected } {1} test textDisp-27.3 {SizeOfTab procedure, choosing tabX and alignment} { .t delete 1.0 end .t insert 1.0 a\t\t\tbcd .t tag delete x # compute a tab width such that the first display line is just not large enough # to show the last char 'd', which then wraps on display line 2 set tw [expr {int(ceil(((20-2)*$fixedWidth-($fixedWidth-1))/3.0))}] .t tag configure x -tabs $tw .t tag add x 1.0 end set expected [list [list [expr {[bo]+3*$tw+[xw 1]}] [yline 1] [expr {[winfo width .t]-([bo]+3*$tw+[xw 1])-[bo]}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.5] [.t bbox 1.6]] $expected } {1} test textDisp-27.4 {SizeOfTab procedure, choosing tabX and alignment} { .t delete 1.0 end .t insert 1.0 a\t\t\tbcd .t tag delete x # compute a tab width such that the first display line is just not large enough # to show the last char 'd', which then wraps on display line 2 set tw [expr {int(ceil(((20-2)*$fixedWidth-($fixedWidth-1) + 20)/2.0))}] .t tag configure x -tabs "20 center $tw left" .t tag add x 1.0 end set expected [list [list [expr {[bo]+$tw+($tw-20)+[xw 1]}] [yline 1] [expr {[winfo width .t]-([bo]+$tw+($tw-20)+[xw 1])-[bo]}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.5] [.t bbox 1.6]] $expected } {1} test textDisp-27.5 {SizeOfTab procedure, center alignment} { .t delete 1.0 end .t insert 1.0 a\txyzzyabc .t tag delete x # compute a tab width such that the last y on the first display line is the last displayed char # while 'xyzzyabc' is centered at the tab stop; the 'abc" part of the line wraps on display line 2 set tw [expr {[winfo width .t]-2*[bo]-3*$fixedWidth+1}] .t tag configure x -tabs "$tw center" .t tag add x 1.0 end set expected [list [list [expr {[bo]+$tw+round(1.5*$fixedWidth)}] [yline 1] [expr {[winfo width .t]-([bo]+$tw+round(1.5*$fixedWidth))-[bo]}] $fixedHeight] \ [list [xchar 0] [yline 2] $fixedWidth $fixedHeight]] lequal [list [.t bbox 1.6] [.t bbox 1.7]] $expected } {1} test textDisp-27.6 {SizeOfTab procedure, center alignment} { .t delete 1.0 end .t insert 1.0 a\txyzzyabc .t tag delete x .t tag configure x -tabs "[expr {round(21.4*$fixedWidth)}] center" .t tag add x 1.0 end list [.t bbox 1.6] [.t bbox 1.7] } [list [list [xchar 4] [yline 2] $fixedWidth $fixedHeight] \ [list [xchar 5] [yline 2] $fixedWidth $fixedHeight]] test textDisp-27.7 {SizeOfTab procedure, center alignment, wrap -none (potential numerical problems)} { .t delete 1.0 end set cm [winfo fpixels .t 1c] .t configure -tabs {1c 2c center 3c 4c 5c 6c 7c 8c} -wrap none -width 40 .t insert 1.0 a\tb\tc\td\te\n012345678934567890a\tbb\tcc\tdd set width [expr {$fixedWidth * 19}] set tab $cm while {$tab < $width} { set tab [expr {$tab + $cm}] } # Now we've calculated to the end of the tab after 'a', add one # more for 'bb\t' and we're there, with some pixels for the border. Since # Tk_GetPixelsFromObj uses the standard 'int(0.5 + float)' rounding, # so must we. set tab [expr {[bo] + int(0.5 + $tab + $cm)}] update set res [.t bbox 2.23] set expected [list [expr {[xchar 23]-$tab}] [yline 2] $fixedWidth $fixedHeight] lequal [lset res 0 [expr {[lindex $res 0] - $tab}]] $expected } {1} test textDisp-27.7.1 {SizeOfTab procedure, center alignment, wrap -none (potential numerical problems)} { .t delete 1.0 end .t configure -tabstyle wordprocessor set cm [winfo fpixels .t 1c] .t configure -tabs {1c 2c center 3c 4c 5c 6c 7c 8c} -wrap none -width 40 .t insert 1.0 a\tb\tc\td\te\n012345678934567890a\tbb\tcc\tdd set width [expr {$fixedWidth * 19}] set tab $cm while {$tab < $width} { set tab [expr {$tab + $cm}] } # Now we've calculated to the end of the tab after 'a', add one # more for 'bb\t' and we're there, with some pixels for the border. Since # Tk_GetPixelsFromObj uses the standard 'int(0.5 + float)' rounding, # so must we. set tab [expr {[bo] + int(0.5 + $tab + $cm)}] update set res [.t bbox 2.23] .t configure -tabstyle tabular lset res 0 [expr {[lindex $res 0] - $tab}] } [list 0 [yline 2] $fixedWidth $fixedHeight] test textDisp-27.7.2 {SizeOfTab procedure, fractional tab interpolation problem} { .t delete 1.0 end set interpolatetab {1c 2c} set precisetab {} for {set i 1} {$i < 20} {incr i} { lappend precisetab "${i}c" } .t configure -tabs $interpolatetab -wrap none -width 150 .t insert 1.0 [string repeat "a\t" 20] update set res [.t bbox 1.20] # Now, Tk's interpolated tabs should be the same as # non-interpolated. .t configure -tabs $precisetab update expr {[lindex $res 0] - [lindex [.t bbox 1.20] 0]} } 0 .t configure -wrap char -tabs {} -width 20 update test textDisp-27.8 {SizeOfTab procedure, right alignment} { .t delete 1.0 end .t insert 1.0 a\t\txyzzyabc .t tag delete x .t tag configure x -tabs "[expr {14.3*$fixedWidth}] left [expr {[.t cget -width]*$fixedWidth}] right" .t tag add x 1.0 end list [.t bbox 1.6] [.t bbox 1.7] } [list [list [xcharr 1] [yline 1] $fixedWidth $fixedHeight] \ [list [bo] [yline 2] $fixedWidth $fixedHeight]] test textDisp-27.9 {SizeOfTab procedure, left alignment} { .t delete 1.0 end .t insert 1.0 a\txyzzyabc .t tag delete x .t tag configure x -tabs "[expr {17.14*$fixedWidth}]" .t tag add x 1.0 end list [.t bbox 1.3] [.t bbox 1.4] } [list [list [expr {round([bo]+17.14*$fixedWidth+$fixedWidth)}] [yline 1] [expr {[winfo width .t]-round([bo]+17.14*$fixedWidth+$fixedWidth)-[bo]}] $fixedHeight] \ [list [bo] [yline 2] $fixedWidth $fixedHeight]] test textDisp-27.10 {SizeOfTab procedure, numeric alignment} { .t delete 1.0 end .t insert 1.0 a\t123.4 .t tag delete x .t tag configure x -tabs "[expr {17.14*$fixedWidth}] numeric" .t tag add x 1.0 end list [.t bbox 1.3] [.t bbox 1.4] } [list [list [expr {round([bo]+17.14*$fixedWidth-$fixedWidth)}] [yline 1] [expr {[winfo width .t]-round([bo]+17.14*$fixedWidth-$fixedWidth)-[bo]}] $fixedHeight] \ [list [bo] [yline 2] $fixedWidth $fixedHeight]] test textDisp-27.11 {SizeOfTab procedure, making tabs at least as wide as a space} { .t delete 1.0 end .t insert 1.0 abc\tdefghijklmnopqrst .t tag delete x .t tag configure x -tabs "[expr {17.14*$fixedWidth}]" .t tag add x 1.0 end list [.t bbox 1.5] [.t bbox 1.6] } [list [list [expr {round([bo]+17.14*$fixedWidth+$fixedWidth)}] [yline 1] [expr {[winfo width .t]-round([bo]+17.14*$fixedWidth+$fixedWidth)-[bo]}] $fixedHeight] \ [list [bo] [yline 2] $fixedWidth $fixedHeight]] proc bizarre_scroll args { .t2.t delete 5.0 end } test textDisp-28.1 {"yview" option with bizarre scroll command} -setup { catch {destroy .t2} } -body { toplevel .t2 text .t2.t -width 40 -height 4 .t2.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n" pack .t2.t wm geometry .t2 +0+0 update .t2.t configure -yscrollcommand bizarre_scroll .t2.t yview 100.0 set result [.t2.t index @0,0] update lappend result [.t2.t index @0,0] } -cleanup { destroy .t2 } -result {6.0 1.0} test textDisp-29.1 {miscellaneous: lines wrap but are still too long} -setup { catch {destroy .t2} } -body { toplevel .t2 wm geometry .t2 +0+0 text .t2.t -width 20 -height 10 -font $fixedFont \ -wrap char -xscrollcommand ".t2.s set" pack .t2.t -side top scrollbar .t2.s -orient horizontal -command ".t2.t xview" pack .t2.s -side bottom -fill x .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f update set expected [list [list 0.0 [expr {20.0*$fixedWidth/300}]] \ 300x50+[bo .t2.t]+[yline 2 .t2.t] \ [list [xchar 1 .t2.t] [expr {[yline 2 .t2.t]+50}] $fixedWidth $fixedHeight]] lequal [list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]] $expected } -cleanup { destroy .t2 } -result {1} test textDisp-29.2 {miscellaneous: lines wrap but are still too long} -setup { catch {destroy .t2} } -body { toplevel .t2 wm geometry .t2 +0+0 text .t2.t -width 20 -height 10 -font $fixedFont \ -wrap char -xscrollcommand ".t2.s set" pack .t2.t -side top scrollbar .t2.s -orient horizontal -command ".t2.t xview" pack .t2.s -side bottom -fill x .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f update .t2.t xview scroll 1 unit update set expected [list [list [expr {1.0*$fixedWidth/300}] [expr {21.0*$fixedWidth/300}]] \ 300x50+[expr {[bo .t2.t]-$fixedWidth}]+[yline 2 .t2.t] \ [list [expr {[bo .t2.t]-$fixedWidth+$fixedWidth}] [expr {[yline 2 .t2.t]+50}] $fixedWidth $fixedHeight]] lequal [list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]] $expected } -cleanup { destroy .t2 } -result {1} test textDisp-29.2.1 {miscellaneous: lines wrap but are still too long} -setup { catch {destroy .t2} } -body { toplevel .t2 wm geometry .t2 +0+0 text .t2.t -width 20 -height 10 -font $fixedFont \ -wrap none -xscrollcommand ".t2.s set" pack .t2.t -side top scrollbar .t2.s -orient horizontal -command ".t2.t xview" pack .t2.s -side bottom -fill x .t2.t insert end 1\n .t2.t insert end [string repeat "abc" 30] update .t2.t xview scroll 5 unit update .t2.t xview } -cleanup { destroy .t2 } -result [list [expr {5.0/90}] [expr {25.0/90}]] test textDisp-29.2.2 {miscellaneous: lines wrap but are still too long} -setup { catch {destroy .t2} } -body { toplevel .t2 wm geometry .t2 +0+0 text .t2.t -width 20 -height 10 -font $fixedFont \ -wrap char -xscrollcommand ".t2.s set" pack .t2.t -side top scrollbar .t2.s -orient horizontal -command ".t2.t xview" pack .t2.s -side bottom -fill x .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f update .t2.t xview scroll 2 unit update set expected [list [list [expr {2.0*$fixedWidth/300}] [expr {22.0*$fixedWidth/300}]] \ 300x50+[expr {[bo .t2.t]-2*$fixedWidth}]+[yline 2 .t2.t] \ {}] lequal [list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]] $expected } -cleanup { destroy .t2 } -result {1} test textDisp-29.2.3 {miscellaneous: lines wrap but are still too long} -setup { catch {destroy .t2} } -body { toplevel .t2 wm geometry .t2 +0+0 text .t2.t -width 20 -height 10 -font $fixedFont \ -wrap char -xscrollcommand ".t2.s set" pack .t2.t -side top scrollbar .t2.s -orient horizontal -command ".t2.t xview" pack .t2.s -side bottom -fill x .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f update .t2.t xview scroll 7 pixels update set expected [list [list [expr {7.0/300}] [expr {(20.0*$fixedWidth+7)/300}]] \ 300x50+[expr {[bo .t2.t]-7}]+[yline 2 .t2.t] \ [list [expr {[bo .t2.t]+$fixedWidth-7}] [expr {[yline 2 .t2.t]+50}] $fixedWidth $fixedHeight]] lequal [list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]] $expected } -cleanup { destroy .t2 } -result {1} test textDisp-29.2.4 {miscellaneous: lines wrap but are still too long} -setup { catch {destroy .t2} } -body { toplevel .t2 wm geometry .t2 +0+0 text .t2.t -width 20 -height 10 -font $fixedFont \ -wrap char -xscrollcommand ".t2.s set" pack .t2.t -side top scrollbar .t2.s -orient horizontal -command ".t2.t xview" pack .t2.s -side bottom -fill x .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f update .t2.t xview scroll 17 pixels update set expected [list [list [expr {17.0/300}] [expr {(20.0*$fixedWidth+17)/300}]] \ 300x50+[expr {[bo .t2.t]-17}]+[yline 2 .t2.t] \ {}] lequal [list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]] $expected } -cleanup { destroy .t2 } -result {1} test textDisp-29.2.5 {miscellaneous: can show last character} -setup { catch {destroy .t2} } -body { toplevel .t2 wm geometry .t2 121x141+200+200 text .t2.t -width 5 -height 5 -font {Arial 10} \ -wrap none -xscrollcommand ".t2.s set" \ -bd 2 -highlightthickness 0 -padx 1 .t2.t insert end "WWWWWWWWWWWWi" scrollbar .t2.s -orient horizontal -command ".t2.t xview" grid .t2.t -row 0 -column 0 -sticky nsew grid .t2.s -row 1 -column 0 -sticky ew grid columnconfigure .t2 0 -weight 1 grid rowconfigure .t2 0 -weight 1 grid rowconfigure .t2 1 -weight 0 update set xv [.t2.t xview] set xd [expr {[lindex $xv 1] - [lindex $xv 0]}] .t2.t xview moveto [expr {1.0-$xd}] set iWidth [lindex [.t2.t bbox end-2c] 2] .t2.t xview scroll 2 units set iWidth2 [lindex [.t2.t bbox end-2c] 2] if {($iWidth == $iWidth2) && $iWidth >= 2} { set result "correct" } else { set result "last character is not completely visible when it should be" } } -cleanup { destroy .t2 } -result {correct} test textDisp-29.3 {miscellaneous: lines wrap but are still too long} -setup { catch {destroy .t2} } -body { toplevel .t2 wm geometry .t2 +0+0 text .t2.t -width 20 -height 10 -font $fixedFont \ -wrap char -xscrollcommand ".t2.s set" pack .t2.t -side top scrollbar .t2.s -orient horizontal -command ".t2.t xview" pack .t2.s -side bottom -fill x .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f update .t2.t xview scroll 200 units update set expected [list [list [expr {double(300-20*$fixedWidth)/300}] 1.0] \ 300x50+[expr {-(300-20*$fixedWidth-[bo .t2.t])}]+[yline 2 .t2.t] \ {}] lequal [list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]] $expected } -cleanup { destroy .t2 } -result {1} test textDisp-30.1 {elided text joining multiple logical lines} -setup { catch {destroy .t2} } -body { toplevel .t2 text .t2.t -width 20 -height 10 -font $fixedFont pack .t2.t -side top .t2.t delete 1.0 end .t2.t insert 1.0 "1111\n2222\n3333" .t2.t tag configure elided -elide 1 -background red .t2.t tag add elided 1.2 3.2 update .t2.t count -update -displaylines 1.0 end } -cleanup { destroy .t2 } -result {1} test textDisp-30.2 {elided text joining multiple logical lines} -setup { catch {destroy .t2} } -body { toplevel .t2 text .t2.t -width 20 -height 10 -font $fixedFont pack .t2.t -side top .t2.t delete 1.0 end .t2.t insert 1.0 "1111\n2222\n3333" .t2.t tag configure elided -elide 1 -background red .t2.t tag add elided 1.2 2.2 update .t2.t count -update -displaylines 1.0 end } -cleanup { destroy .t2 } -result {2} catch {destroy .t2} .t configure -height 1 update test textDisp-31.1 {line embedded window height update} { set res {} .t delete 1.0 end .t insert end "abcd\nefgh\nijkl\nmnop\nqrst\nuvwx\nyx" frame .t.f -background red -width 50 -height 100 .t window create 3.0 -window .t.f lappend res [.t count -update -ypixels 1.0 end] .t.f configure -height 10 lappend res [.t count -ypixels 1.0 end] lappend res [.t count -update -ypixels 1.0 end] } [list [expr {100+$fixedHeight*6}] \ [expr {100+$fixedHeight*6}] \ [expr {$fixedHeight*7}]] test textDisp-31.2 {line update index shifting} { set res {} .t.f configure -height 100 update lappend res [.t count -update -ypixels 1.0 end] .t.f configure -height 10 .t insert 1.0 "abc\n" .t insert 1.0 "abc\n" lappend res [.t count -ypixels 1.0 end] lappend res [.t count -update -ypixels 1.0 end] .t.f configure -height 100 .t delete 1.0 3.0 lappend res [.t count -ypixels 1.0 end] lappend res [.t count -update -ypixels 1.0 end] } [list [expr {100+$fixedHeight*6}] \ [expr {100+$fixedHeight*8}] \ [expr {$fixedHeight*9}] \ [expr {$fixedHeight*7}] \ [expr {100+$fixedHeight*6}]] test textDisp-31.3 {line update index shifting} { # Should do exactly the same as the above, as long # as we are correctly tagging the correct lines for # recalculation. The 'update' and 'delay' must be # long enough to ensure all asynchronous updates # have been performed. set res {} .t.f configure -height 100 update lappend res [.t count -update -ypixels 1.0 end] .t.f configure -height 10 .t insert 1.0 "abc\n" .t insert 1.0 "abc\n" lappend res [.t count -ypixels 1.0 end] delay lappend res [.t count -ypixels 1.0 end] .t.f configure -height 100 .t delete 1.0 3.0 lappend res [.t count -ypixels 1.0 end] delay lappend res [.t count -ypixels 1.0 end] set res } [list [expr {100+$fixedHeight*6}] \ [expr {100+$fixedHeight*8}] \ [expr {$fixedHeight*9}] \ [expr {$fixedHeight*7}] \ [expr {100+$fixedHeight*6}]] test textDisp-31.4 {line embedded image height update} { set res {} image create photo textest -height 100 -width 10 .t delete 3.0 .t image create 3.0 -image textest update lappend res [.t count -update -ypixels 1.0 end] textest configure -height 10 lappend res [.t count -ypixels 1.0 end] lappend res [.t count -update -ypixels 1.0 end] set res } [list [expr {100+$fixedHeight*6}] \ [expr {100+$fixedHeight*6}] \ [expr {$fixedHeight*7}]] test textDisp-31.5 {line update index shifting} { set res {} textest configure -height 100 update lappend res [.t count -update -ypixels 1.0 end] textest configure -height 10 .t insert 1.0 "abc\n" .t insert 1.0 "abc\n" lappend res [.t count -ypixels 1.0 end] lappend res [.t count -update -ypixels 1.0 end] textest configure -height 100 .t delete 1.0 3.0 lappend res [.t count -ypixels 1.0 end] lappend res [.t count -update -ypixels 1.0 end] set res } [list [expr {100+$fixedHeight*6}] \ [expr {100+$fixedHeight*8}] \ [expr {$fixedHeight*9}] \ [expr {$fixedHeight*7}] \ [expr {100+$fixedHeight*6}]] test textDisp-31.6 {line update index shifting} { # Should do exactly the same as the above, as long # as we are correctly tagging the correct lines for # recalculation. The 'update' and 'delay' must be # long enough to ensure all asynchronous updates # have been performed. set res {} textest configure -height 100 lappend res [.t count -update -ypixels 1.0 end] textest configure -height 10 .t insert 1.0 "abc\n" .t insert 1.0 "abc\n" lappend res [.t count -ypixels 1.0 end] delay lappend res [.t count -ypixels 1.0 end] textest configure -height 100 .t delete 1.0 3.0 lappend res [.t count -ypixels 1.0 end] delay lappend res [.t count -ypixels 1.0 end] set res } [list [expr {100+$fixedHeight*6}] \ [expr {100+$fixedHeight*8}] \ [expr {$fixedHeight*9}] \ [expr {$fixedHeight*7}] \ [expr {100+$fixedHeight*6}]] test textDisp-31.7 {line update index shifting, elided} { # The 'update' and 'delay' must be long enough to ensure all # asynchronous updates have been performed. set res {} .t delete 1.0 end lappend res [.t count -update -ypixels 1.0 end] .t insert 1.0 "abc\nabc" .t insert 1.0 "abc\n" lappend res [.t count -update -ypixels 1.0 end] .t tag configure elide -elide 1 .t tag add elide 1.3 2.1 lappend res [.t count -ypixels 1.0 end] delay lappend res [.t count -ypixels 1.0 end] .t delete 1.0 3.0 lappend res [.t count -ypixels 1.0 end] delay lappend res [.t count -ypixels 1.0 end] set res } [list [expr {$fixedHeight*1}] \ [expr {$fixedHeight*3}] \ [expr {$fixedHeight*3}] \ [expr {$fixedHeight*2}] \ [expr {$fixedHeight*1}] \ [expr {$fixedHeight*1}]] test textDisp-32.0 {everything elided} { # Must not crash pack [text .tt] .tt insert 0.0 HELLO .tt tag configure HIDE -elide 1 .tt tag add HIDE 0.0 end update destroy .tt } {} test textDisp-32.1 {everything elided} { # Must not crash pack [text .tt] update .tt insert 0.0 HELLO update .tt tag configure HIDE -elide 1 update .tt tag add HIDE 0.0 end update destroy .tt } {} test textDisp-32.2 {elide and tags} { pack [text .tt -height 30 -width 100 -bd 0 \ -highlightthickness 0 -padx 0] .tt insert end \ {test text using tags 1 and 3 } \ {testtag1 testtag3} \ {[this bit here uses tags 2 and 3]} \ {testtag2 testtag3} update # indent left margin of tag 1 by 20 pixels # text should be indented .tt tag configure testtag1 -lmargin1 20 update #1 set res {} lappend res [list [.tt index "1.0 + 0 displaychars"] \ [lindex [.tt bbox 1.0] 0] \ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]] # hide tag 1, remaining text should not be indented, since # the indented tag and character is hidden. .tt tag configure testtag1 -elide 1 update #2 lappend res [list [.tt index "1.0 + 0 displaychars"] \ [lindex [.tt bbox 1.0] 0] \ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]] # reset .tt tag configure testtag1 -lmargin1 0 .tt tag configure testtag1 -elide 0 # indent left margin of tag 2 by 20 pixels # text should not be indented, since tag1 has lmargin1 of 0. .tt tag configure testtag2 -lmargin1 20 update #3 lappend res [list [.tt index "1.0 + 0 displaychars"] \ [lindex [.tt bbox 1.0] 0] \ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]] # hide tag 1, remaining text should now be indented, but # the bbox of 1.0 should have zero width and zero indent, # since it is elided at that position. .tt tag configure testtag1 -elide 1 update #4 lappend res [list [.tt index "1.0 + 0 displaychars"] \ [lindex [.tt bbox 1.0] 0] \ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]] # reset .tt tag configure testtag2 -lmargin1 {} .tt tag configure testtag1 -elide 0 # indent left margin of tag 3 by 20 pixels # text should be indented, since this tag takes # precedence over testtag1, and is applied to the # start of the text. .tt tag configure testtag3 -lmargin1 20 update #5 lappend res [list [.tt index "1.0 + 0 displaychars"] \ [lindex [.tt bbox 1.0] 0] \ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]] # hide tag 1, remaining text should still be indented, # since it still has testtag3 on it. Again the # bbox of 1.0 should have 0. .tt tag configure testtag1 -elide 1 update #6 lappend res [list [.tt index "1.0 + 0 displaychars"] \ [lindex [.tt bbox 1.0] 0] \ [lindex [.tt bbox "1.0 + 0 displaychars"] 0]] .tt tag configure testtag3 -lmargin1 {} -elide 0 .tt tag configure testtag1 -elide 1 -lmargin1 20 #7 |
︙ | ︙ | |||
4182 4183 4184 4185 4186 4187 4188 | .tt tag configure emoticon -elide 1 .tt insert end X .tt mark set MSGLEFT "end - 1 char" .tt mark gravity MSGLEFT left .tt insert end ":)" emoticon .tt image create end -image $img pack .tt | | > > > > > > > > > > > > > > | | | | > | < | | < < < < | < | | 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 | .tt tag configure emoticon -elide 1 .tt insert end X .tt mark set MSGLEFT "end - 1 char" .tt mark gravity MSGLEFT left .tt insert end ":)" emoticon .tt image create end -image $img pack .tt update } -cleanup { image delete $img destroy .tt } test textDisp-32.4 {Button-1 click with elided lines - Bug 18371b7ce7} -setup { pack [text .tt -borderwidth 0 -highlightthickness 0] for {set n 1} {$n <= 5} {incr n} { .tt insert end "Line $n\n" } .tt tag configure Elided -elide 1 .tt tag add Elided 1.2 4.0 update } -body { event generate .tt <Button-1> -x 1 -y 1 .tt index insert } -cleanup { destroy .tt } -result {1.0} test textDisp-33.0 {one line longer than fits in the widget} { pack [text .tt -wrap char] update .tt insert 1.0 [string repeat "more wrap + " 300] update .tt see 1.0 lindex [.tt yview] 0 } {0.0} test textDisp-33.1 {one line longer than fits in the widget} { destroy .tt pack [text .tt -wrap char] update .tt insert 1.0 [string repeat "more wrap + " 300] update .tt yview "1.0 +1 displaylines" update if {[lindex [.tt yview] 0] > 0.1} { set result "window should be scrolled to the top" } else { set result "ok" } } {ok} test textDisp-33.2 {one line longer than fits in the widget} { destroy .tt pack [text .tt -wrap char] .tt debug 1 update set tk_textHeightCalc "" set timer [after 200 lappend tk_textHeightCalc "Timed out"] .tt insert 1.0 [string repeat "more wrap + " 1] vwait tk_textHeightCalc after cancel $timer set tk_textHeightCalc } {1.0} test textDisp-33.3 {one line longer than fits in the widget} { destroy .tt pack [text .tt -wrap char] set tk_textHeightCalc "" .tt insert 1.0 [string repeat "more wrap + " 300] update .tt sync # Each line should have been recalculated just once expr {[llength $tk_textHeightCalc] == [.tt count -displaylines 1.0 end]} } 1 test textDisp-33.4 {one line longer than fits in the widget} { destroy .tt pack [text .tt -wrap char] .tt insert 1.0 [string repeat "more wrap + " 300] update set idx [.tt index "1.0 + 1 displaylines"] .tt yview $idx if {[lindex [.tt yview] 0] > 0.1} { set result "window should be scrolled to the top" } else { set result "ok" } set idx [.tt index "1.0 + 1 displaylines"] set result } {ok} destroy .tt test textDisp-33.5 {bold or italic fonts} win { destroy .tt pack [text .tt -wrap char -font {{MS Sans Serif} 15}] font create no -family [lindex [.tt cget -font] 0] -size 24 font create bi -family [lindex [.tt cget -font] 0] -size 24 font configure bi -weight bold -slant italic .tt tag configure bi -font bi .tt tag configure no -font no .tt insert end abcd no efgh bi ijkl\n no update set bb {} for {set i 0} {$i < 12} {incr i 4} { lappend bb [lindex [.tt bbox 1.$i] 0] } foreach {a b c} $bb {} unset bb if {($b - $a) * 1.5 < ($c - $b)} { |
︙ | ︙ | |||
4286 4287 4288 4289 4290 4291 4292 | set txt "" for {set i 1} {$i < 100} {incr i} { append txt "Line $i\n" } set result {} } -body { .t1 insert end $txt | < | | > > > > > > > > > > > > > > > > > > > > > > | 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 | set txt "" for {set i 1} {$i < 100} {incr i} { append txt "Line $i\n" } set result {} } -body { .t1 insert end $txt set ge [winfo geometry .] scan $ge "%dx%d+%d+%d" width height left top update .t1 sync set negative 0 bind .t1 <<WidgetViewSync>> { if {%d < 0} {set negative 1} } # Without the fix for bug 2677890, changing the width of the toplevel # will launch recomputation of the line heights, but will produce negative # number of still remaining outdated lines, which is obviously wrong. # Thus we use this way to check for regression regarding bug 2677890, # i.e. to check that the fix for this bug really is still in. wm geometry . "[expr {$width * 2}]x$height+$left+$top" update .t1 sync set negative } -cleanup { destroy .t1 } -result 0 test textDisp-35.1 {Init value of charHeight - Dancing scrollbar bug 1499165} -setup { pack [text .t1] -fill both -expand y -side left # We don't want debug for this test case, because it takes some hours # if valgrind check is fully enabled. In this test case only the scrollbar # behavior is relevant, all other involved functions (insert, see, ...) are # already tested with debug mode in other test cases. .t debug off .t insert end "[string repeat a\nb\nc\n 500000]THE END\n" set res {} } -body { .t see 10000.0 after 300 {set fr1 [.t yview] ; set done 1} vwait done after 300 {set fr2 [.t yview] ; set done 1} vwait done lappend res [expr {[lindex $fr1 0] == [lindex $fr2 0]}] lappend res [expr {[lindex $fr1 1] == [lindex $fr2 1]}] } -cleanup { .t debug on ;# re-enable debugging destroy .t1 } -result {1 1} test textDisp-36.1 {Display bug with 'yview insert'} -constraints {knownBug} -setup { text .t1 -font $fixedFont -width 20 -height 3 -wrap word pack .t1 .t1 delete 1.0 end .t1 tag configure elide -elide 1 .t1 insert end "Line 1\nThis line is wrapping around two times." } -body { .t1 tag add elide 1.3 2.0 .t1 yview insert update # wish now panics: "CalculateDisplayLineHeight called with bad indexPtr" .t1 yview scroll -1 pixels } -cleanup { destroy .t1 } -result {} deleteWindows option clear # cleanup cleanupTests return |
Changes to tests/textImage.test.
1 2 3 4 5 6 | # textImage.test -- test images embedded in text widgets # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # textImage.test -- test images embedded in text widgets # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit |
︙ | ︙ | |||
382 383 384 385 386 387 388 389 390 391 | } font create test_font2 -size 5 text .t -font test_font2 -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image create end -image large .t image create end -image small -align baseline .t insert end test # Sizes larger than 25 can be too big and lead to a negative 'norm', # at least on Windows XP with certain settings. foreach size {10 15 20 25} { | > | | > | | | | | | | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | } font create test_font2 -size 5 text .t -font test_font2 -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image create end -image large .t image create end -image small -align baseline .t insert end test update # Sizes larger than 25 can be too big and lead to a negative 'norm', # at least on Windows XP with certain settings. foreach size {10 15 20 25} { font configure test_font2 -size $size array set Metrics [font metrics test_font2] update ; # services the idle "TheWorldHasChanged" event, queues "TkWorldChanged" events update ; # services the queued "TkWorldChanged" events foreach {x y w h} [.t bbox small] {} set norm [expr { (([image height large] - $Metrics(-linespace))/2 + $Metrics(-ascent) - [image height small] - $y) }] lappend result "$size $norm" } return $result } -cleanup { destroy .t image delete small large font delete test_font2 unset Metrics |
︙ | ︙ |
Changes to tests/textIndex.test.
1 2 3 4 5 | # This file is a Tcl script to test the code in the file tkTextIndex.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test the code in the file tkTextIndex.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ | |||
264 265 266 267 268 269 270 | test textIndex-4.8 {TkTextGetIndex, tags} { .t tag add z 1.0 set result [list [.t index z.first] [.t index z.last]] .t tag delete z set result } {1.0 1.1} | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | test textIndex-4.8 {TkTextGetIndex, tags} { .t tag add z 1.0 set result [list [.t index z.first] [.t index z.last]] .t tag delete z set result } {1.0 1.1} test textIndex-5.1 {TkTextGetIndex, "@"} {fonts} { .t index @12,9 } 1.1 test textIndex-5.2 {TkTextGetIndex, "@"} {fonts} { .t index @-2,7 } 1.0 test textIndex-5.3 {TkTextGetIndex, "@"} {fonts} { .t index @10,-7 |
︙ | ︙ | |||
750 751 752 753 754 755 756 757 758 759 760 761 762 763 | } set str [string repeat "hello " 20] .t insert end "$str one two three four five six seven height nine ten\n" .t insert end "$str one two three four five six seven height nine ten\n" .t insert end "$str one two three four five six seven height nine ten\n" test textIndex-19.1 {Display lines} { .t index "2.7 displaylinestart" } {2.0} test textIndex-19.2 {Display lines} { .t index "2.7 displaylineend" | > | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | } set str [string repeat "hello " 20] .t insert end "$str one two three four five six seven height nine ten\n" .t insert end "$str one two three four five six seven height nine ten\n" .t insert end "$str one two three four five six seven height nine ten\n" update test textIndex-19.1 {Display lines} { .t index "2.7 displaylinestart" } {2.0} test textIndex-19.2 {Display lines} { .t index "2.7 displaylineend" |
︙ | ︙ | |||
829 830 831 832 833 834 835 836 837 838 839 840 841 842 | .txt insert HISTORY "\n" {NICK NICK-tick} .txt insert HISTORY {[23:51] } STAMP .txt insert HISTORY "\n" {NICK NICK-tick} # Must not crash .txt index "2.0 - 2 display lines" destroy .txt .sbar } {} proc text_test_word {startend chars start} { destroy .t text .t .t insert end $chars if {[regexp {end} $start]} { set start [.t index "${start}chars -2c"] | > > > > > > > > > > > > | 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | .txt insert HISTORY "\n" {NICK NICK-tick} .txt insert HISTORY {[23:51] } STAMP .txt insert HISTORY "\n" {NICK NICK-tick} # Must not crash .txt index "2.0 - 2 display lines" destroy .txt .sbar } {} test textIndex-19.14 {Display lines with elided lines} { catch {destroy .t} pack [text .t] for {set n 1} {$n <= 1000} {incr n} { .t insert end "Line $n\n" } .t tag configure Elided -elide 1 .t tag add Elided 6.0 951.0 update set res [.t index "951.0 + 1 displaylines"] } {952.0} proc text_test_word {startend chars start} { destroy .t text .t .t insert end $chars if {[regexp {end} $start]} { set start [.t index "${start}chars -2c"] |
︙ | ︙ | |||
959 960 961 962 963 964 965 966 967 968 969 970 971 | .t2 insert end "21\n22\n23\n25\n26\n27\n28\n29\n30\n31" .t2 insert end "32\n33\n34\n36\n37\n38\n39" elided # then this used to crash Tk: .t2 see end focus -force .t2 ; # to see the cursor blink destroy .t2 } {} # cleanup rename textimage {} catch {destroy .t} cleanupTests return | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | .t2 insert end "21\n22\n23\n25\n26\n27\n28\n29\n30\n31" .t2 insert end "32\n33\n34\n36\n37\n38\n39" elided # then this used to crash Tk: .t2 see end focus -force .t2 ; # to see the cursor blink destroy .t2 } {} test textIndex-26.1 {GetIndex restricts the returned index to -starline/-endline in peers, bug [34db75c0ac]} { set res {} pack [text .t2] .t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n" pack [.t2 peer create .p2 -startline 2 -endline 3] lappend res [.p2 index "end"] lappend res [.p2 index "end lineend"] lappend res [.p2 index "end display lineend"] destroy .t2 .p2 set res } {2.0 2.0 2.0} test textIndex-26.2 {GetIndex errors out if mark, image, window, or tag is outside peer -starline/-endline, bug [34db75c0ac]} { set res {} pack [text .t2] .t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n" pack [.t2 peer create .p2 -startline 2 -endline 3] .p2 configure -startline 3 -endline {} .t2 mark set mymark 1.0 catch {.p2 index mymark} msg lappend res [.t2 index mymark] $msg image create photo redsquare -width 5 -height 5 redsquare put red -to 0 0 4 4 .t2 image create 1.0 -image redsquare catch {.p2 index redsquare} msg lappend res [.t2 index redsquare] $msg frame .f -width 10 -height 10 -bg blue .t2 window create 1.2 -window .f catch {.p2 index .f} msg lappend res [.t2 index .f] $msg .t2 tag add mytag 1.3 catch {.p2 index mytag.first} msg lappend res [.t2 index mytag.first] $msg destroy .t2 .p2 set res } {1.0 {bad text index "mymark"} 1.0 {bad text index "redsquare"} 1.2\ {bad text index ".f"} 1.3 {text doesn't contain any characters tagged with "mytag"}} # cleanup rename textimage {} catch {destroy .t} cleanupTests return |
Changes to tests/textMark.test.
1 2 3 4 5 | # This file is a Tcl script to test the code in the file tkTextMark.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test the code in the file tkTextMark.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands |
︙ | ︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 | test textMark-6.5 {insert and current marks in an empty peer - bug 3487407} -body { .t mark set insert 1.0 .t configure -startline 5 -endline 5 set res [.t index insert] } -cleanup { .t configure -startline {} -endline {} } -result {1.0} test textMark-7.1 {MarkFindNext - invalid mark name} -body { .t mark next bogus } -returnCodes error -result {bad text index "bogus"} test textMark-7.2 {MarkFindNext - marks at same location} -body { .t mark set insert 2.0 .t mark set current 2.0 | > > > > > > > > > > > | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | test textMark-6.5 {insert and current marks in an empty peer - bug 3487407} -body { .t mark set insert 1.0 .t configure -startline 5 -endline 5 set res [.t index insert] } -cleanup { .t configure -startline {} -endline {} } -result {1.0} test textMark-6.6 {attempt to move the insert mark beyond peer -endline - bug 34db75c0ac} -body { .t peer create .p -startline 1 -endline 2 pack .p update .p mark set insert 1.2 focus -force .p event generate .p <<NextLine>> ; # shall not error out set res [.p index insert] } -cleanup { destroy .p } -result {1.9} test textMark-7.1 {MarkFindNext - invalid mark name} -body { .t mark next bogus } -returnCodes error -result {bad text index "bogus"} test textMark-7.2 {MarkFindNext - marks at same location} -body { .t mark set insert 2.0 .t mark set current 2.0 |
︙ | ︙ |
Changes to tests/textTag.test.
1 2 3 4 5 | # This file is a Tcl script to test the code in the file tkTextTag.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test the code in the file tkTextTag.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ | |||
22 23 24 25 26 27 28 | testConstraint haveFontSizes [expr { [font metrics $textWidgetFont -fixed] && [font actual $textWidgetFont -size] == 12 && [font metrics $bigFont -fixed] && [font actual $bigFont -size] == 24 } ] | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | testConstraint haveFontSizes [expr { [font metrics $textWidgetFont -fixed] && [font actual $textWidgetFont -size] == 12 && [font metrics $bigFont -fixed] && [font actual $bigFont -size] == 24 } ] testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] destroy .t text .t -width 20 -height 10 pack .t -expand 1 -fill both update |
︙ | ︙ | |||
176 177 178 179 180 181 182 | } -cleanup { .t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3] } -result {on} test textTag-1.21 {configuration options} -body { .t tag configure x -overstrike stupid } -cleanup { .t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3] | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | } -cleanup { .t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3] } -result {on} test textTag-1.21 {configuration options} -body { .t tag configure x -overstrike stupid } -cleanup { .t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3] } -returnCodes error -result {expected boolean value or "" but got "stupid"} test textTag-1.21a {tag configuration options} -body { .t tag configure x -overstrikefg red .t tag cget x -overstrikefg } -cleanup { .t tag configure x -overstrikefg [lindex [.t tag configure x -overstrikefg] 3] } -result {red} test textTag-1.21b {configuration options} -body { |
︙ | ︙ | |||
297 298 299 300 301 302 303 | } -cleanup { .t tag configure x -underline [lindex [.t tag configure x -underline] 3] } -result {no} test textTag-1.35 {configuration options} -body { .t tag configure x -underline stupid } -cleanup { .t tag configure x -underline [lindex [.t tag configure x -underline] 3] | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | } -cleanup { .t tag configure x -underline [lindex [.t tag configure x -underline] 3] } -result {no} test textTag-1.35 {configuration options} -body { .t tag configure x -underline stupid } -cleanup { .t tag configure x -underline [lindex [.t tag configure x -underline] 3] } -returnCodes error -result {expected boolean value or "" but got "stupid"} test textTag-1.36 {tag configuration options} -body { .t tag configure x -underlinefg red .t tag cget x -underlinefg } -cleanup { .t tag configure x -underlinefg [lindex [.t tag configure x -underlinefg] 3] } -result {red} test textTag-1.37 {configuration options} -body { |
︙ | ︙ | |||
528 529 530 531 532 533 534 | } -cleanup { .t tag delete x } -result {-overstrikefg {} {} {} lightgreen} test textTag-5.6 {TkTextTagCmd - "configure" option} -body { .t tag configure x -overstrike foo } -cleanup { .t tag delete x | | | | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | } -cleanup { .t tag delete x } -result {-overstrikefg {} {} {} lightgreen} test textTag-5.6 {TkTextTagCmd - "configure" option} -body { .t tag configure x -overstrike foo } -cleanup { .t tag delete x } -returnCodes error -result {expected boolean value or "" but got "foo"} test textTag-5.7 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -underline stupid } -cleanup { .t tag delete x } -returnCodes error -result {expected boolean value or "" but got "stupid"} test textTag-5.8 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -justify left .t tag configure x -justify } -cleanup { .t tag delete x } -result {-justify {} {} {} left} |
︙ | ︙ | |||
1233 1234 1235 1236 1237 1238 1239 | set x5 [expr [lindex $c 0] + [lindex $c 2]/2] set y5 [expr [lindex $c 1] + [lindex $c 3]/2] .t configure -font $curFont -wrap $curWrap test textTag-15.1 {TkTextBindProc} -setup { .t tag delete x y wm geometry . +200+200 ; update | | > | 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | set x5 [expr [lindex $c 0] + [lindex $c 2]/2] set y5 [expr [lindex $c 1] + [lindex $c 3]/2] .t configure -font $curFont -wrap $curWrap test textTag-15.1 {TkTextBindProc} -setup { .t tag delete x y wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming } -body { bind .t <ButtonRelease> {lappend x up} .t tag bind x <ButtonRelease> {lappend x x-up} .t tag bind y <ButtonRelease> {lappend x y-up} set x {} .t tag add x 2.0 2.4 .t tag add y 4.3 |
︙ | ︙ | |||
1259 1260 1261 1262 1263 1264 1265 | .t tag delete x y bind .t <ButtonRelease> {} } -result {x-up up up y-up up} test textTag-15.2 {TkTextBindProc} -setup { .t tag delete x y wm geometry . +200+200 ; update | | > | 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | .t tag delete x y bind .t <ButtonRelease> {} } -result {x-up up up y-up up} test textTag-15.2 {TkTextBindProc} -setup { .t tag delete x y wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming } -body { .t tag bind x <Enter> {lappend x x-enter} .t tag bind x <Button> {lappend x x-down} .t tag bind x <ButtonRelease> {lappend x x-up} .t tag bind x <Leave> {lappend x x-leave} .t tag bind y <Enter> {lappend x y-enter} .t tag bind y <Button> {lappend x y-down} |
︙ | ︙ | |||
1288 1289 1290 1291 1292 1293 1294 | } -cleanup { .t tag delete x y } -result {x-enter | x-down | | x-up x-leave y-enter} test textTag-15.3 {TkTextBindProc} -setup { .t tag delete x y wm geometry . +200+200 ; update | | > | 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 | } -cleanup { .t tag delete x y } -result {x-enter | x-down | | x-up x-leave y-enter} test textTag-15.3 {TkTextBindProc} -setup { .t tag delete x y wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming } -body { .t tag bind x <Enter> {lappend x x-enter} .t tag bind x <Button-1> {lappend x x-down} .t tag bind x <ButtonRelease-1> {lappend x x-up} .t tag bind x <Leave> {lappend x x-leave} .t tag bind y <Enter> {lappend x y-enter} .t tag bind y <Button-1> {lappend x y-down} |
︙ | ︙ | |||
1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 | lappend x | event gen .t <ButtonRelease-2> -x $x3 -y $y3 -state 0x200 return $x } -cleanup { .t tag delete x y } -result {x-enter | x-down | | | x-up | x-leave y-enter} test textTag-16.1 {TkTextPickCurrent procedure} -setup { .t tag delete {*}[.t tag names] wm geometry . +200+200 ; update | > > > > > > > > > > > > > > > > > > | > | 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | lappend x | event gen .t <ButtonRelease-2> -x $x3 -y $y3 -state 0x200 return $x } -cleanup { .t tag delete x y } -result {x-enter | x-down | | | x-up | x-leave y-enter} test textTag-15.4 {TkTextBindProc, key event with mouse outside the widget} -setup { .t tag delete {*}[.t tag names] wm geometry . +200+200 ; update } -body { set res {} .t tag add tag1 1.0 end .t tag bind tag1 <Key> {lappend res %K} .t mark set insert 1.2 update event generate .t <Motion> -warp 1 -x -50 -y -50 controlPointerWarpTiming focus -force .t event generate .t <Key> -keysym a set res } -cleanup { .t tag delete tag1 } -result {a} test textTag-16.1 {TkTextPickCurrent procedure} -setup { .t tag delete {*}[.t tag names] wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming } -body { event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1 set x [.t index current] event gen .t <Motion> -x $x2 -y $y2 lappend x [.t index current] event gen .t <Button-1> -x $x2 -y $y2 lappend x [.t index current] |
︙ | ︙ | |||
1345 1346 1347 1348 1349 1350 1351 | } -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3} test textTag-16.2 {TkTextPickCurrent procedure} -constraints { haveFontSizes failsOnUbuntuNoXft } -setup { .t tag delete {*}[.t tag names] wm geometry . +200+200 ; update | | > > > | > | 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 | } -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3} test textTag-16.2 {TkTextPickCurrent procedure} -constraints { haveFontSizes failsOnUbuntuNoXft } -setup { .t tag delete {*}[.t tag names] wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont # update needed here to stabilize the test update event gen .t <ButtonRelease-1> -state 0x100 -x $x4 -y $y4 event gen .t <Motion> -x $x5 -y $y5 set x [.t index current] .t tag add big 3.0 update lappend x [.t index current] } -cleanup { .t tag delete big .t configure -font $curFont -wrap $curWrap } -result {3.2 3.1} test textTag-16.3 {TkTextPickCurrent procedure} -setup { foreach i {a b c d} { .t tag remove $i 1.0 end } wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming } -body { foreach i {a b c d} { .t tag bind $i <Enter> "lappend x enter-$i" .t tag bind $i <Leave> "lappend x leave-$i" } .t tag lower b .t tag lower a |
︙ | ︙ | |||
1393 1394 1395 1396 1397 1398 1399 | } -result {enter-a enter-b | leave-b enter-c | leave-a leave-c} test textTag-16.4 {TkTextPickCurrent procedure} -setup { foreach i {a b c d} { .t tag remove $i 1.0 end } wm geometry . +200+200 ; update | | > | 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | } -result {enter-a enter-b | leave-b enter-c | leave-a leave-c} test textTag-16.4 {TkTextPickCurrent procedure} -setup { foreach i {a b c d} { .t tag remove $i 1.0 end } wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming } -body { foreach i {a b c d} { .t tag bind $i <Enter> "lappend x enter-$i" .t tag bind $i <Leave> "lappend x leave-$i" } .t tag lower b .t tag lower a |
︙ | ︙ | |||
1422 1423 1424 1425 1426 1427 1428 | test textTag-16.5 {TkTextPickCurrent procedure} -constraints { haveFontSizes } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end } wm geometry . +200+200 ; update | | > | > | 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 | test textTag-16.5 {TkTextPickCurrent procedure} -constraints { haveFontSizes } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end } wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont event gen .t <Motion> -x $x4 -y $y4 .t tag bind a <Enter> {.t tag add big 3.0 3.2} .t tag add a 3.2 event gen .t <Motion> -x $x5 -y $y5 .t index current } -cleanup { .t tag delete a big .t configure -font $curFont -wrap $curWrap } -result {3.2} test textTag-16.6 {TkTextPickCurrent procedure} -constraints { haveFontSizes failsOnUbuntuNoXft } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end } wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont event gen .t <Motion> -x $x4 -y $y4 .t tag bind a <Enter> {.t tag add big 3.0 3.2} .t tag add a 3.2 event gen .t <Motion> -x $x5 -y $y5 |
︙ | ︙ | |||
1465 1466 1467 1468 1469 1470 1471 | test textTag-16.7 {TkTextPickCurrent procedure} -constraints { haveFontSizes failsOnUbuntuNoXft } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end } wm geometry . +200+200 ; update | | > | 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | test textTag-16.7 {TkTextPickCurrent procedure} -constraints { haveFontSizes failsOnUbuntuNoXft } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end } wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont .t tag bind a <Enter> {.t tag add big 3.0 3.2} .t tag add a 3.2 event gen .t <Motion> -x $x4 -y $y4 |
︙ | ︙ | |||
1498 1499 1500 1501 1502 1503 1504 | .t dump -tag 1.0 end } -result {tagon x 1.0 tagoff x 1.4 tagon y 2.0 tagoff y 2.4} test textTag-18.1 {TkTextPickCurrent tag bindings} -setup { destroy .t wm geometry . +200+200 ; update | | > > > > > | | 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | .t dump -tag 1.0 end } -result {tagon x 1.0 tagoff x 1.4 tagon y 2.0 tagoff y 2.4} test textTag-18.1 {TkTextPickCurrent tag bindings} -setup { destroy .t wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming } -body { text .t -width 30 -height 4 -relief sunken -borderwidth 10 \ -highlightthickness 10 -pady 2 pack .t update ; # map the window, otherwise -warp can't be done .t insert end " Tag here " TAG " no tag here" .t tag configure TAG -borderwidth 4 -relief raised .t tag bind TAG <Enter> {lappend res "%x %y tag-Enter"} .t tag bind TAG <Leave> {lappend res "%x %y tag-Leave"} bind .t <Enter> {lappend res Enter} bind .t <Leave> {lappend res Leave} set res {} # Bindings must not trigger on the widget border, only over # the actual tagged characters themselves. # Note that we don't need to call controlPointerWarpTiming # in the following six calls because we're not checking that # the mouse pointer has actually moved but rather that the # tag binding mechanism of the text widget correctly triggers. event gen .t <Motion> -warp 1 -x 0 -y 0 ; update event gen .t <Motion> -warp 1 -x 10 -y 10 ; update event gen .t <Motion> -warp 1 -x 25 -y 25 ; update event gen .t <Motion> -warp 1 -x 20 -y 20 ; update event gen .t <Motion> -warp 1 -x 10 -y 10 ; update event gen .t <Motion> -warp 1 -x 25 -y 25 ; update set res } -cleanup { destroy .t } -result {Enter {25 25 tag-Enter} {20 20 tag-Leave} {25 25 tag-Enter}} destroy .t # cleanup cleanupTests return |
Changes to tests/textWind.test.
1 2 3 4 5 | # This file is a Tcl script to test the code in the file tkTextWind.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # This file is a Tcl script to test the code in the file tkTextWind.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands deleteWindows set fixedFont {"Courier" -12} set fixedHeight [font metrics $fixedFont -linespace] set fixedWidth [font measure $fixedFont m] set fixedAscent [font metrics $fixedFont -ascent] |
︙ | ︙ | |||
353 354 355 356 357 358 359 360 361 | test textWind-3.3 {EmbWinConfigure procedure} -setup { destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color .t window create 1.3 -window .f update .t window configure 1.3 -window {} update | > < | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | test textWind-3.3 {EmbWinConfigure procedure} -setup { destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color .t window create 1.3 -window .f update set res [winfo ismapped .f] .t window configure 1.3 -window {} update lappend res [winfo ismapped .f] [.t bbox 1.4] } -cleanup { destroy .f } -result [list 1 0 \ [list [expr {$padx+3*$fixedWidth}] $pady $fixedWidth $fixedHeight]] test textWind-3.4 {EmbWinConfigure procedure} -setup { destroy .t.f } -body { .t insert 1.0 "Some sample text" frame .t.f -width 10 -height 20 -bg $color |
︙ | ︙ | |||
383 384 385 386 387 388 389 390 391 | test textWind-3.5 {EmbWinConfigure procedure} -setup { destroy .t.f } -body { .t insert 1.0 "Some sample text" frame .t.f -width 10 -height 20 -bg $color .t window create 1.3 -window .t.f update .t window configure 1.3 -window {} update | > < | | | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | test textWind-3.5 {EmbWinConfigure procedure} -setup { destroy .t.f } -body { .t insert 1.0 "Some sample text" frame .t.f -width 10 -height 20 -bg $color .t window create 1.3 -window .t.f update set res [winfo ismapped .t.f] .t window configure 1.3 -window {} update lappend res [winfo ismapped .t.f] [.t bbox 1.4] } -cleanup { destroy .t.f } -result [list 1 0 \ [list [expr {$padx+3*$fixedWidth}] $pady $fixedWidth $fixedHeight]] test textWind-3.6 {EmbWinConfigure procedure} -setup { destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color |
︙ | ︙ | |||
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | frame .f frame .f.f -width 15 -height 20 -bg $color pack .f.f .t window create 1.3 -window .f.f } -cleanup { destroy .f } -returnCodes error -result {can't embed .f.f in .t} test textWind-3.8 {EmbWinConfigure procedure} -setup { destroy .t2 } -body { .t insert 1.0 "Some sample text" toplevel .t2 -width 20 -height 10 -bg $color .t window create 1.3 .t window configure 1.3 -window .t2 } -cleanup { destroy .t2 } -returnCodes error -result {can't embed .t2 in .t} test textWind-3.9 {EmbWinConfigure procedure} -setup { destroy .t2 } -body { .t insert 1.0 "Some sample text" toplevel .t2 -width 20 -height 10 -bg $color .t window create 1.3 catch {.t window configure 1.3 -window .t2} .t window configure 1.3 -window } -cleanup { destroy .t2 } -result {-window {} {} {} {}} test textWind-3.10 {EmbWinConfigure procedure} -setup { .t delete 1.0 end } -body { .t insert 1.0 "Some sample text" .t window create 1.3 .t window configure 1.3 -window .t } -returnCodes error -result {can't embed .t in .t} test textWind-3.11 {EmbWinConfigure procedure} -setup { .t delete 1.0 end } -body { # This test checks for various errors when the text claims # a window away from itself. .t insert 1.0 "Some sample text" button .t.b -text "Hello!" | > > > > | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | frame .f frame .f.f -width 15 -height 20 -bg $color pack .f.f .t window create 1.3 -window .f.f } -cleanup { destroy .f } -returnCodes error -result {can't embed .f.f in .t} test textWind-3.8 {EmbWinConfigure procedure} -setup { destroy .t2 } -body { .t insert 1.0 "Some sample text" toplevel .t2 -width 20 -height 10 -bg $color .t window create 1.3 .t window configure 1.3 -window .t2 } -cleanup { destroy .t2 } -returnCodes error -result {can't embed .t2 in .t} test textWind-3.9 {EmbWinConfigure procedure} -setup { destroy .t2 } -body { .t insert 1.0 "Some sample text" toplevel .t2 -width 20 -height 10 -bg $color .t window create 1.3 catch {.t window configure 1.3 -window .t2} .t window configure 1.3 -window } -cleanup { destroy .t2 } -result {-window {} {} {} {}} test textWind-3.10 {EmbWinConfigure procedure} -setup { .t delete 1.0 end } -body { .t insert 1.0 "Some sample text" .t window create 1.3 .t window configure 1.3 -window .t } -returnCodes error -result {can't embed .t in .t} test textWind-3.11 {EmbWinConfigure procedure} -setup { .t delete 1.0 end } -body { # This test checks for various errors when the text claims # a window away from itself. .t insert 1.0 "Some sample text" button .t.b -text "Hello!" |
︙ | ︙ | |||
760 761 762 763 764 765 766 | } -body { .t insert 1.0 "Some sample text" set msg {} .t window create 1.5 -create { frame .t.f frame .t.f.f -width 10 -height 20 -bg $color } | | | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | } -body { .t insert 1.0 "Some sample text" set msg {} .t window create 1.5 -create { frame .t.f frame .t.f.f -width 10 -height 20 -bg $color } update lappend msg [winfo exists .t.f.f] } -cleanup { destroy .t.f rename bgerror {} } -result {{{can't embed .t.f.f relative to .t}} 1} test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup { |
︙ | ︙ | |||
790 791 792 793 794 795 796 | lappend msg [.t bbox 1.5] } -cleanup { rename bgerror {} } -result [list \ {{can't embed .t relative to .t}} \ [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] | | | | 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | lappend msg [.t bbox 1.5] } -cleanup { rename bgerror {} } -result [list \ {{can't embed .t relative to .t}} \ [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end destroy .t2 proc bgerror args { global msg lappend msg $args } } -body { .t insert 1.0 "Some sample text" .t window create 1.5 -create { toplevel .t2 -width 100 -height 150 wm geom .t2 +0+0 concat .t2 } set msg {} update idletasks ; after 100 ; update lappend msg [.t bbox 1.5] } -cleanup { rename bgerror {} } -result [list \ {{can't embed .t2 relative to .t}} {{window name "t2" already exists in parent}} \ [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] |
︙ | ︙ | |||
952 953 954 955 956 957 958 | {}] test textWind-11.1 {EmbWinDisplayProc procedure, geometry transforms} -setup { .t delete 1.0 end destroy .f place forget .t pack .t | | > | | > | | | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 | {}] test textWind-11.1 {EmbWinDisplayProc procedure, geometry transforms} -setup { .t delete 1.0 end destroy .f place forget .t pack .t # Make sure the Text is mapped before we start update } -body { .t insert 1.0 "Some sample text" pack forget .t place .t -x 30 -y 50 update frame .f -width 30 -height 20 -bg $color .t window create 1.12 -window .f update winfo geom .f } -cleanup { destroy .f place forget .t } -result [list 30x20+[expr {$padx+30+12*$fixedWidth}]+[expr {$pady+50}]] test textWind-11.2 {EmbWinDisplayProc procedure, geometry transforms} -setup { .t delete 1.0 end destroy .t.f place forget .t pack .t # Make sure the Text is mapped before we start update } -body { .t insert 1.0 "Some sample text" pack forget .t place .t -x 30 -y 50 update frame .t.f -width 30 -height 20 -bg $color .t window create 1.12 -window .t.f update winfo geom .t.f } -cleanup { destroy .t.f place forget .t pack .t } -result [list 30x20+[expr {$padx+12*$fixedWidth}]+$pady] test textWind-11.3 {EmbWinDisplayProc procedure, configuration optimization} -setup { .t delete 1.0 end destroy .f place forget .t pack .t # Make sure the Text is mapped before we start update } -body { .t insert 1.0 "Some sample text" frame .f -width 30 -height 20 -bg $color .t window create 1.12 -window .f update bind .f <Configure> {set x ".f configured"} |
︙ | ︙ | |||
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | update lappend x modified .t delete 1.0 update lappend x replaced .t window configure .f -window {} .t delete 1.1 .t window create 1.4 -window .f update lappend x off-screen .t configure -wrap none .t insert 1.0 "Enough text to make the line run off-screen" update return $x | > | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | update lappend x modified .t delete 1.0 update lappend x replaced .t window configure .f -window {} .t delete 1.1 update .t window create 1.4 -window .f update lappend x off-screen .t configure -wrap none .t insert 1.0 "Enough text to make the line run off-screen" update return $x |
︙ | ︙ | |||
1402 1403 1404 1405 1406 1407 1408 | } -body { pack [text .t] .t insert end "Line 1" frame .f -width 20 -height 10 -bg blue .t window create 1.3 -window .f toplevel .tt pack [.t peer create .tt.t] | | | | | | | | | | > > > > > > > > > | | > > > > > > > > > | > > | | > | | > | | > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 | } -body { pack [text .t] .t insert end "Line 1" frame .f -width 20 -height 10 -bg blue .t window create 1.3 -window .f toplevel .tt pack [.t peer create .tt.t] update destroy .t .tt winfo exists .f } -result 0 test textWind-17.2 {peer widgets and embedded windows} -setup { destroy .t .f .tt } -body { pack [text .t] .t insert end "Line 1\nLine 2" frame .f -width 20 -height 10 -bg blue .t window create 1.4 -window .f toplevel .tt pack [.t peer create .tt.t] update destroy .t .tt.t insert 1.0 "foo" update destroy .tt } -result {} test textWind-17.3 {peer widget and -create} -setup { destroy .t .tt } -body { pack [text .t] .t delete 1.0 end .t insert 1.0 "Some sample text" toplevel .tt pack [.t peer create .tt.t] update .t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue} update destroy .t .tt } -result {} test textWind-17.4 {peer widget deleted one window shouldn't delete others} -setup { destroy .t .tt set res {} } -body { pack [text .t] .t delete 1.0 end .t insert 1.0 "Some sample text" toplevel .tt pack [.t peer create .tt.t] .t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue} update destroy .tt lappend res [.t get 1.2] update lappend res [.t get 1.2] } -cleanup { destroy .t } -result {{} {}} test textWind-17.5 {peer widget window configuration} -setup { destroy .t .tt } -body { pack [text .t] .t delete 1.0 end .t insert 1.0 "Some sample text" toplevel .tt pack [.t peer create .tt.t] .t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue} update list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window] } -cleanup { destroy .tt .t } -result {.t.f .tt.t.f} test textWind-17.6 {peer widget window configuration} -setup { destroy .t .tt } -body { pack [text .t] .t delete 1.0 end .t insert 1.0 "Some sample text" toplevel .tt pack [.t peer create .tt.t] .t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue} update list [.t window configure 1.2 -window] \ [.tt.t window configure 1.2 -window] } -cleanup { destroy .tt .t } -result {{-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}} test textWind-17.7 {peer widget window configuration} -setup { destroy .t .tt } -body { pack [text .t] .t delete 1.0 end .t insert 1.0 "Some sample text" toplevel .tt pack [.t peer create .tt.t] .t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue] update list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window] } -cleanup { destroy .tt .t } -result {.t.f {}} test textWind-17.8 {peer widget window configuration} -setup { destroy .t .tt } -body { pack [text .t] .t delete 1.0 end .t insert 1.0 "Some sample text" toplevel .tt pack [.t peer create .tt.t] .t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue] update list [.t window configure 1.2 -window] \ [.tt.t window configure 1.2 -window] } -cleanup { destroy .tt .t } -result {{-window {} {} {} .t.f} {-window {} {} {} {}}} test textWind-17.9 {peer widget window configuration} -setup { destroy .t .tt } -body { pack [text .t] .t delete 1.0 end .t insert 1.0 "Some sample text" toplevel .tt pack [.t peer create .tt.t] .t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue] update .tt.t window configure 1.2 -window [frame .tt.t.f -width 10 -height 20 -bg red] list [.t window configure 1.2 -window] [.tt.t window configure 1.2 -window] } -cleanup { destroy .tt .t } -result {{-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}} test textWind-17.10 {peer widget window configuration} -setup { destroy .t .tt } -body { set res {} pack [text .t] .t delete 1.0 end .t insert 1.0 "Some sample text" toplevel .tt pack [.t peer create .tt.t] update .t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue] update # There is a blue window in the main widget .t but not in the peer .tt.t lappend res [.t window cget 1.2 -window] lappend res [.tt.t window cget 1.2 -window] # Insert a green window in the peer. Warning: the blue window previously # inserted in .t at index 1.2 will now be found in .t at index 1.3 # The underlying linked segments are common in a text widget and its peers. .tt.t window create 1.2 -window [frame .tt.t.f -width 25 -height 20 -bg green] update lappend res [.t window cget 1.2 -window] lappend res [.t window cget 1.3 -window] # In the peer, the green window still is at 1.2, and there is no window at 1.3 lappend res [.tt.t window cget 1.2 -window] lappend res [.tt.t window cget 1.3 -window] # Insert a red window in .t at index 1.2. This replaces the blue window originally at 1.2 # in .t, because the green window inserted in the peer is not visible from .t, therefore # the embedded window found at index 1.2 in .t is the one originally at 1.2 in .t, i.e. # the blue one .t window configure 1.2 -create {destroy %W.f ; update ; frame %W.f -width 50 -height 7 -bg red} update # The main widget .t still has a window named .t.f at 1.2. This is NOT the blue # frame but the red frame from the -create script, which bears the same name. lappend res [.t window cget 1.2 -window] # The peer still has its green .tt.t.f at 1.2 lappend res [.tt.t window cget 1.2 -window] # When removing the -window option the create script plays, therefore .t still has # the red frame .t.f at 1.2 .t window configure 1.2 -window {} update lappend res [.t window cget 1.2 -window] # The -create script associated to index 1.2 applies to all peers (that's the reason # why the manual states that "If multiple peer widgets are in use, it is usually simpler # to use the -create option if embedded windows are desired in each peer."). Therefore # when removing the -window option in the peer, the -create script is run, which replaces # the green frame by the red one named as per the -create script, i.e. .tt.t.f .tt.t window configure 1.2 -window {} update lappend res [.tt.t window cget 1.2 -window] } -cleanup { destroy .tt .t } -result {.t.f {} {} .t.f .tt.t.f {} .t.f .tt.t.f .t.f .tt.t.f} test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} -setup { catch {destroy .t .f .f2} } -body { pack [text .t] for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} .t window create end -window [frame .f -background red -width 80 -height 80] .t window create end -window [frame .f2 -background blue -width 80 -height 80] bind .f <Map> {.t delete .f} update # this shall not crash (bug 1501749) after 100 {.t yview end} tkwait visibility .f2 after 200 update } -cleanup { destroy .t .f .f2 } -result {} test textWind-18.2 {text widget deletion triggered by a script bound to embedded window mapping} -setup { catch {destroy .t .f} } -body { pack [text .t] for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} .t window create end -window [frame .f -background red -width 80 -height 80] bind .f <Map> {destroy .t} update # this shall not crash (bug 1501749) after 100 {.t yview end} tkwait window .t } -cleanup { destroy .t .f } -result {} test textWind-18.3 {embedded window destruction in cascade} -setup { catch {destroy .t .f} set x 0 } -body { pack [text .t] button .t.b1 .t window create 1.0 -window .t.b1 bind .t.b1 <Destroy> {destroy .t.b2 ; set x 1} button .t.b2 .t window create 2.0 -window .t.b2 update # this shall not crash (bug 54fe7a5e71) after 100 {.t delete 1.0 end} tkwait variable x } -cleanup { destroy .t .f } -result {} option clear # cleanup cleanupTests return |
Changes to tests/tk.test.
1 2 3 4 | # This file is a Tcl script to test the tk command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # This file is a Tcl script to test the tk command. # It is organized in the standard fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 2002 ActiveState Corporation. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint testprintf [llength [info command testprintf]] test tk-1.1 {tk command: general} -body { tk } -returnCodes error -result {wrong # args: should be "tk subcommand ?arg ...?"} test tk-1.2 {tk command: general} -body { tk xyz } -returnCodes error -result {unknown or ambiguous subcommand "xyz": must be appname, busy, caret, fontchooser, inactive, print, scaling, sysnotify, systray, useinputmethods, or windowingsystem} # Value stored to restore default settings after 2.* tests set appname [tk appname] test tk-2.1 {tk command: appname} -body { tk appname xyz abc } -returnCodes error -result {wrong # args: should be "tk appname ?newName?"} test tk-2.2 {tk command: appname} -body { |
︙ | ︙ | |||
155 156 157 158 159 160 161 | tk inactive reset foo } -returnCodes 1 -result {wrong # args: should be "tk inactive ?-displayof window? ?reset?"} test tk-6.5 {tk inactive} -body { tk inactive reset update after 100 set i [tk inactive] | | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | tk inactive reset foo } -returnCodes 1 -result {wrong # args: should be "tk inactive ?-displayof window? ?reset?"} test tk-6.5 {tk inactive} -body { tk inactive reset update after 100 set i [tk inactive] expr {$i < 0 || ( $i > 90 && $i < 300 )} } -result 1 test tk-7.1 {tk inactive in a safe interpreter} -body { # tk inactive in safe interpreters safe::interpCreate foo safe::loadTk foo foo eval {tk inactive} |
︙ | ︙ |
Changes to tests/ttk/all.tcl.
1 2 3 4 5 6 | # all.tcl -- # # This file contains a top-level script to run all of the ttk # tests. Execute it by invoking "source all.tcl" when running tktest # in this directory. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # all.tcl -- # # This file contains a top-level script to run all of the ttk # tests. Execute it by invoking "source all.tcl" when running tktest # in this directory. # # Copyright © 2007 the Tk developers. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package require tk ;# This is the Tk test suite; fail early if no Tk! package require tcltest 2.2 tcltest::configure {*}$argv tcltest::configure -testdir [file normalize [file dirname [info script]]] tcltest::configure -loadfile \ [file join [file dirname [tcltest::testsDirectory]] constraints.tcl] tcltest::configure -singleproc 1 set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)] |
︙ | ︙ |
Changes to tests/ttk/checkbutton.test.
1 2 3 4 | # # ttk::checkbutton widget tests. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # # ttk::checkbutton widget tests. # package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test checkbutton-1.1 "Checkbutton check" -body { pack [ttk::checkbutton .cb -text "TCheckbutton" -variable cb] } |
︙ | ︙ | |||
67 68 69 70 71 72 73 74 | # shall simply not crash ttk::checkbutton .cbev -variable {} .cbev invoke } -cleanup { destroy .cbev } -result {} tcltest::cleanupTests | > > > > > > > > > > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # shall simply not crash ttk::checkbutton .cbev -variable {} .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 |
Changes to tests/ttk/combobox.test.
1 2 3 4 | # # ttk::combobox widget tests # | | | | | | | > > > > > > > > > > > > > > > > | > > | > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | # # ttk::combobox widget tests # package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test combobox-1.0 "Combobox tests -- setup" -body { ttk::combobox .cb } -result .cb test combobox-1.1 "Bad -values list" -body { .cb configure -values "bad \{list" } -result "unmatched open brace in list" -returnCodes error test combobox-1.end "Combobox tests -- cleanup" -body { destroy .cb } test combobox-2.0 "current command" -body { ttk::combobox .cb -values [list a b c d e a] expr {[.cb current]<0} } -result 1 test combobox-2.1 "current -- set index" -body { .cb current 5 .cb get } -result a test combobox-2.2 "current -- change -values" -body { .cb configure -values [list c b a d e] .cb current } -result 2 test combobox-2.3 "current -- change value" -body { .cb set "b" .cb current } -result 1 test combobox-2.4 "current -- value not in list" -body { .cb set "z" expr {[.cb current]<0} } -result 1 test combobox-2.5 "current -- set to end index" -body { .cb configure -values [list a b c d e thelastone] .cb current end .cb get } -result thelastone test combobox-2.6 "current -- set to unknown index" -body { .cb configure -values [list a b c d e] .cb current notanindex } -returnCodes error -result {bad index "notanindex"} test combobox-2.7 {current -- set to 0 index when empty [bug 924835c36d]} -body { .cb configure -values {} .cb current 0 } -returnCodes error -result {index "0" out of range} test combobox-2.8 "current -- set to end index in an empty combobox" -body { .cb configure -values {} .cb current end } -returnCodes error -result {index "end" out of range} test combobox-2.end "Cleanup" -body { destroy .cb } test combobox-3 "Read postoffset value dynamically from current style" -body { ttk::combobox .cb -values [list a b c] -style "DerivedStyle.TCombobox" pack .cb -expand true -fill both update idletasks ttk::style configure DerivedStyle.TCombobox -postoffset [list 25 0 0 0] if {[tk windowingsystem] == "aqua"} { after 500 { pressbutton [expr {[winfo rootx .cb] + 25}] [expr {[winfo rooty .cb] + 25}] } } ttk::combobox::Post .cb expr {[winfo rootx .cb.popdown] - [winfo rootx .cb]} } -result 25 -cleanup { destroy .cb } test combobox-1890211 "ComboboxSelected event after listbox unposted" \ -constraints {notAqua} -body { # whitebox test... pack [ttk::combobox .cb -values [list a b c]] update idletasks set result [list] bind .cb <<ComboboxSelected>> { lappend result Event [winfo ismapped .cb.popdown] [.cb get] } lappend result Start 0 [.cb get] ttk::combobox::Post .cb lappend result Post [winfo ismapped .cb.popdown] [.cb get] .cb.popdown.f.l selection clear 0 end; .cb.popdown.f.l selection set 1 ttk::combobox::LBSelected .cb.popdown.f.l lappend result Select [winfo ismapped .cb.popdown] [.cb get] update 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 |
Changes to tests/ttk/entry.test.
1 2 3 4 | # # Tile package: entry widget tests # | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # # Tile package: entry widget tests # package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] variable scrollInfo proc scroll args { global scrollInfo set scrollInfo $args } |
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | test entry-1.7 "Deletion - insert cursor in the middle " -body { .e insert end abcde .e icursor 3 .e delete 0 end .e index insert } -result 0 test entry-1.done "Cleanup" -body { destroy .e } # Scrollbar tests. test entry-2.1 "Create entry before scrollbar" -body { pack [ttk::entry .te -xscrollcommand [list .tsb set]] \ -expand true -fill both pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \ | > > > > > > | | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | test entry-1.7 "Deletion - insert cursor in the middle " -body { .e insert end abcde .e icursor 3 .e delete 0 end .e index insert } -result 0 test entry-1.8 "Index is between 0 and end" -constraints deprecated -body { .e delete 0 end .e insert end abcde set res [list [.e index -1] [.e index -4] [.e index 999]] } -result {0 0 5} test entry-1.done "Cleanup" -body { destroy .e } # Scrollbar tests. test entry-2.1 "Create entry before scrollbar" -body { pack [ttk::entry .te -xscrollcommand [list .tsb set]] \ -expand true -fill both pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \ -expand false -fill x } -cleanup {destroy .te .tsb} test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constraints {failsOnUbuntu failsOnXQuarz} -body { pack [ttk::entry .te -xscrollcommand [list .tsb set]] \ -expand true -fill both .te insert end [string repeat "abc" 50] catch {update} ; # error triggers because the -xscrollcommand callback # errors out: invalid command name ".tsb" pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \ -expand false -fill x update ; # no error set res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update } -result 1 -cleanup {destroy .te .tsb} test entry-2.2 "Initial scroll position" -body { ttk::entry .e -font fixed -width 5 -xscrollcommand scroll .e insert end "0123456789" pack .e; set timeout [after 500 {set $scrollInfo "timeout"}] |
︙ | ︙ | |||
305 306 307 308 309 310 311 | .e cget -textvariable } -result ::test::foo -cleanup { destroy .e } # For 8.2a, -result {} would also be sensible. test entry-9.1 "Index range invariants" -setup { # See bug#1721532 for discussion proc entry-9.1-trace {n1 n2 op} { | | | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | .e cget -textvariable } -result ::test::foo -cleanup { destroy .e } # For 8.2a, -result {} would also be sensible. test entry-9.1 "Index range invariants" -setup { # See bug#1721532 for discussion proc entry-9.1-trace {n1 n2 op} { set ::V NO! } variable V trace add variable V write entry-9.1-trace ttk::entry .e -textvariable V } -body { set result [list] .e insert insert a ; lappend result [.e index insert] [.e index end] |
︙ | ︙ | |||
365 366 367 368 369 370 371 372 | set res [.e state] event generate .e <FocusOut> lappend res [.e state] } -result {invalid invalid} -cleanup { destroy .e } tcltest::cleanupTests | > > > > > > > > > > > > > > | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | set res [.e state] event generate .e <FocusOut> 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 |
Changes to tests/ttk/image.test.
|
| | | 1 2 3 4 5 6 7 8 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test image-1.1 "Bad image element" -body { ttk::style element create BadImage image badimage } -returnCodes error -result {image "badimage" doesn't exist} |
︙ | ︙ |
Changes to tests/ttk/labelframe.test.
|
| | | 1 2 3 4 5 6 7 8 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test labelframe-1.0 "Setup" -body { pack [ttk::labelframe .lf] -expand true -fill both } |
︙ | ︙ | |||
92 93 94 95 96 97 98 | .lf configure -labelwidget .cb list [update; winfo viewable .cb] [winfo manager .cb] } -result [list 1 labelframe] test labelframe-4.4 "Re-manage nonchild content" -body { pack .cb -side right list [update; winfo viewable .cb] \ | | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | .lf configure -labelwidget .cb list [update; winfo viewable .cb] [winfo manager .cb] } -result [list 1 labelframe] test labelframe-4.4 "Re-manage nonchild content" -body { pack .cb -side right list [update; winfo viewable .cb] \ [winfo manager .cb] \ [.lf cget -labelwidget] } -result [list 1 pack {}] test labelframe-4.5 "Re-add nonchild content" -body { .lf configure -labelwidget .cb list [update; winfo viewable .cb] \ [winfo manager .cb] \ [.lf cget -labelwidget] } -result [list 1 labelframe .cb] test labelframe-4.6 "Destroy nonchild content" -body { destroy .cb .lf cget -labelwidget } -result {} |
︙ | ︙ | |||
124 125 126 127 128 129 130 131 | pack [ttk::labelframe .t.lf -labelwidget [ttk::label .t.lb]] pack [ttk::checkbutton .t.x2] winfo children .t } -cleanup { destroy .t } -result [list .t.x1 .t.lf .t.lb .t.x2] tcltest::cleanupTests | > > > > > > > > > > > > > > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | pack [ttk::labelframe .t.lf -labelwidget [ttk::label .t.lb]] pack [ttk::checkbutton .t.x2] 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 |
Changes to tests/ttk/layout.test.
|
| | | 1 2 3 4 5 6 7 8 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test layout-1.1 "Size computations for mixed-orientation layouts" -body { ttk::style theme use default |
︙ | ︙ |
Changes to tests/ttk/notebook.test.
|
| | | 1 2 3 4 5 6 7 8 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test notebook-1.0 "Setup" -body { ttk::notebook .nb } -result .nb |
︙ | ︙ | |||
63 64 65 66 67 68 69 70 71 72 | test notebook-2.4 "tab - set value" -body { .nb tab .nb.foo -text "Changed Foo" .nb tab .nb.foo -text } -result "Changed Foo" test notebook-2.5 "tab - get all options" -body { .nb tab .nb.foo } -result [list \ -padding 0 -sticky nsew \ | > | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | test notebook-2.4 "tab - set value" -body { .nb tab .nb.foo -text "Changed Foo" .nb tab .nb.foo -text } -result "Changed Foo" test notebook-2.5 "tab - get all options" -body { .nb tab .nb.foo -underline 0 .nb tab .nb.foo } -result [list \ -padding 0 -sticky nsew \ -state normal -text "Changed Foo" -image "" -compound {} -underline 0] test notebook-4.1 "Test .nb index end" -body { .nb index end } -result 2 test notebook-4.2 "'end' is not a selectable index" -body { .nb select end |
︙ | ︙ | |||
92 93 94 95 96 97 98 | test notebook-5.1 "Virtual events" -body { toplevel .t set ::events [list] bind .t <<NotebookTabChanged>> { lappend events changed %W } pack [set nb [ttk::notebook .t.nb]] -expand true -fill both; update | | | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | test notebook-5.1 "Virtual events" -body { toplevel .t set ::events [list] bind .t <<NotebookTabChanged>> { lappend events changed %W } pack [set nb [ttk::notebook .t.nb]] -expand true -fill both; update $nb add [frame $nb.f1] ; # triggers <<NotebookTabChanged>> (first tab gets autoselected) $nb add [frame $nb.f2] $nb add [frame $nb.f3] update $nb select $nb.f1 ; # does not trigger <<NotebookTabChanged>> (tab to select is already selected) update; set events } -result [list changed .t.nb] test notebook-5.2 "Virtual events, continued" -body { set events [list] $nb select $nb.f3 update ; set events |
︙ | ︙ | |||
152 153 154 155 156 157 158 159 | $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f2 lappend result [$nb index current] [winfo ismapped $nb.f2] | > | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f2 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f2] lappend result [winfo ismapped $nb.f3] } -result [list 1 1 2 0 1] # See 1370833 test notebook-6.2 "Forget selected tab" -setup { ttk::notebook .n pack .n label .n.l -text abc |
︙ | ︙ | |||
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | $nb select $nb.f1 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f1] $nb hide $nb.f1 lappend result [$nb index current] [winfo ismapped $nb.f1] } -result [list 0 1 1 0] test notebook-6.4 "Forget first tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f1 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f1] $nb forget $nb.f1 lappend result [$nb index current] [winfo ismapped $nb.f1] } -result [list 0 1 0 0] test notebook-6.5 "Hide last tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f3 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f3] $nb hide $nb.f3 lappend result [$nb index current] [winfo ismapped $nb.f3] } -result [list 2 1 1 0] test notebook-6.6 "Forget a middle tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f2 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 0] test notebook-6.7 "Hide a middle tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f2 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 2 0] test notebook-6.8 "Forget a non-current tab < current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f1 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 0 1] test notebook-6.9 "Hide a non-current tab < current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f1 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.10 "Forget a non-current tab > current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f3 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.11 "Hide a non-current tab > current" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f3 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.12 "Hide and re-add a tab" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [$nb tab $nb.f2 -state] $nb hide $nb.f2 lappend result [$nb index current] [$nb tab $nb.f2 -state] $nb add $nb.f2 lappend result [$nb index current] [$nb tab $nb.f2 -state] } -result [list 1 normal 2 hidden 2 normal] # # Insert: # unset nb | > > > > > > > > > > > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | $nb select $nb.f1 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f1] $nb hide $nb.f1 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f1] } -result [list 0 1 1 0] test notebook-6.4 "Forget first tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f1 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f1] $nb forget $nb.f1 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f1] } -result [list 0 1 0 0] test notebook-6.5 "Hide last tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f3 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f3] $nb hide $nb.f3 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f3] } -result [list 2 1 1 0] test notebook-6.6 "Forget a middle tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f2 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 0] test notebook-6.7 "Hide a middle tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f2 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 2 0] test notebook-6.8 "Forget a non-current tab < current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f1 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 0 1] test notebook-6.9 "Hide a non-current tab < current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f1 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.10 "Forget a non-current tab > current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f3 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.11 "Hide a non-current tab > current" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f3 update idletasks lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.12 "Hide and re-add a tab" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [$nb tab $nb.f2 -state] $nb hide $nb.f2 update idletasks lappend result [$nb index current] [$nb tab $nb.f2 -state] $nb add $nb.f2 update idletasks lappend result [$nb index current] [$nb tab $nb.f2 -state] } -result [list 1 normal 2 hidden 2 normal] # # Insert: # unset nb |
︙ | ︙ | |||
393 394 395 396 397 398 399 | .nb insert 1 3 .nb index current } -result 4 test notebook-7.8a "move tabs - current tab undisturbed - exhaustive" -body { .nb select .nb.f0 foreach i {0 1 2 3 4} { | | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | .nb insert 1 3 .nb index current } -result 4 test notebook-7.8a "move tabs - current tab undisturbed - exhaustive" -body { .nb select .nb.f0 foreach i {0 1 2 3 4} { .nb insert $i .nb.f$i } foreach i {0 1 2 3 4} { .nb select .nb.f$i foreach j {0 1 2 3 4} { foreach k {0 1 2 3 4} { .nb insert $j $k |
︙ | ︙ | |||
450 451 452 453 454 455 456 | } -result [list "" .nb.l1] -cleanup { destroy .nb } test notebook-1817596-2 "error in insert should have no effect" -body { pack [ttk::notebook .nb] .nb insert end [ttk::label .nb.l1] .nb insert end [ttk::label .nb.l2] list \ | | | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | } -result [list "" .nb.l1] -cleanup { destroy .nb } test notebook-1817596-2 "error in insert should have no effect" -body { pack [ttk::notebook .nb] .nb insert end [ttk::label .nb.l1] .nb insert end [ttk::label .nb.l2] list \ [catch { .nb insert .l2 0 -badoption badvalue } err] \ [.nb tabs] \ } -result [list 1 [list .nb.l1 .nb.l2]] -cleanup { destroy .nb } test notebook-1817596-3 "insert/configure" -body { pack [ttk::notebook .nb] .nb insert end [ttk::label .nb.l0] -text "L0" .nb insert end [ttk::label .nb.l1] -text "L1" |
︙ | ︙ | |||
508 509 510 511 512 513 514 515 | test notebook-1343984-2 "don't autoselect on destroy" -body { set ::history [list] destroy .nb update set ::history } -result [list DESTROY .nb.frame1 DESTROY .nb.frame2 DESTROY .nb.frame3] tcltest::cleanupTests | > > > > > > > > > > > > > > | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | test notebook-1343984-2 "don't autoselect on destroy" -body { set ::history [list] 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 |
Changes to tests/ttk/panedwindow.test.
|
| | | 1 2 3 4 5 6 7 8 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands proc propagate-geometry {} { update idletasks } # Basic sanity checks: |
︙ | ︙ | |||
152 153 154 155 156 157 158 | # checkorder $winlist -- # Ensure that Y coordinates windows in $winlist are strictly increasing. # proc checkorder {winlist} { set pos -1 set positions [list] foreach win $winlist { | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | # checkorder $winlist -- # Ensure that Y coordinates windows in $winlist are strictly increasing. # proc checkorder {winlist} { set pos -1 set positions [list] foreach win $winlist { lappend positions [set nextpos [winfo y $win]] if {$nextpos <= $pos} { error "window $win out of order ($positions)" } set pos $nextpos } } |
︙ | ︙ | |||
199 200 201 202 203 204 205 | ### sashpos tests. # proc sashpositions {pw} { set positions [list] set npanes [llength [winfo children $pw]] for {set i 0} {$i < $npanes - 1} {incr i} { | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | ### sashpos tests. # proc sashpositions {pw} { set positions [list] set npanes [llength [winfo children $pw]] for {set i 0} {$i < $npanes - 1} {incr i} { lappend positions [$pw sashpos $i] } return $positions } test paned-sashpos-setup "Setup for sash position test" -body { ttk::style theme use default ttk::style configure -sashthickness 5 |
︙ | ︙ | |||
285 286 287 288 289 290 291 292 | .pw.f1 configure -height 50 ;# should be denied propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0] } -result [list 100 155 100] test paned-propagation-cleanup "Clean up." -body { destroy .pw } tcltest::cleanupTests | > > > > > > > > > > > > > > > > > > | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | .pw.f1 configure -height 50 ;# should be denied propagate-geometry 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 |
Changes to tests/ttk/progressbar.test.
|
| | | 1 2 3 4 5 6 7 8 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test progressbar-1.1 "Setup" -body { ttk::progressbar .pb |
︙ | ︙ | |||
118 119 120 121 122 123 124 125 | } set res } -cleanup { unset res thefont destroy .p } -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}} tcltest::cleanupTests | > > > > > > > > > > > > > > > > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | } set res } -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 |
Changes to tests/ttk/radiobutton.test.
1 2 3 4 | # # ttk::radiobutton widget tests. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # # ttk::radiobutton widget tests. # package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test radiobutton-1.1 "Radiobutton check" -body { pack \ [ttk::radiobutton .rb1 -text "One" -variable choice -value 1] \ [ttk::radiobutton .rb2 -text "Two" -variable choice -value 2] \ [ttk::radiobutton .rb3 -text "Three" -variable choice -value 3] \ ; } test radiobutton-1.2 "Radiobutton invoke" -body { .rb1 invoke set ::choice |
︙ | ︙ | |||
42 43 44 45 46 47 48 49 | } -result {0 1 1} 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} tcltest::cleanupTests | > > > > > > > > > > > > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | } -result {0 1 1} 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.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 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 |
Changes to tests/ttk/scrollbar.test.
|
| | | 1 2 3 4 5 6 7 8 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}] # Before 2019 the code in library/ttk/scrollbar.tcl would replace the |
︙ | ︙ | |||
24 25 26 27 28 29 30 | } test scrollbar-swapout-2 "... regardless of whether -style ..." \ -constraints { coreScrollbar } -body { ttk::style layout Vertical.Custom.TScrollbar \ | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | } test scrollbar-swapout-2 "... regardless of whether -style ..." \ -constraints { coreScrollbar } -body { ttk::style layout Vertical.Custom.TScrollbar \ [ttk::style layout Vertical.TScrollbar] ; # See #1833339 ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar list [winfo class .sb] [.sb cget -command] [.sb cget -style] } -result [list TScrollbar yadda Custom.TScrollbar] -cleanup { destroy .sb } test scrollbar-swapout-3 "... or -class is specified." -constraints { |
︙ | ︙ | |||
80 81 82 83 84 85 86 | update focus -force .s event generate .s <MouseWheel> -delta -120 after 200 {set eventprocessed 1} ; vwait eventprocessed .t index @0,0 } -cleanup { destroy .t .s | | | | < | < | < < | < < < | > | < | > | < < < < < < | < < < < < < > | | < | | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | update focus -force .s event generate .s <MouseWheel> -delta -120 after 200 {set eventprocessed 1} ; vwait eventprocessed .t index @0,0 } -cleanup { destroy .t .s } -result {4.0} test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -setup { destroy .t .s } -body { pack [text .t -xscrollcommand {.s set} -wrap none] -side top for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top update focus -force .s event generate .s <Shift-MouseWheel> -delta -120 after 200 {set eventprocessed 1} ; vwait eventprocessed .t index @0,0 } -cleanup { destroy .t .s } -result {1.3} test scrollbar-10.2.2 {<MouseWheel> event on horizontal scrollbar} -setup { destroy .t .s } -body { pack [text .t -xscrollcommand {.s set} -wrap none] -side top for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top update focus -force .s event generate .s <MouseWheel> -delta -120 after 200 {set eventprocessed 1} ; vwait eventprocessed .t index @0,0 } -cleanup { destroy .t .s } -result {1.3} 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 .w } -result {customStyle.Horizontal.TScrollbar Horizontal.customStyle.Horizontal.TScrollbar TScrollbar} tcltest::cleanupTests |
Changes to tests/ttk/spinbox.test.
1 2 3 4 | # # ttk::spinbox widget tests # | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # # ttk::spinbox widget tests # package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands test spinbox-1.0 "Spinbox tests -- setup" -body { ttk::spinbox .sb } -cleanup { destroy .sb } -result .sb |
︙ | ︙ | |||
134 135 136 137 138 139 140 | } -body { .sb configure -validate bogus } -cleanup { destroy .sb } -returnCodes error -result {bad validate "bogus": must be all, key, focus, focusin, focusout, or none} test spinbox-1.8.4 "-validate option: " -setup { | < > | > > > | > | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | } -body { .sb configure -validate bogus } -cleanup { destroy .sb } -returnCodes error -result {bad validate "bogus": must be all, key, focus, focusin, focusout, or none} test spinbox-1.8.4 "-validate option: " -setup { ttk::spinbox .sb -from 0 -to 100 set ::spinbox_test {} } -body { .sb configure -validate all -validatecommand {set ::spinbox_test %P} pack .sb update idletasks .sb set 50 focus -force .sb set ::spinbox_wait 0 set timer [after 100 {set ::spinbox_wait 1}] vwait ::spinbox_wait after cancel $timer set ::spinbox_test } -cleanup { destroy .sb } -result 50 test spinbox-2.0 "current command -- unset should be 0" -constraints nyi -setup { |
︙ | ︙ | |||
354 355 356 357 358 359 360 361 362 363 364 365 | event generate .sb <<Increment>> ; lappend result [.sb get] .sb set asdfasdf ; lappend result [.sb get] event generate .sb <<Decrement>> ; lappend result [.sb get] } -result [list asdfasdf 000 asdfasdf 000] -cleanup { destroy .sb } tcltest::cleanupTests # Local variables: # mode: tcl # End: | > > > > > > > > > > > > > > | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | event generate .sb <<Increment>> ; lappend result [.sb get] .sb set asdfasdf ; lappend result [.sb get] event generate .sb <<Decrement>> ; 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: |
Changes to tests/ttk/treetags.test.
1 |
| | | 1 2 3 4 5 6 7 8 9 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands ### treeview tag invariants: # |
︙ | ︙ | |||
34 35 36 37 38 39 40 | itemConstraints $tv {} } # ### test treetags-1.0 "Setup" -body { | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | itemConstraints $tv {} } # ### test treetags-1.0 "Setup" -body { set tv [ttk::treeview .tv -columns "A B C"] .tv insert {} end -id item1 -text "Item 1" pack .tv } -cleanup { treeConstraints $tv } test treetags-1.1 "Bad tag list" -body { |
︙ | ︙ | |||
58 59 60 61 62 63 64 | treeConstraints $tv } -result [list tag1] test treetags-1.3 "tag has - test" -body { $tv insert {} end -id item2 -text "Item 2" -tags tag2 set result [list] foreach item {item1 item2} { | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | treeConstraints $tv } -result [list tag1] test treetags-1.3 "tag has - test" -body { $tv insert {} end -id item2 -text "Item 2" -tags tag2 set result [list] foreach item {item1 item2} { foreach tag {tag1 tag2 tag3} { lappend result $item $tag [$tv tag has $tag $item] } } set result } -cleanup { treeConstraints $tv } -result [list \ |
︙ | ︙ | |||
187 188 189 190 191 192 193 | # @@@ fragile test test treetags-3.2 "tag configure - enumerate" -body { $tv tag configure tag1 } -cleanup { treeConstraints $tv } -result [list \ | > > > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | # @@@ fragile test test treetags-3.2 "tag configure - enumerate" -body { $tv tag configure tag1 } -cleanup { treeConstraints $tv } -result [list \ -image {} -imageanchor {} -background red -stripedbackground {} -foreground blue -font {} -padding {} \ ] test treetags-4.1 "tag cell add" -body { $tv tag cell add _thetag } -returnCodes 1 -result {wrong # args: should be ".tv tag cell add tagName cells"} test treetags-4.2 "tag cell remove" -body { $tv tag cell remove _thetag $tv tag cell remove } -returnCodes 1 -result {wrong # args: should be ".tv tag cell remove tagName ?cells?"} test treetags-4.3 "tag cell has" -body { $tv tag cell has _thetag $tv tag cell has } -returnCodes 1 -result {wrong # args: should be ".tv tag cell has tagName ?cell?"} test treetags-4.3.1 "tag cell has" -body { $tv tag cell add tag1 "item1 #2" set res [$tv tag cell has tag1 "item1 #2"] lappend res [$tv tag cell has tag1 "item1 #1"] lappend res [$tv tag cell has tag1 "item1 #3"] lappend res {*}[$tv tag cell has tag1] $tv tag cell remove tag1 "item1 B" lappend res {*}[$tv tag cell has tag1] lappend res [$tv tag cell has tag1 "item1 #2"] } -result {1 0 0 {item1 B} 0} test treetags-4.4 "tag cell add" -body { $tv tag cell add tag1 "item1 A" $tv tag cell add tag1 "item1 #3" $tv tag cell has tag1 } -result {{item1 A} {item1 C}} test treetags-4.5 "tag cell add" -body { $tv tag cell add tag2 "item1 A" $tv tag cell add tag2 "item1 #2" $tv tag cell has tag2 } -result {{item1 A} {item1 B}} test treetags-4.6 "tag cell remove" -body { $tv tag cell remove tag1 "item1 A" $tv tag cell has tag1 } -result {{item1 C}} test treetags-4.7 "tag cell remove" -body { $tv tag cell remove tag2 $tv tag cell has tag2 } -result {} test treetags-4.8 "tag delete with tagged cells" -body { $tv tag cell add tag6 "item1 A" $tv tag delete tag6 $tv tag cell has tag6 } -result {} # The next test exercises tag resource management. # If options are not properly freed, the message: # Test file error: "Font times 20 still in cache." # will show up on stderr at program exit. # test treetags-3.3 "tag configure - set font" -body { $tv tag configure tag2 -font {times 20} } test treetags-3.4 "stomp tags in tag binding procedure" -body { set result [list] $tv tag bind rm1 <<Remove>> { lappend ::result rm1 [%W focus] <<Remove>> } $tv tag bind rm2 <<Remove>> { lappend ::result rm2 [%W focus] <<Remove>> %W item [%W focus] -tags {tag1} } $tv tag bind rm3 <<Remove>> { lappend ::result rm3 [%W focus] <<Remove>> } $tv item item1 -tags {rm1 rm2 rm3} $tv focus item1 event generate $tv <<Remove>> |
︙ | ︙ |
Changes to tests/ttk/treeview.test.
1 2 3 4 5 | # # [7Jun2005] TO CHECK: [$tv see {}] -- shouldn't work (at least, shouldn't do # what it currently does) # | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | # # [7Jun2005] TO CHECK: [$tv see {}] -- shouldn't work (at least, shouldn't do # what it currently does) # package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands # consistencyCheck -- # Traverse the tree to make sure the item data structures # are properly linked. # # Since [$tv children] follows ->next links and [$tv index] # follows ->prev links, this should cover all invariants. # proc consistencyCheck {tv {item {}}} { set i 0 foreach child [$tv children $item] { assert {[$tv parent $child] == $item} "parent $child = $item" assert {[$tv index $child] == $i} "index $child [$tv index $child]=$i" incr i consistencyCheck $tv $child } } proc assert {expr {message ""}} { if {![uplevel 1 [list expr $expr]]} { set error "PANIC! PANIC! PANIC: $message ($expr failed)" puts stderr $error error $error } } proc tvSetup {} { destroy .tv ttk::treeview .tv -columns {a b c} pack .tv -expand true -fill both .tv column #0 -width 50 .tv column a -width 50 .tv column b -width 50 .tv column c -width 50 # Make sure everything is created and updated tkwait visibility .tv update after 10 update } proc tvSetupWithItems {} { tvSetup .tv insert {} end -id nn .tv insert nn end -id nn.n1 .tv insert nn end -id nn.n2 .tv insert nn end -id nn.n3 for {set t 2} {$t < 100} {incr t} { .tv insert {} end -id nn$t if {$t % 3 == 0} { .tv insert nn$t end -id nn$t.n1 .tv insert nn$t end -id nn$t.n2 .tv insert nn$t end -id nn$t.n3 } } } test treeview-1.1 "columns" -body { tvSetup .tv configure -columns {a b c} } test treeview-1.2 "Bad columns" -body { #.tv configure -columns {illegal "list"value} ttk::treeview .badtv -columns {illegal "list"value} } -returnCodes error -result "list element in quotes followed by*" -match glob test treeview-1.3 "bad displaycolumns" -body { .tv configure -displaycolumns {a b d} } -returnCodes error -result "Invalid column index d" test treeview-1.4 "more bad displaycolumns" -body { .tv configure -displaycolumns {1 2 3} } -returnCodes error -result {Column index "3" out of bounds} test treeview-1.5 "Don't forget to check negative numbers" -body { .tv configure -displaycolumns {1 {} 3} } -returnCodes error -result {Column index "" out of bounds} # Item creation. # test treeview-2.1 "insert -- not enough args" -body { .tv insert } -returnCodes error -result "wrong # args: *" -match glob |
︙ | ︙ | |||
88 89 90 91 92 93 94 | test treeview-2.8 "insert -- new node at end" -body { .tv insert {} end -id lastnode consistencyCheck .tv .tv children {} } -result [list newnode lastnode] | < < | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | test treeview-2.8 "insert -- new node at end" -body { .tv insert {} end -id lastnode consistencyCheck .tv .tv children {} } -result [list newnode lastnode] test treeview-2.9 "insert -- new node at beginning" -body { .tv insert {} 0 -id firstnode consistencyCheck .tv .tv children {} } -result [list firstnode newnode lastnode] test treeview-2.10 "insert -- one more node" -body { |
︙ | ︙ | |||
196 197 198 199 200 201 202 203 204 205 | .tv detach newnode consistencyCheck .tv .tv children {} } -result [list newfirstone firstnode anotherone onemore lastnode newlastone] test treeview-3.11 "Can't detach root item" -body { .tv detach [list {}] update consistencyCheck .tv } -returnCodes error -result "Cannot detach root item" | > < | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | .tv detach newnode consistencyCheck .tv .tv children {} } -result [list newfirstone firstnode anotherone onemore lastnode newlastone] test treeview-3.11 "Can't detach root item" -body { .tv detach [list {}] } -cleanup { update consistencyCheck .tv } -returnCodes error -result "Cannot detach root item" test treeview-3.12 "Reattach" -body { .tv move newnode {} end consistencyCheck .tv .tv children {} } -result [list newfirstone firstnode anotherone onemore lastnode newlastone newnode] |
︙ | ︙ | |||
298 299 300 301 302 303 304 | test treeview-5.6 "set illegal cell" -body { .tv set newnode #0 YYY } -returnCodes error -result "Display column #0 cannot be set" test treeview-5.7 "set illegal cell" -body { .tv set newnode 3 YY ;# 3 == current #columns | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | test treeview-5.6 "set illegal cell" -body { .tv set newnode #0 YYY } -returnCodes error -result "Display column #0 cannot be set" test treeview-5.7 "set illegal cell" -body { .tv set newnode 3 YY ;# 3 == current #columns } -returnCodes error -result {Column index "3" out of bounds} test treeview-5.8 "set display columns" -body { .tv configure -displaycolumns [list 2 1 0] .tv set newnode #1 X .tv set newnode #2 Y .tv set newnode #3 Z .tv item newnode -values |
︙ | ︙ | |||
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | test treeview-5.13 "get, no value" -body { set newitem [.tv insert {} end] set result [.tv set $newitem #1] .tv delete $newitem set result } -result {} test treeview-6.1 "deletion - setup" -body { .tv insert {} end -id dtest foreach id [list a b c d e] { .tv insert dtest end -id $id } .tv children dtest } -result [list a b c d e] test treeview-6.1.1 "delete" -body { .tv delete b consistencyCheck .tv list [.tv exists b] [.tv children dtest] } -result [list 0 [list a c d e]] | > > > > > > > > > > > > < < | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | test treeview-5.13 "get, no value" -body { set newitem [.tv insert {} end] set result [.tv set $newitem #1] .tv delete $newitem set result } -result {} test treeview-5.14 "set illegal height" -body { # For now, -height can only be integer .tv item newnode -height 1.5 } -returnCodes 1 -result {expected integer but got "1.5"} test treeview-5.15 "set illegal height" -body { .tv item newnode -height 0 } -returnCodes 1 -result "Invalid item height 0" test treeview-5.16 "no change after illegal attempt" -body { .tv item newnode -height } -result 1 test treeview-6.1 "deletion - setup" -body { .tv insert {} end -id dtest foreach id [list a b c d e] { .tv insert dtest end -id $id } .tv children dtest } -result [list a b c d e] test treeview-6.1.1 "delete" -body { .tv delete b consistencyCheck .tv list [.tv exists b] [.tv children dtest] } -result [list 0 [list a c d e]] test treeview-6.2 "delete - duplicate items in list" -body { .tv delete [list a e a e] consistencyCheck .tv .tv children dtest } -result [list c d] test treeview-6.3 "delete - descendants removed" -body { |
︙ | ︙ | |||
423 424 425 426 427 428 429 | # Just check to make sure the test suite so far has left # us in the state we expect to be in: list [.tv parent newnode] [.tv children newnode] } -result [list {} [list newnode.n1 newnode.n2 newnode.n3]] test treeview-7.6 "Replace children - illegal move" -body { .tv children newnode.n1 [list newnode.n1 newnode.n2 newnode.n3] | < | | > | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | # Just check to make sure the test suite so far has left # us in the state we expect to be in: list [.tv parent newnode] [.tv children newnode] } -result [list {} [list newnode.n1 newnode.n2 newnode.n3]] test treeview-7.6 "Replace children - illegal move" -body { .tv children newnode.n1 [list newnode.n1 newnode.n2 newnode.n3] } -cleanup { consistencyCheck .tv } -returnCodes error -result "Cannot insert newnode.n1 as descendant of newnode.n1" test treeview-8.0 "Selection set" -body { .tv selection set [list newnode.n1 newnode.n3 newnode.n2] .tv selection } -result [list newnode.n1 newnode.n2 newnode.n3] test treeview-8.1 "Selection add" -body { .tv selection add [list newnode] |
︙ | ︙ | |||
456 457 458 459 460 461 462 | .tv selection } -result {} test treeview-8.5 "Selection - bad operation" -body { .tv selection badop foo } -returnCodes error -match glob -result {bad selection operation "badop": must be *} | | > > > | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > | | | | | | | | > > > > > > > > > > > > > > > | > > > > | > | > > > > > > > > > > > | > > > > | | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | .tv selection } -result {} test treeview-8.5 "Selection - bad operation" -body { .tv selection badop foo } -returnCodes error -match glob -result {bad selection operation "badop": must be *} test treeview-8.7 "<<TreeviewSelect>> when deleting items" -body { .tv delete [.tv children {}] .tv insert "" end -id myItem1 -text FirstItem .tv insert "" end -id myItem2 -text SecondItem .tv selection add myItem1 update bind .tv <<TreeviewSelect>> {lappend res $val} set res {} set val 1 .tv delete myItem2 ; # no <<TreeviewSelect>> (selection unchanged) update set val 2 .tv delete myItem1 ; # <<TreeviewSelect>> triggers update set res } -cleanup { bind .tv <<TreeviewSelect>> {} } -result {2} test treeview-8.8 "<<TreeviewSelect>> when setting the selection" -body { .tv delete [.tv children {}] .tv insert "" end -id myItem1 -text FirstItem .tv insert "" end -id myItem2 -text SecondItem update bind .tv <<TreeviewSelect>> {lappend res $val} set res {} set val 1 .tv selection set "" ; # no <<TreeviewSelect>> (selection unchanged) update set val 2 .tv selection set myItem1 ; # <<TreeviewSelect>> triggers update # Current implementation generates an event for this case set val 3 .tv selection set myItem1 ; # (already selected) update set val 4 .tv selection set {myItem1 myItem2} ; # <<TreeviewSelect>> triggers update set val 5 .tv selection set {myItem2} ; # <<TreeviewSelect>> triggers update set res } -cleanup { bind .tv <<TreeviewSelect>> {} } -result {2 3 4 5} test treeview-8.9 "<<TreeviewSelect>> when removing items from the selection" -body { .tv delete [.tv children {}] .tv insert "" end -id myItem1 -text FirstItem .tv selection set myItem1 update bind .tv <<TreeviewSelect>> {lappend res $val} set res {} set val 1 .tv selection remove "" ; # no <<TreeviewSelect>> (selection unchanged) update set val 2 .tv selection remove myItem1 ; # <<TreeviewSelect>> triggers update set val 3 .tv selection remove myItem1 ; # no <<TreeviewSelect>> (selection unchanged) update set res } -cleanup { bind .tv <<TreeviewSelect>> {} } -result {2} test treeview-8.10 "<<TreeviewSelect>> when adding items in the selection" -body { .tv delete [.tv children {}] .tv insert "" end -id myItem1 -text FirstItem .tv insert "" end -id myItem2 -text SecondItem .tv insert "" end -id myItem3 -text ThirdItem update bind .tv <<TreeviewSelect>> {lappend res $val} set res {} set val 1 .tv selection add myItem2 ; # <<TreeviewSelect>> triggers update set val 2 .tv selection add myItem2 ; # no <<TreeviewSelect>> (selection unchanged) update set val 3 .tv selection add myItem3 ; # <<TreeviewSelect>> triggers update set res } -cleanup { bind .tv <<TreeviewSelect>> {} } -result {1 3} test treeview-8.11 "<<TreeviewSelect>> when toggling" -body { .tv delete [.tv children {}] .tv insert "" end -id myItem1 -text FirstItem .tv insert "" end -id myItem2 -text SecondItem .tv insert "" end -id myItem3 -text ThirdItem update bind .tv <<TreeviewSelect>> {lappend res $val} set res {} set val 1 .tv selection toggle "" ; # no <<TreeviewSelect>> (selection unchanged) update set val 2 .tv selection toggle {myItem1 myItem3} ; # <<TreeviewSelect>> triggers update set val 3 .tv selection toggle {myItem3 myItem2} ; # <<TreeviewSelect>> triggers update set val 4 .tv selection toggle {myItem3 myItem2} ; # <<TreeviewSelect>> triggers update set res } -cleanup { bind .tv <<TreeviewSelect>> {} } -result {2 3 4} ### NEED: more tests for see/yview/scrolling proc scrollcallback {args} { set ::scrolldata $args } test treeview-9.0 "scroll callback - empty tree" -body { tvSetup .tv configure -yscrollcommand scrollcallback .tv delete [.tv children {}] update set ::scrolldata } -result [list 0.0 1.0] test treeview-9.1 "scrolling" -setup { pack [ttk::treeview .tree -show tree] -fill y for {set i 1} {$i < 100} {incr i} { .tree insert {} end -text $i } } -body { .tree yview scroll 5 units # This is sensitive to the exact layout of a tree. # It assumes that (8,8) should be far enough in to be in the tree, # while still being in the first item. .tree identify item 8 8 } -cleanup { destroy .tree } -result {I006} test treeview-9.2 {scrolling on see command - bug [14188104c3]} -setup { toplevel .top ttk::treeview .top.tree -show {} -height 10 -columns {label} \ |
︙ | ︙ | |||
558 559 560 561 562 563 564 565 566 567 568 569 570 571 | .top.tree see e update idletasks set after [lindex [.top.vs get] 1] expr $after < $before } -cleanup { destroy .top } -result 1 ### identify tests: # proc identify* {tv comps args} { foreach {x y} $args { foreach comp $comps { lappend result [$tv identify $comp $x $y] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | .top.tree see e update idletasks set after [lindex [.top.vs get] 1] expr $after < $before } -cleanup { destroy .top } -result 1 test treeview-10.0 "See command" -setup { # Setup common for all 10.* tests ttk::style configure Treeview -rowheight 20 tvSetupWithItems set ::baseBbY [lindex [.tv bbox nn "#1"] 1] proc bbY {item} { set bb [.tv bbox $item "#1"] set y [lindex $bb 1] if {$y eq ""} {return "_"} return [expr {$y - $::baseBbY}] } } -body { set res "" lappend res [bbY nn99] .tv see nn99 lappend res [bbY nn99] set res } -result {_ 180} test treeview-10.1 "See command, auto-open" -body { set res "" lappend res [bbY nn96] # Not yet visible lappend res [bbY nn96.n1] .tv see nn96.n1 lappend res [bbY nn96.n1] # Pushed out by the opening, not visible lappend res [bbY nn99] set res } -result {120 _ 140 _} test treeview-10.2 "See command, height" -setup { .tv item nn34 -height 4 .tv item nn55 -height 30 .tv item nn76 -height 5 } -body { set res "" lappend res [bbY nn34] .tv see nn34 lappend res [bbY nn34] .tv see nn33 lappend res [bbY nn34] lappend res [bbY nn76] .tv see nn76 lappend res [bbY nn76] .tv see nn53 lappend res [bbY nn53] # Partly visible lappend res [bbY nn55] .tv see nn55 # Scrolled to top lappend res [bbY nn55] set res } -result {_ 0 20 _ 100 0 40 0} test treeview-11.0 "Cellselection set rectangle" -setup { # Setup common for all 11.* tests tvSetupWithItems .tv configure -columns {a b c d} .tv configure -displaycolumns {a b c} } -body { .tv cellselection set "nn.n3 #2" "nn.n1 a" .tv cellselection } -result [list "nn.n1 a" "nn.n1 b" "nn.n2 a" "nn.n2 b" "nn.n3 a" "nn.n3 b"] test treeview-11.1 "Cellselection set" -body { .tv cellselection set [list "nn.n1 a" "nn.n2 a" "nn.n3 #2" "nn.n2 d"] .tv cellselection } -result [list "nn.n1 a" "nn.n2 a" "nn.n2 d" "nn.n3 b"] test treeview-11.2 "Cellselection add" -body { .tv cellselection add "nn b" .tv cellselection } -result [list "nn b" "nn.n1 a" "nn.n2 a" "nn.n2 d" "nn.n3 b"] test treeview-11.3 "Cellselection toggle" -body { .tv cellselection toggle [list "nn.n2 a" "nn2 b" "nn2 #0"] .tv cellselection } -result [list "nn b" "nn.n1 a" "nn.n2 d" "nn.n3 b" "nn2 b" "nn2 #0"] test treeview-11.4 "Cellselection remove" -body { .tv cellselection remove [list "nn.n2 d" "nn b" "nn2 #0"] .tv cellselection } -result [list "nn.n1 a" "nn.n3 b" "nn2 b"] test treeview-11.5 "Cellselection add rectangle" -body { .tv cellselection add "nn a" "nn.n1 c" .tv cellselection } -result [list \ "nn a" "nn b" "nn c" \ "nn.n1 a" "nn.n1 b" "nn.n1 c" \ "nn.n3 b" \ "nn2 b"] test treeview-11.6 "Cellselection toggle rectangle" -body { .tv cellselection toggle "nn.n1 b" "nn.n3 c" .tv cellselection } -result [list \ "nn a" "nn b" "nn c" \ "nn.n1 a" \ "nn.n2 b" "nn.n2 c" \ "nn.n3 c" \ "nn2 b"] test treeview-11.7 "Cellselection remove rectangle" -body { .tv cellselection remove "nn.n1 a" "nn.n3 b" .tv cellselection } -result [list \ "nn a" "nn b" "nn c" \ "nn.n2 c" \ "nn.n3 c" \ "nn2 b"] test treeview-11.8 "Cellselection set rectangle" -body { # This tests that "set" clears out all old selections .tv cellselection set "nn b" "nn.n1 c" .tv cellselection } -result [list "nn b" "nn c" "nn.n1 b" "nn.n1 c"] test treeview-11.9 "Cellselection - clear" -body { .tv cellselection set {} .tv cellselection } -result {} test treeview-11.10 "Cellselection - bad operation" -body { .tv cellselection badop foo } -returnCodes 1 -match glob -result {bad cellselection operation "badop": must be *} test treeview-11.11 "Cellselection - <<TreeviewSelect>> on cellselection add" -body { .tv cellselection set {} bind .tv <<TreeviewSelect>> {set res 1} set res 0 .tv cellselection add {"nn.n1 b"} update set res } -cleanup { bind .tv <<TreeviewSelect>> {} } -result {1} test treeview-11.12 "<<TreeviewSelect>> on selected cell deletion" -body { .tv cellselection set {} .tv insert "" end -id selectedDoomed -text DeadItem .tv insert "" end -id doomed -text AlsoDead .tv cellselection add {"selectedDoomed c"} .tv cellselection add {"doomed c"} .tv cellselection remove {"doomed c"} update bind .tv <<TreeviewSelect>> {lappend res 1} set res 0 .tv delete doomed update set res [expr {$res == 0}] .tv delete selectedDoomed update set res } -cleanup { bind .tv <<TreeviewSelect>> {} } -result {1 1} test treeview-11.13 "Cellselection - error" -body { .tv cellselection set [list "apa a"] } -returnCodes 1 -match glob -result {Item apa not found} test treeview-11.14 "Cellselection - error" -body { .tv cellselection set [list "nn xx "] } -returnCodes 1 -match glob -result {Invalid column index xx} test treeview-11.15 "Cellselection - error" -body { .tv cellselection set "nn c" "nn d" } -returnCodes 1 -match glob -result {Cell id must be in a visible column} test treeview-11.16 "Cellselection - non visible" -body { .tv cellselection set [list "nn d"] .tv cellselection } -result {{nn d}} # Same as 8.8, but for cell selection test treeview-11.17 "<<TreeviewSelect>> when setting the selection" -body { .tv delete [.tv children {}] .tv insert "" end -id myItem1 -text FirstItem .tv insert "" end -id myItem2 -text SecondItem update bind .tv <<TreeviewSelect>> {lappend res $val} set res {} set val 1 .tv cellselection set "" ; # no <<TreeviewSelect>> (selection unchanged) update set val 2 .tv cellselection set "myItem1 a" ; # <<TreeviewSelect>> triggers update # Current implementation generates an event for this case set val 3 .tv cellselection set "myItem1 a" ; # (already selected) update set val 4 .tv cellselection set {{myItem1 a} {myItem2 a}} ; # <<TreeviewSelect>> update set val 5 .tv cellselection set {myItem2 a} ; # <<TreeviewSelect>> triggers update set res } -cleanup { bind .tv <<TreeviewSelect>> {} } -result {2 3 4 5} ### identify tests: # proc identify* {tv comps args} { foreach {x y} $args { foreach comp $comps { lappend result [$tv identify $comp $x $y] |
︙ | ︙ | |||
587 588 589 590 591 592 593 594 595 | } return $result } test treeview-identify-setup "identify series - setup" -body { destroy .tv ttk::setTheme default ttk::treeview .tv -columns [list A B C] .tv insert {} end -id branch -text branch -open true | > | > | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 | } return $result } test treeview-identify-setup "identify series - setup" -body { destroy .tv ttk::setTheme default ttk::style configure Treeview -rowheight 20 ttk::treeview .tv -columns [list A B C] .tv insert {} end -id branch -text branch -open true .tv insert branch end -id item1 -text item1 -height 2 .tv insert branch end -id item2 -text item2 .tv insert branch end -id item3 -text item3 .tv insert {} end -id item4 -text item4 .tv column #0 -width 50 ;# 0-50 .tv column A -width 50 ;# 50-100 .tv column B -width 50 ;# 100-150 .tv column C -width 50 ;# 150-200 (plus slop for margins) wm geometry . {} ; pack .tv ; update } test treeview-identify-1 "identify heading" -body { .tv configure -show {headings tree} update idletasks identify* .tv {region column} 10 10 } -result [list heading #0] test treeview-identify-2 "identify columns" -body { .tv configure -displaycolumns #all update idletasks columnids .tv [identify* .tv column 25 10 75 10 125 10 175 10] } -result [list \#0 A B C] test treeview-identify-3 "reordered columns" -body { .tv configure -displaycolumns {B A C} update idletasks columnids .tv [identify* .tv column 25 10 75 10 125 10 175 10] } -result [list \#0 B A C] test treeview-identify-4 "no tree column" -body { .tv configure -displaycolumns #all -show {headings} update idletasks identify* .tv {region column} 25 10 75 10 125 10 175 10 } -result [list heading #1 heading #2 heading #3 nothing {}] # Item height in default theme is 20px test treeview-identify-5 "vertical scan - no headings" -body { .tv configure -displaycolumns #all -show {tree} update idletasks identify* .tv {region item} 25 10 25 30 25 70 25 90 25 110 25 130 } -result [list tree branch tree item1 tree item2 tree item3 tree item4 nothing {}] test treeview-identify-6 "vertical scan - with headings" -body { .tv configure -displaycolumns #all -show {tree headings} update idletasks identify* .tv {region item} 25 10 25 30 25 50 25 90 25 110 } -result [list heading {} tree branch tree item1 tree item2 tree item3] test treeview-identify-7 "vertical scan - headings, no tree" -body { .tv configure -displaycolumns #all -show {headings} update idletasks identify* .tv {region item cell} 25 10 25 30 25 50 75 90 25 110 } -result [list heading {} {} cell branch {branch #1} cell item1 {item1 #1} cell item2 {item2 #2} cell item3 {item3 #1}] # In default theme, -indent and -itemheight both 20px # Disclosure element name is "Treeitem.indicator" set disclosure "*.indicator" test treeview-identify-8 "identify element" -body { .tv configure -show {tree} .tv insert branch 0 -id branch2 -open true .tv insert branch2 0 -id branch3 -open true .tv insert branch3 0 -id leaf3 update idletasks; identify* .tv {item element} 10 10 30 30 50 50 } -match glob -result [list \ branch $disclosure branch2 $disclosure branch3 $disclosure] test treeview-identify-8.1 "identify element" -body { .tv configure -show {tree headings} update identify* .tv element 1 1 10 10 25 25 # Heading elements are currently not reported } -result [list {} {} text] # See #2381555 test treeview-identify-9 "identify works when horizontally scrolled" -setup { .tv configure -show {tree headings} foreach column {#0 A B C} { .tv column $column -stretch 0 -width 50 } # Scrollable area is 200, visible is 100 place .tv -x 0 -y 0 -width 100 } -body { set result [list] foreach xoffs {0 50 100} { .tv xview $xoffs ; update lappend result [identify* .tv {region column} 10 10 60 10] } set result } -result [list \ [list heading #0 heading #1] \ [list heading #1 heading #2] \ [list heading #2 heading #3] ] test treeview-identify-10 "identify works when horizontally scrolled" -setup { .tv configure -show {tree headings} .tv configure -titlecolumns 1 foreach column {"#0" A B C} { .tv column $column -stretch 0 -width 50 } # Scrollable area is 200, visible is 150 place .tv -x 0 -y 0 -width 150 } -body { set result [list] foreach xoffs {0 25 50} { .tv xview $xoffs update lappend result [identify* .tv {region column} 10 10 60 10] lappend result [identify* .tv {region column} 10 50 60 50] } set result } -result [list \ [list heading #0 heading #1] [list tree #0 cell #1] \ [list heading #0 heading #1] [list tree #0 cell #1] \ [list heading #0 heading #2] [list tree #0 cell #2] ] # Hijack the setup above to check bbox too test treeview-identify-10b "bbox works when horizontally scrolled" -body { # Establish a point of reference .tv configure -titlecolumns 0 .tv xview 0 update set base [lindex [.tv bbox branch "#0"] 0] set result [list] foreach tc {0 1 2 3} { .tv configure -titlecolumns $tc foreach xoffs {0 25 50} { .tv xview $xoffs update # Extract x coordinate for each column lappend result [expr {[lindex [.tv bbox branch "#0"] 0] - $base}] lappend result [expr {[lindex [.tv bbox branch A ] 0] - $base}] lappend result [expr {[lindex [.tv bbox branch B ] 0] - $base}] lappend result [expr {[lindex [.tv bbox branch C ] 0] - $base}] } } set result } -result [list 0 50 100 150 -25 25 75 125 -50 0 50 100 \ 0 50 100 150 0 25 75 125 0 0 50 100 \ 0 50 100 150 0 50 75 125 0 50 50 100 \ 0 50 100 150 0 50 100 125 0 50 100 101] # Followup to trigger crash that happened when title > display test treeview-identify-10c "title more than display" -body { .tv configure -titlecolumns 10 .tv xview 0 update set x1 [.tv xview] # It shouldn't be possible to scroll .tv xview 50 update set x2 [.tv xview] set result [list $x1 $x2] } -result {{0.0 1.0} {0.0 1.0}} test treeview-identify-11 "bbox supporting -height" -body { .tv configure -titlecolumns 0 .tv xview 0 .tv item branch2 -open false # Add extra items to make sure it scrolls .tv insert {} end -id item5 -text item5 .tv insert {} end -id item6 -text item6 # Height needs to be big enough to show the items we measure # and small enough to make scrolling happen. .tv configure -height 6 pack .tv -side top update set base [lindex [.tv bbox branch A] 1] set result {} foreach yv {0 1} { .tv yview $yv update foreach item {item1 item2 item3} { set bb [.tv bbox $item A] set y [lindex $bb 1] if {$y eq ""} { # This is to get a clearer error if this goes wrong lappend result {} } else { lappend result [expr {$y - $base}] } lappend result [lindex $bb 3] } } set result } -result [list 40 40 80 20 100 20 20 40 60 20 80 20] test treeview-identify-cleanup "identify - cleanup" -body { destroy .tv } test treeview-rowheight-1 "rowheight - setup" -body { destroy .tv ttk::setTheme default # Test that style rowheight is in control ttk::style configure Treeview -rowheight 73 tvSetupWithItems lindex [.tv bbox nn a] 3 } -result 73 test treeview-rowheight-2 "rowheight change" -body { # Reacts to style changes ttk::style configure Treeview -rowheight 25 update lindex [.tv bbox nn a] 3 } -result 25 test treeview-rowheight-3 "rowheight adapts to font" -body { ttk::style configure Treeview -rowheight {} ttk::style configure Treeview -font "Courier -20" update set baseline [lindex [.tv bbox nn a] 3] ttk::style configure Treeview -font "Courier -50" update set after [lindex [.tv bbox nn a] 3] set diff [expr {$after - $baseline}] # We only want to check there is an increase, # its exact magnitude does not matter expr {0 < $diff ? "OK" : $diff} } -result OK test treeview-rowheight-3b "rowheight adapts to named font" -body { ttk::style configure Treeview -rowheight {} font create __tf -family Courier -size -20 ttk::style configure Treeview -font __tf update set baseline [lindex [.tv bbox nn a] 3] font configure __tf -size -50 update set after [lindex [.tv bbox nn a] 3] set diff [expr {$after - $baseline}] # We only want to check there is an increase, # its exact magnitude does not matter expr {0 < $diff ? "OK" : $diff} } -result OK test treeview-rowheight-4 "rowheight adapts to item padding" -body { # Test that things from Item style is picked up. ttk::style configure Item -padding "2 2 2 2" update set baseline [lindex [.tv bbox nn a] 3] ttk::style configure Item -padding "2 3 2 5" update set after [lindex [.tv bbox nn a] 3] set diff [expr {$after - $baseline}] } -result 4 test treeview-rowheight-5 "rowheight adapts to cell padding" -body { # Test that things from Cell style is picked up. ttk::style configure Cell -padding "2 5 2 5" update set baseline [lindex [.tv bbox nn a] 3] ttk::style configure Cell -padding "2 8 2 9" update set after [lindex [.tv bbox nn a] 3] set diff [expr {$after - $baseline}] } -result 7 ### NEED: tests for focus item, selection ### Misc. tests: destroy .tv test treeview-1541739 "Root node properly initialized (#1541739)" -setup { ttk::treeview .tv .tv insert {} end -id a .tv see a } -cleanup { destroy .tv } |
︙ | ︙ | |||
830 831 832 833 834 835 836 837 838 | .tv configure -displaycolumns {bar colC colA colB} update idletasks ; # no slack anymore because the widget resizes (shrinks) lappend res [.tv column bar -width] [.tv column colA -width] \ [expr {[winfo width .tv] < $origTreeWidth}] } -cleanup { destroy .tv } -result {60 50 60 50 60 50 1} tcltest::cleanupTests | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 | .tv configure -displaycolumns {bar colC colA colB} update idletasks ; # no slack anymore because the widget resizes (shrinks) lappend res [.tv column bar -width] [.tv column colA -width] \ [expr {[winfo width .tv] < $origTreeWidth}] } -cleanup { destroy .tv } -result {60 50 60 50 60 50 1} test treeview-bc602049ab "treeview with custom background does not change size when switching themes" -setup { image create photo tvbg -data { iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAnXAAAJ1wG xbhe3AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAACJJREFUOI 1jPLF9+38GKgImaho2auCogaMGjho4auBQMhAAyR0DXUEyypsAAAAASUVORK5CYII= } ttk::style theme create foo-bc602049ab -parent clam -settings { ttk::style element create Treeview.field image tvbg -width 0 -height 0 } ttk::style theme use foo-bc602049ab pack [ttk::treeview .tv] update idletasks } -body { set g1 [winfo geometry .tv] ttk::style theme use foo-bc602049ab update idletasks set g2 [winfo geometry .tv] expr {$g1 eq $g2 ? 1 : "$g1 --> $g2"} } -cleanup { destroy .tv image delete tvbg } -result {1} test treeview-column0-leak "Test for leak in tree column" -setup { destroy .ttt set heading [string range _Hej_ 1 3] } -body { for {set t 0} {$t < 3} {incr t} { ttk::treeview .tapa -columns "hej hopp" .tapa heading #0 -text $heading destroy .tapa } tcl::unsupported::representation $heading } -match glob -result {*refcount of 3,*} test treeview-21.1 "style command" -body { ttk::treeview .w list [.w cget -style] [.w style] [winfo class .w] } -cleanup { destroy .w } -result {{} Treeview Treeview} test treeview-21.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} test treeview-22.1 "tag bindings" -setup { tvSetupWithItems .tv tag configure t1 -background red .tv tag configure t2 -background blue .tv item nn -open 1 # Tags on item and cell to spot the difference .tv tag add t1 "nn.n1" .tv tag cell add t2 "nn.n1 a" .tv tag cell add t2 "nn.n2 c" update proc cellEvent {item col} { # Find midpoint of cell lassign [.tv bbox $item $col] aX aY aW aH set aX [expr {$aX + $aW / 2}] set aY [expr {$aY + $aH / 2}] event generate .tv <Button-1> -x $aX -y $aY } } -body { .tv tag bind t1 <Button-1> {lappend ::tagtest t1} .tv tag bind t2 <Button-1> {lappend ::tagtest t2} # Cell with both binds set ::tagtest a cellEvent nn.n1 a # Cell with just item tag lappend ::tagtest b cellEvent nn.n1 b # Cell with just cell tag lappend ::tagtest c cellEvent nn.n2 c # Same tag on both cell and item should fire once .tv tag cell add t1 "nn.n1 b" lappend ::tagtest b cellEvent nn.n1 b # Break in first bind .tv tag bind t1 <Button-1> {lappend ::tagtest t1;break} lappend ::tagtest a cellEvent nn.n1 a set ::tagtest } -cleanup { rename cellEvent {} destroy .tv } -result {a t1 t2 b t1 c t2 b t1 a t1} test treeview-12.2 "tag bindings deletion on tag delete" -setup { tvSetupWithItems .tv tag bind nn.n1 <Button-1> {puts Triggered} } -body { .tv tag delete nn.n1 .tv tag bind nn.n1 } -cleanup { destroy .tv } -result {} test treeview-23.1 "cell padding" -setup { tvSetupWithItems } -body { .tv tag cell add mytag "nn b" set redcross [image create photo -format gif -data {R0lGODlhBwAHAIABAP8AAP/// yH5BAEKAAEALAAAAAAHAAcAAAIMBIKmsWrIXnLxuDMLADs=}] .tv tag configure mytag -image $redcross .tv tag configure mytag -imageanchor nw .tv tag configure mytag -padding {2 4 6 8} .tv tag configure mytag -padding } -cleanup { destroy .tv } -result {2 4 6 8} tcltest::cleanupTests |
Changes to tests/ttk/ttk.test.
1 |
| | | 1 2 3 4 5 6 7 8 9 | package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands proc skip args {} proc ok {} { return } |
︙ | ︙ | |||
83 84 85 86 87 88 89 | .b invoke destroy .b set ::A } -result {it worked} test ttk-6.9 "Bad font spec in styles" -setup { ttk::style theme create badfont -settings { | | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | .b invoke destroy .b set ::A } -result {it worked} test ttk-6.9 "Bad font spec in styles" -setup { ttk::style theme create badfont -settings { ttk::style configure . -font {Helvetica 12 Bogus} } ttk::style theme use badfont } -cleanup { ttk::style theme use default } -body { pack [ttk::label .l -text Hi! -font {}] event generate .l <Expose> |
︙ | ︙ | |||
115 116 117 118 119 120 121 | proc kill.b {args} { destroy .b } } -cleanup { unset OUCH } -body { list \ [catch { ttk::checkbutton .b -variable OUCH } msg] \ $msg \ | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | proc kill.b {args} { destroy .b } } -cleanup { unset OUCH } -body { list \ [catch { ttk::checkbutton .b -variable OUCH } msg] \ $msg \ [winfo exists .b] \ [info commands .b] \ ; } -result [list 1 "widget has been destroyed" 0 {}] test ttk-selfdestruct-ok-1 "Intentional self-destruction" -body { # see #2298720 toplevel .t |
︙ | ︙ | |||
154 155 156 157 158 159 160 | proc checkstate {w} { foreach statespec { {!active !disabled} {!active disabled} {active !disabled} {active disabled} | | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | proc checkstate {w} { foreach statespec { {!active !disabled} {!active disabled} {active !disabled} {active disabled} active disabled } { lappend result [$w instate $statespec] } set result } # NB: this will fail if the top-level window pops up underneath the cursor test ttk-2.0 "Check state" -body { checkstate .t |
︙ | ︙ | |||
207 208 209 210 211 212 213 | destroy .b set ttk28 {} pack [ttk::button .b -command {set ::ttk28 failed}] update } -body { bind .b <Button-1> {after 0 {.b configure -state disabled}} after 1 {event generate .b <Button-1>} | | | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | destroy .b set ttk28 {} pack [ttk::button .b -command {set ::ttk28 failed}] update } -body { bind .b <Button-1> {after 0 {.b configure -state disabled}} after 1 {event generate .b <Button-1>} after 50 {event generate .b <ButtonRelease-1>} set aid [after 100 {set ::ttk28 [.b instate {disabled !pressed}]}] vwait ::ttk28 after cancel $aid set ttk28 } -cleanup { destroy .b unset -nocomplain ttk28 aid |
︙ | ︙ | |||
293 294 295 296 297 298 299 | # @@@ but that's not really feasible in the current framework. } pack [ttk::button .tb1 -text "Ouch"] ttk::style theme use alt update; # As long as we haven't crashed, everything's OK ttk::style theme settings alt { | | | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | # @@@ but that's not really feasible in the current framework. } pack [ttk::button .tb1 -text "Ouch"] ttk::style theme use alt update; # As long as we haven't crashed, everything's OK ttk::style theme settings alt { ttk::style configure TButton -font TkDefaultFont } ttk::style theme use default destroy .tb1 } # # -compound tests: |
︙ | ︙ | |||
436 437 438 439 440 441 442 443 444 445 446 447 448 449 | test ttk-9.8 "-textvariable overrides -text" -body { ttk::label .tl -textvariable TV set TV Foo .tl configure -text Bar .tl cget -text } -cleanup { destroy .tl } -result "Foo" # # Frame widget tests: # test ttk-10.1 "ttk::frame -class resource" -body { ttk::frame .f -class Foo } -result .f | > > > > > > > > > | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | test ttk-9.8 "-textvariable overrides -text" -body { ttk::label .tl -textvariable TV set TV Foo .tl configure -text Bar .tl cget -text } -cleanup { destroy .tl } -result "Foo" test ttk-9.9 "default for -justify" -body { ttk::label .tl .tl cget -justify } -cleanup { destroy .tl } -result "left" test ttk-9.10 "default for -anchor" -body { ttk::label .tl .tl cget -anchor } -cleanup { destroy .tl } -result "w" # # Frame widget tests: # test ttk-10.1 "ttk::frame -class resource" -body { ttk::frame .f -class Foo } -result .f |
︙ | ︙ | |||
555 556 557 558 559 560 561 | .tb1 configure -style badstyle } -cleanup { destroy .tb1 } -returnCodes error -result "*badstyle not found*" -match glob test ttk-13.5 "Custom layouts -- missing element definition" -body { ttk::style layout badstyle { | | | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | .tb1 configure -style badstyle } -cleanup { destroy .tb1 } -returnCodes error -result "*badstyle not found*" -match glob test ttk-13.5 "Custom layouts -- missing element definition" -body { ttk::style layout badstyle { NoSuchElement } ttk::button .tb1 -style badstyle } -cleanup { destroy .tb1 } -result .tb1 # @@@ Should: signal an error, possibly a background error. |
︙ | ︙ | |||
650 651 652 653 654 655 656 657 658 659 660 661 662 | test ttk-ensemble-4 "style element create: insufficient args" -body { ttk::style element create plain.background from } -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 "" eval destroy [winfo children .] tcltest::cleanupTests #*EOF* | > > > > > > > > > > > | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | test ttk-ensemble-4 "style element create: insufficient args" -body { ttk::style element create plain.background from } -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 #*EOF* |
Changes to tests/ttk/validate.test.
1 2 3 4 5 | ## ## Entry widget validation tests ## Derived from core test suite entry-19.1 through entry-19.20 ## | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | ## ## Entry widget validation tests ## Derived from core test suite entry-19.1 through entry-19.20 ## package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands testConstraint ttkEntry 1 testConstraint coreEntry [expr {![testConstraint ttkEntry]}] |
︙ | ︙ | |||
74 75 76 77 78 79 80 81 | set ::vVals {} .e configure -validate focus .e insert end d set ::vVals } -result {} test validate-1.8 {entry widget validation - vmode focus} -body { focus -force .e | > > < > | > > < > | > > < > | > > < > | > > < > | < > < | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | set ::vVals {} .e configure -validate focus .e insert end d set ::vVals } -result {} test validate-1.8 {entry widget validation - vmode focus} -body { set ::vVals {} set timer [after 300 lappend ::vVals timeout] focus -force .e vwait ::vVals after cancel $timer set ::vVals } -result {.e -1 -1 abcd abcd {} focus focusin} test validate-1.9 {entry widget validation - vmode focus} -body { set ::vVals {} set timer [after 300 lappend ::vVals timeout] focus -force . vwait ::vVals after cancel $timer set ::vVals } -result {.e -1 -1 abcd abcd {} focus focusout} .e configure -validate all test validate-1.10 {entry widget validation - vmode all} -body { set ::vVals {} set timer [after 300 lappend ::vVals timeout] focus -force .e vwait ::vVals after cancel $timer set ::vVals } -result {.e -1 -1 abcd abcd {} all focusin} test validate-1.11 {entry widget validation} -body { set ::vVals {} set timer [after 300 lappend ::vVals timeout] focus -force . vwait ::vVals after cancel $timer set ::vVals } -result {.e -1 -1 abcd abcd {} all focusout} .e configure -validate focusin test validate-1.12 {entry widget validation} -body { set ::vVals {} set timer [after 300 lappend ::vVals timeout] focus -force .e vwait ::vVals after cancel $timer set ::vVals } -result {.e -1 -1 abcd abcd {} focusin focusin} test validate-1.13 {entry widget validation} -body { set ::vVals {} focus -force . update set ::vVals } -result {} .e configure -validate focuso test validate-1.14 {entry widget validation} -body { set ::vVals {} focus -force .e update set ::vVals } -result {} test validate-1.15 {entry widget validation} -body { focus -force . # update necessary to process FocusOut event |
︙ | ︙ | |||
225 226 227 228 229 230 231 | ### invalid state behavior # test validate-3.0 "Setup" -body { set ::E "123" ttk::entry .e \ | | | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | ### invalid state behavior # test validate-3.0 "Setup" -body { set ::E "123" ttk::entry .e \ -validatecommand {string is integer -strict %P} \ -validate all \ -textvariable ::E \ ; return [list [.e get] [.e state]] } -result [list 123 {}] test validate-3.1 "insert - valid" -body { |
︙ | ︙ |
Changes to tests/ttk/vsapi.test.
1 2 3 | # -*- tcl -*- # | | | 1 2 3 4 5 6 7 8 9 10 11 | # -*- tcl -*- # package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands testConstraint xpnative \ [expr {"xpnative" in [ttk::style theme names]}] |
︙ | ︙ |
Changes to tests/unixButton.test.
1 2 3 4 5 6 7 | # This file is a Tcl script to test the Unix specific behavior of # labels, buttons, checkbuttons, and radiobuttons in Tk (i.e., all the # widgets defined in tkUnixButton.c). It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # This file is a Tcl script to test the Unix specific behavior of # labels, buttons, checkbuttons, and radiobuttons in Tk (i.e., all the # widgets defined in tkUnixButton.c). It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test imageInit |
︙ | ︙ |
Changes to tests/unixEmbed.test.
1 2 3 4 5 | # This file is a Tcl script to test out the procedures in the file # tkUnixEmbed.c. It is organized in the standard fashion for Tcl # tests. # # Copyright © 1996-1997 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file is a Tcl script to test out the procedures in the file # tkUnixEmbed.c. It is organized in the standard fashion for Tcl # tests. # # Copyright © 1996-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] namespace eval ::_test_tmp {} # ------------------------------------------------------------------------------ # Proc ::_test_tmp::testInterp # ------------------------------------------------------------------------------ |
︙ | ︙ | |||
87 88 89 90 91 92 93 | expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \ && ([lindex $vals 2]/256 == $blue) } testConstraint pressbutton [llength [info commands pressbutton]] test unixEmbed-1.1 {TkpUseWindow procedure, bad window identifier} -constraints { | | | | | | | | | | | | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \ && ([lindex $vals 2]/256 == $blue) } testConstraint pressbutton [llength [info commands pressbutton]] test unixEmbed-1.1 {TkpUseWindow procedure, bad window identifier} -constraints { unix } -setup { deleteWindows } -body { toplevel .t -use xyz } -returnCodes error -result {expected integer but got "xyz"} test unixEmbed-1.2 {TkpUseWindow procedure, bad window identifier} -constraints { unix } -setup { deleteWindows } -body { toplevel .t -use 47 } -returnCodes error -result {couldn't create child of window "47"} test unixEmbed-1.3 {TkpUseWindow procedure, inheriting colormap} -constraints { unix nonPortable } -setup { deleteWindows } -body { toplevel .t -colormap new wm geometry .t +0+0 eatColors .t.t frame .t.f -container 1 toplevel .x -use [winfo id .t.f] colorsFree .x } -cleanup { deleteWindows } -result 0 test unixEmbed-1.4 {TkpUseWindow procedure, inheriting colormap} -constraints { unix nonPortable } -setup { deleteWindows } -body { toplevel .t -container 1 -colormap new wm geometry .t +0+0 eatColors .t2 toplevel .x -use [winfo id .t] colorsFree .x } -cleanup { deleteWindows } -result 1 test unixEmbed-1.5 {TkpUseWindow procedure, creating Container records} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 dobg "set w [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t -use $w list [testembed] [expr [lindex [lindex [testembed all] 0] 0] - $w] } } -cleanup { deleteWindows } -result {{{XXX {} {} .t}} 0} test unixEmbed-1.5a {TkpUseWindow procedure, creating Container records} -constraints { unix testembed } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
167 168 169 170 171 172 173 | list [testembed] [expr {[lindex [lindex [testembed all] 0] 0] - [w]}] } } -cleanup { interp delete child deleteWindows } -result {{{XXX {} {} .t}} 0} test unixEmbed-1.6 {TkpUseWindow procedure, creating Container records} -constraints { | | | | | | | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | list [testembed] [expr {[lindex [lindex [testembed all] 0] 0] - [w]}] } } -cleanup { interp delete child deleteWindows } -result {{{XXX {} {} .t}} 0} test unixEmbed-1.6 {TkpUseWindow procedure, creating Container records} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 dobg "set w1 [winfo id .f1]" dobg "set w2 [winfo id .f2]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 toplevel .t2 -use $w2 testembed } } -cleanup { deleteWindows } -result {{XXX {} {} .t2} {XXX {} {} .t1}} test unixEmbed-1.6a {TkpUseWindow procedure, creating Container records} -constraints { unix testembed } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
209 210 211 212 213 214 215 | testembed } } -cleanup { interp delete child deleteWindows } -result {{XXX {} {} .t2} {XXX {} {} .t1}} test unixEmbed-1.7 {TkpUseWindow procedure, container and embedded in same app} -constraints { | | | | | | | | | | | | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | testembed } } -cleanup { interp delete child deleteWindows } -result {{XXX {} {} .t2} {XXX {} {} .t1}} test unixEmbed-1.7 {TkpUseWindow procedure, container and embedded in same app} -constraints { unix testembed } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 toplevel .t1 -use [winfo id .f1] toplevel .t2 -use [winfo id .f2] testembed } -cleanup { deleteWindows } -result {{XXX .f2 {} .t2} {XXX .f1 {} .t1}} # Can't think of any way to test the procedures Tk_MakeWindow, # Tk_MakeContainer, or EmbedErrorProc. test unixEmbed-2.1 {EmbeddedEventProc procedure} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 testembed } destroy .f1 update dobg { testembed } } -cleanup { deleteWindows } -result {} test unixEmbed-2.1a {EmbeddedEventProc procedure} -constraints { unix testembed } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
273 274 275 276 277 278 279 | child eval { testembed } } -cleanup { deleteWindows } -result {} test unixEmbed-2.2 {EmbeddedEventProc procedure} -constraints { | | | | | | | | | | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | child eval { testembed } } -cleanup { deleteWindows } -result {} test unixEmbed-2.2 {EmbeddedEventProc procedure} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 testembed destroy .t1 testembed } } -cleanup { deleteWindows } -result {} test unixEmbed-2.2a {EmbeddedEventProc procedure} -constraints { unix testembed } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
313 314 315 316 317 318 319 | testembed } } -cleanup { interp delete child deleteWindows } -result {} test unixEmbed-2.3 {EmbeddedEventProc procedure} -constraints { | | | | | | | | | | | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | testembed } } -cleanup { interp delete child deleteWindows } -result {} test unixEmbed-2.3 {EmbeddedEventProc procedure} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 toplevel .t1 -use [winfo id .f1] update destroy .f1 testembed } -result {} test unixEmbed-2.4 {EmbeddedEventProc procedure} -constraints { unix testembed } -setup { deleteWindows } -body { pack [frame .f1 -container 1 -width 200 -height 50] toplevel .t1 -use [winfo id .f1] set x [testembed] update destroy .t1 update list $x [winfo exists .t1] [winfo exists .f1] [testembed] } -cleanup { deleteWindows } -result "{{XXX .f1 {} .t1}} 0 0 {}" test unixEmbed-3.1 {ContainerEventProc procedure, detect creation} -constraints { unix testembed nonPortable } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" set x [testembed] dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 wm withdraw .t1 } list $x [testembed] } -cleanup { deleteWindows } -result {{{XXX .f1 {} {}}} {{XXX .f1 XXX {}}}} test unixEmbed-3.1a {ContainerEventProc procedure, detect creation} -constraints { unix testembed } -setup { catch {interp delete child} ::_test_tmp::testInterp child load {} Tktest child |
︙ | ︙ | |||
379 380 381 382 383 384 385 | } list $x [testembed] } -cleanup { interp delete child deleteWindows } -result {{{XXX .f1 {} {}}} {{XXX .f1 {} {}}}} test unixEmbed-3.2 {ContainerEventProc procedure, set size on creation} -constraints { | | | | | | | | | | | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | } list $x [testembed] } -cleanup { interp delete child deleteWindows } -result {{{XXX .f1 {} {}}} {{XXX .f1 {} {}}}} test unixEmbed-3.2 {ContainerEventProc procedure, set size on creation} -constraints { unix } -setup { deleteWindows update } -body { toplevel .t1 -container 1 wm geometry .t1 +0+0 toplevel .t2 -use [winfo id .t1] -bg red update wm geometry .t2 } -cleanup { deleteWindows } -result {200x200+0+0} test unixEmbed-3.3 {ContainerEventProc procedure, disallow position changes} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 -bd 2 -relief raised update wm geometry .t1 +30+40 } update dobg { wm geometry .t1 } } -cleanup { deleteWindows } -result {200x200+0+0} test unixEmbed-3.3a {ContainerEventProc procedure, disallow position changes} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
437 438 439 440 441 442 443 | wm geometry .t1 } } -cleanup { interp delete child deleteWindows } -result {200x200+0+0} test unixEmbed-3.4 {ContainerEventProc procedure, disallow position changes} -constraints { | | | | | | | | | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | wm geometry .t1 } } -cleanup { interp delete child deleteWindows } -result {200x200+0+0} test unixEmbed-3.4 {ContainerEventProc procedure, disallow position changes} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 update wm geometry .t1 300x100+30+40 } update dobg { wm geometry .t1 } } -cleanup { deleteWindows } -result {300x100+0+0} test unixEmbed-3.4a {ContainerEventProc procedure, disallow position changes} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
481 482 483 484 485 486 487 | wm geometry .t1 } } -cleanup { interp delete child deleteWindows } -result {300x100+0+0} test unixEmbed-3.5 {ContainerEventProc procedure, geometry requests} -constraints { | | | | | | | | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | wm geometry .t1 } } -cleanup { interp delete child deleteWindows } -result {300x100+0+0} test unixEmbed-3.5 {ContainerEventProc procedure, geometry requests} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update dobg { .t1 configure -width 300 -height 80 } update list [winfo width .f1] [winfo height .f1] [dobg {wm geometry .t1}] } -cleanup { deleteWindows } -result {300 80 300x80+0+0} test unixEmbed-3.5a {ContainerEventProc procedure, geometry requests} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
524 525 526 527 528 529 530 | } list [winfo width .f1] [winfo height .f1] [child eval {wm geometry .t1}] } -cleanup { interp delete child deleteWindows } -result {300 80 300x80+0+0} test unixEmbed-3.6 {ContainerEventProc procedure, map requests} -constraints { | | | | | | | | | | | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | } list [winfo width .f1] [winfo height .f1] [child eval {wm geometry .t1}] } -cleanup { interp delete child deleteWindows } -result {300 80 300x80+0+0} test unixEmbed-3.6 {ContainerEventProc procedure, map requests} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 set x unmapped bind .t1 <Map> {set x mapped} } update dobg { after 100 update set x } } -cleanup { deleteWindows } -result {mapped} test unixEmbed-3.6a {ContainerEventProc procedure, map requests} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
572 573 574 575 576 577 578 | set x } } -cleanup { interp delete child deleteWindows } -result {mapped} test unixEmbed-3.7 {ContainerEventProc procedure, destroy events} -constraints { | | | | | | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | set x } } -cleanup { interp delete child deleteWindows } -result {mapped} test unixEmbed-3.7 {ContainerEventProc procedure, destroy events} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" bind .f1 <Destroy> {set x dead} set x alive dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update dobg { destroy .t1 } update list $x [winfo exists .f1] } -cleanup { deleteWindows } -result {dead 0} test unixEmbed-3.7a {ContainerEventProc procedure, destroy events} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
621 622 623 624 625 626 627 | list $x [winfo exists .f1] } -cleanup { interp delete child deleteWindows } -result {dead 0} test unixEmbed-4.1 {EmbedStructureProc procedure, configure events} -constraints { | | | | | | | | | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | list $x [winfo exists .f1] } -cleanup { interp delete child deleteWindows } -result {dead 0} test unixEmbed-4.1 {EmbedStructureProc procedure, configure events} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update dobg { .t1 configure -width 180 -height 100 } update dobg { winfo geometry .t1 } } -cleanup { deleteWindows } -result {180x100+0+0} test unixEmbed-4.1a {EmbedStructureProc procedure, configure events} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
667 668 669 670 671 672 673 | winfo geometry .t1 } } -cleanup { interp delete child deleteWindows } -result {180x100+0+0} test unixEmbed-4.2 {EmbedStructureProc procedure, destroy events} -constraints { | | | | | | | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | winfo geometry .t1 } } -cleanup { interp delete child deleteWindows } -result {180x100+0+0} test unixEmbed-4.2 {EmbedStructureProc procedure, destroy events} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update set x [testembed] destroy .f1 update list $x [testembed] } -cleanup { deleteWindows } -result {{{XXX .f1 XXX {}}} {}} test unixEmbed-4.2a {EmbedStructureProc procedure, destroy events} -constraints { unix testembed } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
712 713 714 715 716 717 718 | } -cleanup { interp delete child deleteWindows } -result "{{XXX .f1 {} {}}} {}" test unixEmbed-5.1 {EmbedFocusProc procedure, FocusIn events} -constraints { | | | > | | | | | | > | | > | | > | | > | | | | | | > | 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | } -cleanup { interp delete child deleteWindows } -result "{{XXX .f1 {} {}}} {}" test unixEmbed-5.1 {EmbedFocusProc procedure, FocusIn events} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 bind .t1 <FocusIn> {lappend x "focus in %W"} bind .t1 <FocusOut> {lappend x "focus out %W"} set x {} } focus -force .f1 update dobg {set x} } -cleanup { deleteWindows } -result {{focus in .t1}} test unixEmbed-5.1a {EmbedFocusProc procedure, FocusIn events} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update child alias w1 winfo id .f1 child eval { destroy [winfo child .] toplevel .t1 -use [w1] bind .t1 <FocusIn> {lappend x "focus in %W"} bind .t1 <FocusOut> {lappend x "focus out %W"} update set x {} } focus -force .f1 update child eval {set x} } -cleanup { interp delete child deleteWindows } -result {{focus in .t1}} test unixEmbed-5.2 {EmbedFocusProc procedure, focusing on dead window} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update dobg { after 200 {destroy .t1} } after 400 focus -force .f1 update } -cleanup { deleteWindows } -result {} test unixEmbed-5.2a {EmbedFocusProc procedure, focusing on dead window} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update child alias w1 winfo id .f1 child eval { destroy [winfo child .] toplevel .t1 -use [w1] update after 200 {destroy .t1} } after 400 focus -force .f1 update } -cleanup { interp delete child deleteWindows } -result {} test unixEmbed-5.3 {EmbedFocusProc procedure, FocusOut events} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 bind .t1 <FocusIn> {lappend x "focus in %W"} bind .t1 <FocusOut> {lappend x "focus out %W"} set x {} } focus -force .f1 update set x [dobg {update; set x}] focus . update list $x [dobg {update; set x}] } -cleanup { deleteWindows } -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}} test unixEmbed-5.3a {EmbedFocusProc procedure, FocusOut events} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update child alias w1 winfo id .f1 child eval { destroy [winfo child .] toplevel .t1 -use [w1] set x {} bind .t1 <FocusIn> {lappend x "focus in %W"} bind .t1 <FocusOut> {lappend x "focus out %W"} |
︙ | ︙ | |||
860 861 862 863 864 865 866 | } -cleanup { interp delete child deleteWindows } -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}} test unixEmbed-6.1 {EmbedGeometryRequest procedure, window changes size} -constraints { | | | | | | | | | | | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | } -cleanup { interp delete child deleteWindows } -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}} test unixEmbed-6.1 {EmbedGeometryRequest procedure, window changes size} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 update bind .t1 <Configure> {lappend x {configure .t1 %w %h}} set x {} .t1 configure -width 300 -height 120 update list $x [winfo geom .t1] } } -cleanup { deleteWindows } -result {{{configure .t1 300 120}} 300x120+0+0} test unixEmbed-6.1a {EmbedGeometryRequest procedure, window changes size} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
906 907 908 909 910 911 912 | list $x [winfo geom .t1] } } -cleanup { interp delete child deleteWindows } -result {{configure .t1 300 120} 300x120+0+0} test unixEmbed-6.2 {EmbedGeometryRequest procedure, window changes size} -constraints { | | | | | | | | | | | | | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | list $x [winfo geom .t1] } } -cleanup { interp delete child deleteWindows } -result {{configure .t1 300 120} 300x120+0+0} test unixEmbed-6.2 {EmbedGeometryRequest procedure, window changes size} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 place .f1 -width 200 -height 200 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 update bind .t1 <Configure> {lappend x {configure .t1 %w %h}} set x {} .t1 configure -width 300 -height 120 update list $x [winfo geom .t1] } } -cleanup { deleteWindows } -result {{{configure .t1 200 200}} 200x200+0+0} test unixEmbed-6.2a {EmbedGeometryRequest procedure, window changes size} -constraints { unix } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
956 957 958 959 960 961 962 | interp delete child deleteWindows } -result {{configure .t1 200 200} 200x200+0+0} # Can't think up any tests for TkpGetOtherWindow procedure. test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constraints { | | | | | | | | | | | | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | interp delete child deleteWindows } -result {{configure .t1 200 200} 200x200+0+0} # Can't think up any tests for TkpGetOtherWindow procedure. test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constraints { unix notAqua } -setup { deleteWindows } -body { deleteWindows frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } focus -force . bind . <Key> {lappend x {key %A %E}} set x {} set y [dobg { update bind .t1 <Key> {lappend y {key %A}} set y {} event generate .t1 <Key> -keysym a set y }] update list $x $y } -cleanup { deleteWindows bind . <Key> {} } -result {{{key a 1}} {}} # TkpRedirectKeyEvent is not implemented in win or aqua. If someone # implements it they should change the constraints for this test. test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constraints { unix notAqua failsOnXQuarz } -setup { |
︙ | ︙ | |||
1020 1021 1022 1023 1024 1025 1026 | list $x $y } -cleanup { interp delete child deleteWindows bind . <Key> {} } -result {{{key a 1}} {}} test unixEmbed-7.2 {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints { | | | | | | | | | | | | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 | list $x $y } -cleanup { interp delete child deleteWindows bind . <Key> {} } -result {{{key a 1}} {}} test unixEmbed-7.2 {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update focus -force .f1 update bind . <Key> {lappend x {key %A}} set x {} set y [dobg { update bind .t1 <Key> {lappend y {key %A}} set y {} event generate .t1 <Key> -keysym b set y }] update list $x $y } -cleanup { deleteWindows bind . <Key> {} } -result {{} {{key b}}} test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints { unix } -setup { deleteWindows catch {interp delete child} |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 | deleteWindows bind . <Key> {} } -result {{} {{key b}}} test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints { unix notAqua failsOnUbuntu failsOnXQuarz } -setup { | | | | | | | | | | | | 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 | deleteWindows bind . <Key> {} } -result {{} {{key b}}} test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints { unix notAqua failsOnUbuntu failsOnXQuarz } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -width 200 -height 50 pack .f1 .f2 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 -highlightthickness 2 -bd 2 -relief sunken } focus -force .f2 update list [dobg { focus .t1 set x [list [focus]] update after 500 update lappend x [focus] }] [focus] } -cleanup { deleteWindows } -result {{{} .t1} .f1} test unixEmbed-8.1a {TkpClaimFocus procedure} -constraints unix -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child load {} Tktest child } -body { |
︙ | ︙ | |||
1151 1152 1153 1154 1155 1156 1157 | frame .f2 -width 200 -height 50 pack .f1 .f2 update set w1 [winfo id .f1] child eval "set argv {-use [winfo id .f1]}" load {} Tk child child eval { | | | | | | | | | | | | | | | | | | | | 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 | frame .f2 -width 200 -height 50 pack .f1 .f2 update set w1 [winfo id .f1] child eval "set argv {-use [winfo id .f1]}" load {} Tk child child eval { . configure -bd 2 -highlightthickness 2 -relief sunken } focus -force .f2 update list [child eval { focus . set x [list [focus]] update lappend x [focus] }] [focus] } -cleanup { deleteWindows } -result {{{} .} .f1} catch {interp delete child} test unixEmbed-9.1 {EmbedWindowDeleted procedure, check parentPtr} -constraints { unix testembed } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 frame .f3 -container 1 -width 200 -height 50 frame .f4 -container 1 -width 200 -height 50 pack .f1 .f2 .f3 .f4 set x {} lappend x [testembed] foreach w {.f3 .f4 .f1 .f2} { destroy $w lappend x [testembed] } set x } -cleanup { deleteWindows } -result {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}} test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 -highlightthickness 2 -bd 2 -relief sunken set x {} lappend x [testembed] destroy .t1 lappend x [testembed] } } -cleanup { deleteWindows } -result {{{XXX {} {} .t1}} {}} test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constraints { unix testembed } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child |
︙ | ︙ | |||
1232 1233 1234 1235 1236 1237 1238 | } -cleanup { interp delete child deleteWindows } -result {{{XXX {} {} .t1}} {}} test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { | | < | | | | | | | | | | > | > | > > | < | | | < | > | | < > | < | | 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 | } -cleanup { interp delete child deleteWindows } -result {{{XXX {} {} .t1}} {}} test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { unix } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 toplevel .t1 -use [winfo id .f1] -width 150 -height 80 update wm geometry .t1 +40+50 update wm geometry .t1 } -cleanup { deleteWindows } -result {150x80+0+0} test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { unix } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update toplevel .t1 -use [winfo id .f1] -width 150 -height 80 update wm geometry .t1 70x300+10+20 update wm geometry .t1 } -cleanup { deleteWindows } -result {70x300+0+0} test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints { unix } -setup { deleteWindows } -body { toplevel .t pack [frame .t.f -container 1 -width 200 -height 200] -fill both update toplevel .embed -use [winfo id .t.f] -bg green update focus -force .t focus -force .embed focus } -cleanup { deleteWindows } -result .embed test unixEmbed-11.2 {mouse coordinates in embedded toplevels} -constraints { unix pressbutton } -setup { deleteWindows } -body { set result {} toplevel .main update frame .main.f -container 1 -width 200 -height 200 button .main.b -text "Main Button" -command {lappend result "pushed .main.b"} wm geometry .main 200x400+100+100 pack .main.f -fill both pack .main.b -padx 30 -pady 30 update toplevel .embed -use [winfo id .main.f] -bg green button .embed.b -text "Emb Button" -command {lappend result "pushed .embed.b"} pack .embed.b -padx 30 -pady 30 update focus -force .main update set x [expr {[winfo rootx .main.b] + [winfo width .main.b]/2}] set y [expr {[winfo rooty .main.b] + [winfo height .main.b]/2}] lappend result [winfo containing $x $y] pressbutton $x $y update set x [expr {[winfo rootx .embed.b] + [winfo width .embed.b]/2}] set y [expr {[winfo rooty .embed.b] + [winfo height .embed.b]/2}] lappend result [winfo containing $x $y] pressbutton $x $y update set result } -cleanup { deleteWindows } -result {.main.b {pushed .main.b} .embed.b {pushed .embed.b}} # cleanup deleteWindows cleanupbg cleanupTests return |
Changes to tests/unixFont.test.
1 2 3 4 5 6 7 8 9 10 11 | # This file is a Tcl script to test out the procedures in tkUnixFont.c. # It is organized in the standard fashion for Tcl tests. # # Many of these tests are visually oriented and cannot be checked # programmatically (such as "does an underlined font appear to be # underlined?"); these tests attempt to exercise the code in question, # but there are no results that can be checked. Some tests depend on the # fonts having or not having certain properties, which may not be valid # at all sites. # # Copyright © 1996 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file is a Tcl script to test out the procedures in tkUnixFont.c. # It is organized in the standard fashion for Tcl tests. # # Many of these tests are visually oriented and cannot be checked # programmatically (such as "does an underlined font appear to be # underlined?"); these tests attempt to exercise the code in question, # but there are no results that can be checked. Some tests depend on the # fonts having or not having certain properties, which may not be valid # at all sites. # # Copyright © 1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] if {[tk windowingsystem] eq "x11"} { set xlsf [auto_execok xlsfonts] } foreach {constraint font} { |
︙ | ︙ |
Changes to tests/unixMenu.test.
1 2 3 4 5 6 | # This file is a Tcl script to test menus in Tk. It is # organized in the standard fashion for Tcl tests. This # file tests the Macintosh-specific features of the menu # system. # # Copyright © 1995-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test menus in Tk. It is # organized in the standard fashion for Tcl tests. This # file tests the Macintosh-specific features of the menu # system. # # Copyright © 1995-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/unixSelect.test.
1 2 3 4 5 6 | # This file contains tests for the tkUnixSelect.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file contains tests for the tkUnixSelect.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1999 Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv |
︙ | ︙ |
Changes to tests/unixWm.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out Tk's interactions with # the window manager, including the "wm" command. It is organized # in the standard fashion for Tcl tests. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | > > > > > > > > > > > | | | | > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # This file is a Tcl script to test out Tk's interactions with # the window manager, including the "wm" command. It is organized # in the standard fashion for Tcl tests. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force ::tk::test:loadTkCommand testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # Starting with macOS Ventura it became necessary to wait for windows to be restacked # or to be raised after creation. if {[tk windowingsystem] == "aqua"} { proc restackDelay {} { after 100; } } else { proc restackDelay {} {} } proc sleep ms { global x after $ms {set x 1} vwait x } # Procedure to set up a collection of top-level windows proc makeToplevels {} { deleteWindows foreach i {.raise1 .raise2 .raise3} { toplevel $i wm geom $i 150x100+0+0 update } } # On macOS windows are not allowed to overlap the menubar at the top of the # screen or the dock. So tests which move a window and then check whether it # got moved to the requested location should use a y coordinate larger than the # height of the menubar (normally 23 pixels) and an x coordinate larger than the # width of the dock, if it happens to be on the left. if {[tk windowingsystem] eq "aqua"} { set mb [expr [menubarheight] + 1] set X 100 set Y0 $mb set Y2 [expr $mb + 2] set Y5 [expr $mb + 5] } else { set X 20 set Y0 0 set Y2 2 set Y5 5 } set i 1 foreach geom "+$X+80 +80+$Y0 +$X+$Y0" { destroy .t test unixWm-1.$i {initial window position} unix { toplevel .t -width 200 -height 150 wm geom .t $geom update wm geom .t } 200x150$geom |
︙ | ︙ | |||
100 101 102 103 104 105 106 | format "%s%d%s%d" $xsign [eval expr $x$xsign$xerr] $ysign \ [eval expr $y$ysign$yerr] } $geom incr i } set i 1 | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | format "%s%d%s%d" $xsign [eval expr $x$xsign$xerr] $ysign \ [eval expr $y$ysign$yerr] } $geom incr i } set i 1 foreach geom "+$X+80 +$X+40 +$X+$Y0" { test unixWm-4.$i {moving window while withdrawn} unix { wm withdraw .t update idletasks wm geom .t $geom update idletasks wm deiconify .t update idletasks |
︙ | ︙ | |||
184 185 186 187 188 189 190 | wm withdraw .t wm iconify .t list [winfo ismapped .t] [wm state .t] } {0 iconic} destroy .t toplevel .t -width 200 -height 100 | | | | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | wm withdraw .t wm iconify .t list [winfo ismapped .t] [wm state .t] } {0 iconic} destroy .t toplevel .t -width 200 -height 100 wm geom .t +100+$Y0 wm minsize .t 1 1 update test unixWm-6.1 {size changes} unix { .t config -width 180 -height 150 update wm geom .t } 180x150+100+$Y0 test unixWm-6.2 {size changes} unix { wm geom .t 250x60 .t config -width 170 -height 140 update wm geom .t } 250x60+100+$Y0 test unixWm-6.3 {size changes} unix { wm geom .t 250x60 .t config -width 170 -height 140 wm geom .t {} update wm geom .t } 170x140+100+$Y0 test unixWm-6.4 {size changes} {unix nonPortable userInteraction} { wm minsize .t 1 1 update puts stdout "Please resize window \"t\" with the mouse (but don't move it!)," puts -nonewline stdout "then hit return: " flush stdout gets stdin |
︙ | ︙ | |||
286 287 288 289 290 291 292 | list [catch {wm iconwindow} msg] $msg } {1 {wrong # args: should be "wm option window ?arg ...?"}} test unixWm-8.3 {icon windows} unix { destroy .t toplevel .t -width 100 -height 30 list [catch {wm iconwindow .t b c} msg] $msg } {1 {wrong # args: should be "wm iconwindow window ?pathName?"}} | | | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | list [catch {wm iconwindow} msg] $msg } {1 {wrong # args: should be "wm option window ?arg ...?"}} test unixWm-8.3 {icon windows} unix { destroy .t toplevel .t -width 100 -height 30 list [catch {wm iconwindow .t b c} msg] $msg } {1 {wrong # args: should be "wm iconwindow window ?pathName?"}} test unixWm-8.4 {icon windows} {unix failsOnUbuntu failsOnXQuarz} { destroy .t destroy .icon toplevel .t -width 100 -height 30 wm geom .t +0+0 update idletasks set result [wm iconwindow .t] toplevel .icon -width 50 -height 50 -bg red |
︙ | ︙ | |||
631 632 633 634 635 636 637 | destroy .icon toplevel .icon -width 50 -height 50 -bg red wm iconwindow .t .icon set result [list [catch {wm deiconify .icon} msg] $msg] destroy .icon set result } {1 {can't deiconify .icon: it is an icon for .t}} | | | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | destroy .icon toplevel .icon -width 50 -height 50 -bg red wm iconwindow .t .icon set result [list [catch {wm deiconify .icon} msg] $msg] destroy .icon set result } {1 {can't deiconify .icon: it is an icon for .t}} test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} {unix failsOnUbuntu failsOnXQuarz} { wm iconify .t set result {} lappend result [winfo ismapped .t] [wm state .t] wm deiconify .t lappend result [winfo ismapped .t] [wm state .t] } {0 iconic 1 normal} |
︙ | ︙ | |||
850 851 852 853 854 855 856 | toplevel .t2 wm geom .t2 +0+0 wm iconwindow .t .t2 set result [list [catch {wm iconify .t2} msg] $msg] destroy .t2 set result } {1 {can't iconify ".t2": it is an icon for ".t"}} | | | | 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | toplevel .t2 wm geom .t2 +0+0 wm iconwindow .t .t2 set result [list [catch {wm iconify .t2} msg] $msg] destroy .t2 set result } {1 {can't iconify ".t2": it is an icon for ".t"}} test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu failsOnXQuarz} { destroy .t2 toplevel .t2 wm geom .t2 +0+0 update idletasks wm iconify .t2 update idletasks set result [winfo ismapped .t2] destroy .t2 set result } 0 test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu failsOnXQuarz} { destroy .t2 toplevel .t2 wm geom .t2 -0+0 update idletasks set result [winfo ismapped .t2] wm iconify .t2 update idletasks |
︙ | ︙ | |||
895 896 897 898 899 900 901 | } {{} questhead 0x20 {} 0x0} test unixWm-24.3 {Tk_WmCmd procedure, "iconmask" option} unix { list [catch {wm iconmask .t bogus} msg] $msg } {1 {bitmap "bogus" not defined}} test unixWm-25.1 {Tk_WmCmd procedure, "iconname" option} unix { list [catch {wm icon .t} msg] $msg | | | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | } {{} questhead 0x20 {} 0x0} test unixWm-24.3 {Tk_WmCmd procedure, "iconmask" option} unix { list [catch {wm iconmask .t bogus} msg] $msg } {1 {bitmap "bogus" not defined}} test unixWm-25.1 {Tk_WmCmd procedure, "iconname" option} unix { list [catch {wm icon .t} msg] $msg } {1 {ambiguous option "icon": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbadge, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, touch, transient, or withdraw}} test unixWm-25.2 {Tk_WmCmd procedure, "iconname" option} unix { list [catch {wm iconname .t 12 13} msg] $msg } {1 {wrong # args: should be "wm iconname window ?newName?"}} test unixWm-25.3 {Tk_WmCmd procedure, "iconname" option} {unix testwrapper} { set result {} lappend result [wm iconname .t] wm iconname .t test_name |
︙ | ︙ | |||
1223 1224 1225 1226 1227 1228 1229 | WM_NORMAL_HINTS] 0]]] lappend result [wm sizefrom .t] $bit } {{} program 0x8 user 0x2} test unixWm-34.3 {Tk_WmCmd procedure, "sizefrom" option} unix { list [catch {wm sizefrom .t none} msg] $msg } {1 {bad argument "none": must be program or user}} if {[tk windowingsystem] == "aqua"} { | | | | 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 | WM_NORMAL_HINTS] 0]]] lappend result [wm sizefrom .t] $bit } {{} program 0x8 user 0x2} test unixWm-34.3 {Tk_WmCmd procedure, "sizefrom" option} unix { list [catch {wm sizefrom .t none} msg] $msg } {1 {bad argument "none": must be program or user}} if {[tk windowingsystem] == "aqua"} { set result_35_1 {1 {bad argument "1": must be iconic, normal, withdrawn, or zoomed}} } else { set result_35_1 {1 {bad argument "1": must be iconic, normal, or withdrawn}} } test unixWm-35.1 {Tk_WmCmd procedure, "state" option} {unix notAqua} { list [catch {wm state .t 1} msg] $msg } $result_35_1 test unixWm-35.2 {Tk_WmCmd procedure, "state" option} unix { list [catch {wm state .t iconic 1} msg] $msg } {1 {wrong # args: should be "wm state window ?state?"}} |
︙ | ︙ | |||
1344 1345 1346 1347 1348 1349 1350 | lappend result [wm state .t] [winfo ismapped .t] wm deiconify .t lappend result [wm state .t] [winfo ismapped .t] } {withdrawn 0 normal 1} test unixWm-39.1 {Tk_WmCmd procedure, miscellaneous} unix { list [catch {wm unknown .t} msg] $msg | | | | | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 | lappend result [wm state .t] [winfo ismapped .t] wm deiconify .t lappend result [wm state .t] [winfo ismapped .t] } {withdrawn 0 normal 1} test unixWm-39.1 {Tk_WmCmd procedure, miscellaneous} unix { list [catch {wm unknown .t} msg] $msg } {1 {bad option "unknown": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbadge, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, touch, transient, or withdraw}} destroy .t .icon test unixWm-40.1 {Tk_SetGrid procedure, set grid dimensions before turning on grid} {unix nonPortable} { destroy .t toplevel .t wm geometry .t 30x10+0+0 listbox .t.l -height 20 -width 20 -setgrid 1 pack .t.l -fill both -expand 1 update wm geometry .t } {30x10+0+0} test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already set} unix { destroy .t toplevel .t wm geometry .t 200x100+100+$Y0 listbox .t.l -height 20 -width 20 pack .t.l -fill both -expand 1 update .t.l configure -setgrid 1 update wm geometry .t } "20x20+100+$Y0" test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} unix { destroy .t toplevel .t -width 400 -height 150 tkwait visibility .t wm geometry .t +0+0 update idletasks |
︙ | ︙ | |||
1432 1433 1434 1435 1436 1437 1438 | update set result } {configured: 130 200} # No tests for ReparentEvent or ComputeReparentGeometry; I can't figure # out how to exercise these procedures reliably. | | | 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 | update set result } {configured: 130 200} # No tests for ReparentEvent or ComputeReparentGeometry; I can't figure # out how to exercise these procedures reliably. test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} {unix failsOnUbuntu failsOnXQuarz} { destroy .t toplevel .t -width 400 -height 150 wm geometry .t +0+0 tkwait visibility .t set result {} bind .t <Map> {set x "mapped"} bind .t <Unmap> {set x "unmapped"} |
︙ | ︙ | |||
1816 1817 1818 1819 1820 1821 1822 | [winfo containing [expr $x + 199] [expr $y + 250]] \ [winfo containing [expr $x + 200] [expr $y + 250]] \ [winfo containing [expr $x + 220] [expr $y + 250]] \ } $result_50_1 test unixWm-50.2 {Tk_CoordsToWindow procedure, finding a toplevel, y-coords and overrideredirect} unix { deleteWindows toplevel .t -width 400 -height 300 -bg yellow | < > > > > < > > | 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 | [winfo containing [expr $x + 199] [expr $y + 250]] \ [winfo containing [expr $x + 200] [expr $y + 250]] \ [winfo containing [expr $x + 220] [expr $y + 250]] \ } $result_50_1 test unixWm-50.2 {Tk_CoordsToWindow procedure, finding a toplevel, y-coords and overrideredirect} unix { deleteWindows toplevel .t -width 400 -height 300 -bg yellow tkwait visibility .t wm geom .t +100+100 update restackDelay toplevel .t2 -width 200 -height 100 -bg blue tkwait visibility .t2 wm overrideredirect .t2 1 wm geom .t2 +200+200 update raise .t2 restackDelay set x [winfo rootx .t] set y [winfo rooty .t] set y2 [winfo rooty .t2] list [winfo containing [expr $x +200] [expr $y - 30]] \ [winfo containing [expr $x +200] [expr $y - 1]] \ [winfo containing [expr $x +200] $y] \ [winfo containing [expr $x +200] [expr $y2 - 1]] \ |
︙ | ︙ | |||
1859 1860 1861 1862 1863 1864 1865 | toplevel .x -width 100 -height 80 -use [frameid] -bg yellow tkwait visibility .x update set x [winfo rootx .x] set y [winfo rooty .x] } set result [list [child eval {winfo containing [expr $x - 1] [expr $y + 50]}] \ | | < > | > | 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 | toplevel .x -width 100 -height 80 -use [frameid] -bg yellow tkwait visibility .x update set x [winfo rootx .x] set y [winfo rooty .x] } set result [list [child eval {winfo containing [expr $x - 1] [expr $y + 50]}] \ [child eval {winfo containing $x [expr $y + 50]}]] interp delete child set x [winfo rootx .t] set y [winfo rooty .t] lappend result [winfo containing [expr $x + 200] [expr $y + 49]] \ [winfo containing [expr $x + 200] [expr $y +50]] set result } {{} .x .t .t.f} test unixWm-50.4 {Tk_CoordsToWindow procedure, window in other application} unix { destroy .t catch {interp delete child} toplevel .t -width 200 -height 200 -bg green tkwait visibility .t wm geometry .t +100+100 update interp create child load {} Tk child child eval {wm geometry . 200x200+100+100; update} restackDelay set result [list [winfo containing 200 200] \ [child eval {winfo containing 200 200}]] interp delete child set result } {{} .} test unixWm-50.5 {Tk_CoordsToWindow procedure, handling menubars} {unix testmenubar} { deleteWindows |
︙ | ︙ | |||
1956 1957 1958 1959 1960 1961 1962 | set y [expr [winfo rooty .t] + 150] list [winfo containing [expr $x + 50] $y] \ [winfo containing [expr $x + 150] $y] \ [winfo containing [expr $x + 250] $y] \ [winfo containing [expr $x + 350] $y] \ [winfo containing [expr $x + 450] $y] } {.t .t.f .t.f.f .t {}} | | < > > > < > > > > | | 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 | set y [expr [winfo rooty .t] + 150] list [winfo containing [expr $x + 50] $y] \ [winfo containing [expr $x + 150] $y] \ [winfo containing [expr $x + 250] $y] \ [winfo containing [expr $x + 350] $y] \ [winfo containing [expr $x + 450] $y] } {.t .t.f .t.f.f .t {}} test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} {unix failsOnUbuntu failsOnXQuarz} { destroy .t destroy .t2 toplevel .t -width 200 -height 200 -bg green tkwait visibility .t update wm geometry .t +0+0 update toplevel .t2 -width 200 -height 200 -bg red tkwait visibility .t2 update wm geometry .t2 +0+0 update restackDelay set result [list [winfo containing 100 100]] wm iconify .t2 update lappend result [winfo containing 100 100] } {.t2 .t} test unixWm-50.10 {Tk_CoordsToWindow procedure, unmapped windows} unix { destroy .t toplevel .t -width 200 -height 200 -bg green wm geometry .t +0+0 frame .t.f -width 150 -height 150 -bd 2 -relief raised |
︙ | ︙ | |||
2041 2042 2043 2044 2045 2046 2047 | list $result [winfo containing [winfo rootx .raise2] \ [winfo rooty .raise2]] } {.raise1 .raise3} deleteWindows test unixWm-51.6 {TkWmRestackToplevel procedure, window to be stacked isn't mapped} unix { destroy .t toplevel .t -width 200 -height 200 -bg green | < > > > < > < > > > > > > > > | 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 | list $result [winfo containing [winfo rootx .raise2] \ [winfo rooty .raise2]] } {.raise1 .raise3} deleteWindows test unixWm-51.6 {TkWmRestackToplevel procedure, window to be stacked isn't mapped} unix { destroy .t toplevel .t -width 200 -height 200 -bg green tkwait visibility .t wm geometry .t +0+0 update restackDelay destroy .t2 toplevel .t2 -width 200 -height 200 -bg red # This test assumes that .t2 is not mapped yet, but that is not really guaranteed. winfo containing 100 100 } {.t} test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} {unix failsOnXQuarz} { foreach w {.t .t2 .t3} { destroy $w toplevel $w -width 200 -height 200 -bg green wm geometry $w +0+0 update } raise .t .t2 restackDelay update set result [list [winfo containing 100 100]] lower .t3 restackDelay lappend result [winfo containing 100 100] } {.t3 .t} test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix { destroy .t toplevel .t -width 200 -height 200 -bg green wm overrideredirect .t 1 wm geometry .t +0+0 tkwait visibility .t destroy .t2 toplevel .t2 -width 200 -height 200 -bg red wm overrideredirect .t2 1 wm geometry .t2 +0+0 tkwait visibility .t2 restackDelay # Need to use vrootx and vrooty to make tests work correctly with # virtual root window measures managers: overrideredirect windows # come up at (0,0) in display coordinates, not virtual root # coordinates. set x [expr 100-[winfo vrootx .]] set y [expr 100-[winfo vrooty .]] set result [list [winfo containing $x $y]] raise .t restackDelay lappend result [winfo containing $x $y] raise .t2 restackDelay lappend result [winfo containing $x $y] } {.t2 .t .t2} # The mac won't put an overrideredirect window above the root, if {[tk windowingsystem] == "aqua"} { wm withdraw . } test unixWm-51.9 {TkWmRestackToplevel procedure, other window overrideredirect} unix { foreach w {.t .t2 .t3} { destroy $w update toplevel $w -width 200 -height 200 -bg green wm overrideredirect $w 1 wm geometry $w +0+0 tkwait visibility $w update } lower .t3 .t2 restackDelay update # Need to use vrootx and vrooty to make tests work correctly with # virtual root window measures managers: overrideredirect windows # come up at (0,0) in display coordinates, not virtual root # coordinates. set x [expr 100-[winfo vrootx .]] set y [expr 100-[winfo vrooty .]] set result [list [winfo containing $x $y]] lower .t2 restackDelay lappend result [winfo containing $x $y] } {.t2 .t3} if {[tk windowingsystem] == "aqua"} { wm deiconify . } test unixWm-51.10 {TkWmRestackToplevel procedure, don't move window that's already in the right place} unix { makeToplevels |
︙ | ︙ | |||
2497 2498 2499 2500 2501 2502 2503 | # the only thing we can really test here is the syntax. # if {[tk windowingsystem] == "aqua"} { set result_60_1 {-alpha 1.0 -fullscreen 0 -modified 0 -notify 0\ -titlepath {} -topmost 0 -transparent 0\ -type unsupported} } else { | | | 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 | # the only thing we can really test here is the syntax. # if {[tk windowingsystem] == "aqua"} { set result_60_1 {-alpha 1.0 -fullscreen 0 -modified 0 -notify 0\ -titlepath {} -topmost 0 -transparent 0\ -type unsupported} } else { set result_60_1 {-alpha 1.0 -fullscreen 0 -topmost 0 -type {} -zoomed 0} } test unixWm-60.1 {wm attributes - test} -constraints unix -body { destroy .t toplevel .t wm attributes .t } -result $result_60_1 |
︙ | ︙ |
Changes to tests/util.test.
1 2 3 4 5 | # This file is a Tcl script to test out the procedures in the file # tkUtil.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file is a Tcl script to test out the procedures in the file # tkUtil.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/visual.test.
1 2 3 4 5 6 | # This file is a Tcl script to test the visual- and colormap-handling # procedures in the file tkVisual.c. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test the visual- and colormap-handling # procedures in the file tkVisual.c. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/winButton.test.
1 2 3 4 5 6 7 | # This file is a Tcl script to test the Windows specific behavior of # labels, buttons, checkbuttons, and radiobuttons in Tk (i.e., all the # widgets defined in tkWinButton.c). It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # This file is a Tcl script to test the Windows specific behavior of # labels, buttons, checkbuttons, and radiobuttons in Tk (i.e., all the # widgets defined in tkWinButton.c). It is organized in the standard # fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands imageInit |
︙ | ︙ |
Changes to tests/winClipboard.test.
1 2 3 4 5 6 7 8 | # This file is a Tcl script to test out Tk's Windows specific # clipboard code. It is organized in the standard fashion for Tcl # tests. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # This file is a Tcl script to test out Tk's Windows specific # clipboard code. It is organized in the standard fashion for Tcl # tests. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-2000 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test |
︙ | ︙ |
Changes to tests/winDialog.test.
1 2 3 4 5 6 | # -*- tcl -*- # This file is a Tcl script to test the Windows specific behavior of # the common dialog boxes. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # -*- tcl -*- # This file is a Tcl script to test the Windows specific behavior of # the common dialog boxes. It is organized in the standard # fashion for Tcl tests. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Copyright © 1998-1999 ActiveState Corporation. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands |
︙ | ︙ | |||
587 588 589 590 591 592 593 | } } finally { cd $cur } string equal $x [file join $dir testfile] } -result 1 | | > > > > > > > > > > > > > > > | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | } } finally { cd $cur } string equal $x [file join $dir testfile] } -result 1 test winDialog-5.12.7 {tk_getOpenFile: initial directory: ~} -setup { # Ensure there's at least one file in the home directory in CI environments set makeEmpty [expr {![llength [glob -nocomplain -type f -directory ~ *]]}] if {$makeEmpty} { for {set i 1} {$i < 1000} {incr i} { # Technically a race condition... set actualFilename [format "~/tkWinDialog5_12_7_%03d" $i] if {![file exists $actualFilename]} break } close [open $actualFilename w] } } -constraints { nt testwinevent } -body { set fn [file tail [lindex [glob -types f ~/*] 0]] unset -nocomplain x start {set x [tk_getOpenFile \ -initialdir ~ \ -initialfile $fn -title Foo]} then { Click ok } string equal $x [file normalize [file join ~ $fn]] } -cleanup { if {$makeEmpty} { file delete $actualFilename } } -result 1 test winDialog-5.12.8 {tk_getOpenFile: initial directory: .} -constraints { nt testwinevent } -body { # Windows remembers dirs from previous selections so use # a subdir for this test, not [initialdir] itself |
︙ | ︙ |
Changes to tests/winFont.test.
1 2 3 4 5 6 7 8 9 | # This file is a Tcl script to test out the procedures in tkWinFont.c. # It is organized in the standard fashion for Tcl tests. # # Many of these tests are visually oriented and cannot be checked # programmatically (such as "does an underlined font appear to be # underlined?"); these tests attempt to exercise the code in question, # but there are no results that can be checked. # # Copyright © 1996-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # This file is a Tcl script to test out the procedures in tkWinFont.c. # It is organized in the standard fashion for Tcl tests. # # Many of these tests are visually oriented and cannot be checked # programmatically (such as "does an underlined font appear to be # underlined?"); these tests attempt to exercise the code in question, # but there are no results that can be checked. # # Copyright © 1996-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/winMenu.test.
1 2 3 4 5 6 | # This file is a Tcl script to test menus in Tk. It is # organized in the standard fashion for Tcl tests. This # file tests the Macintosh-specific features of the menu # system. # # Copyright © 1995-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test menus in Tk. It is # organized in the standard fashion for Tcl tests. This # file tests the Macintosh-specific features of the menu # system. # # Copyright © 1995-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to tests/winSend.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the "send" command and the # other procedures in the file tkSend.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1994-1996 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out the "send" command and the # other procedures in the file tkSend.c. It is organized in the # standard fashion for Tcl tests. # # Copyright © 1994 Sun Microsystems, Inc. # Copyright © 1994-1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands # Compute a script that will load Tk into a child interpreter. |
︙ | ︙ |
Changes to tests/winWm.test.
1 2 3 4 5 6 7 | # This file tests is a Tcl script to test the procedures in the file # tkWinWm.c. It is organized in the standard fashion for Tcl tests. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # | | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # This file tests is a Tcl script to test the procedures in the file # tkWinWm.c. It is organized in the standard fashion for Tcl tests. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1996 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] test winWm-1.1 {TkWmMapWindow} -constraints win -setup { destroy .t } -body { toplevel .t wm override .t 1 wm geometry .t +0+0 |
︙ | ︙ | |||
275 276 277 278 279 280 281 | wm attributes .t -disabled } -cleanup { destroy .t } -result 0 test winWm-6.3 {wm attributes} -constraints win -setup { destroy .t } -body { | < | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | wm attributes .t -disabled } -cleanup { destroy .t } -result 0 test winWm-6.3 {wm attributes} -constraints win -setup { destroy .t } -body { toplevel .t wm attributes .t -foo } -cleanup { destroy .t } -returnCodes error -result {bad attribute "-foo": must be -alpha, -disabled, -fullscreen, -toolwindow, -topmost, or -transparentcolor} test winWm-6.4 {wm attributes -alpha} -constraints win -setup { destroy .t } -body { # Expect this to return all 1.0 {} on pre-2K/XP toplevel .t set res [wm attributes .t -alpha] |
︙ | ︙ | |||
529 530 531 532 533 534 535 | } -cleanup { foreach cmd {proc1 proc2 proc3 click} { rename winwm91$cmd {} } destroy .tx .t .sd } -result ok | | | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | } -cleanup { foreach cmd {proc1 proc2 proc3 click} { rename winwm91$cmd {} } destroy .tx .t .sd } -result ok test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -constraints {failsOnUbuntu failsOnXQuarz} -setup { destroy .t toplevel .t set winwm92 {} frame .t.f -background blue -height 200 -width 200 frame .t.f.x -background red -height 100 -width 100 } -body { pack .t.f.x |
︙ | ︙ |
Changes to tests/window.test.
1 2 3 4 | # This file is a Tcl script to test the procedures in the file # tkWindow.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1995 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test the procedures in the file # tkWindow.c. It is organized in the standard fashion for Tcl tests. # # Copyright © 1995 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands namespace import ::tk::test::loadTkCommand |
︙ | ︙ | |||
259 260 261 262 263 264 265 266 267 268 269 270 271 272 | } else { set error 0 } removeFile script list $error $msg } -result {0 YES} test window-3.1 {Tk_MakeWindowExist procedure, stacking order and menubars} -constraints { unix testmenubar } -setup { destroy .t } -body { toplevel .t -width 300 -height 200 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | } else { set error 0 } removeFile script list $error $msg } -result {0 YES} test window-2.12 {Test for ticket [9b6065d1fd] - restore Tcl [update] command} -constraints { unixOrWin } -body { set code [loadTkCommand] append code { after 1000 {set forever 1} after 100 {destroy .} after 200 {catch bell msg; puts "ringing the bell -> $msg"} after 250 {update idletasks} after 300 {update} puts "waiting" vwait forever puts "done waiting" catch {bell} msg puts "bell -> $msg" catch update msg puts "update -> $msg" } set script [makeFile $code script] if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} { set error 1 } else { set error 0 } removeFile script list $error $msg } -result {0 {waiting ringing the bell -> can't invoke "bell" command: application has been destroyed done waiting bell -> can't invoke "bell" command: application has been destroyed update -> }} test window-3.1 {Tk_MakeWindowExist procedure, stacking order and menubars} -constraints { unix testmenubar } -setup { destroy .t } -body { toplevel .t -width 300 -height 200 |
︙ | ︙ | |||
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | update lower .t.e2 .t.f update # If stacking order isn't handled properly, generates an X error. } -cleanup { destroy .t } -result {} # cleanup cleanupTests return # Local variables: # mode: tcl # End: | > | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | update lower .t.e2 .t.f update # If stacking order isn't handled properly, generates an X error. } -cleanup { destroy .t } -result {} # cleanup cleanupTests return # Local variables: # mode: tcl # End: |
Changes to tests/winfo.test.
1 2 3 4 5 | # This file is a Tcl script to test out the "winfo" command. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file is a Tcl script to test out the "winfo" command. It is # organized in the standard fashion for Tcl tests. # # Copyright © 1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # eatColors -- # Creates a toplevel window and allocates enough colors in it to # use up all the slots in the colormap. # # Arguments: |
︙ | ︙ | |||
290 291 292 293 294 295 296 | } -returnCodes error -result {wrong # args: should be "winfo viewable window"} test winfo-9.2 {"winfo viewable" command} -body { winfo viewable foo } -returnCodes error -result {bad window path name "foo"} test winfo-9.3 {"winfo viewable" command} -body { winfo viewable . } -result 1 | | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | } -returnCodes error -result {wrong # args: should be "winfo viewable window"} test winfo-9.2 {"winfo viewable" command} -body { winfo viewable foo } -returnCodes error -result {bad window path name "foo"} test winfo-9.3 {"winfo viewable" command} -body { winfo viewable . } -result 1 test winfo-9.4 {"winfo viewable" command} -constraints {failsOnUbuntu failsOnXQuarz} -body { wm iconify . winfo viewable . } -cleanup { wm deiconify . } -result 0 test winfo-9.5 {"winfo viewable" command} -setup { deleteWindows |
︙ | ︙ |
Changes to tests/wm.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out Tk's interactions with the window # manager, including the "wm" command. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | # This file is a Tcl script to test out Tk's interactions with the window # manager, including the "wm" command. It is organized in the standard fashion # for Tcl tests. # # Copyright © 1992-1994 The Regents of the University of California. # Copyright © 1994-1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. # This file tests window manager interactions that work across platforms. # Window manager tests that only work on a specific platform should be placed # in unixWm.test or winWm.test. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands image create photo icon -data { iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAA CBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/w D/AP+gvaeTAAAACXBIWXMAArQNAAK0DQEdFIm+AAAJQElEQVRYw+WXW2xdV5nHf/ty7lc f2/FxYsdOnMSNC0HTpDiRKJWAQjWCEQNUSEAFfUOiQqrEC2+IxwpemDLSzNBBCCQeQEKq RJgBSikiuGlN22TqhsR27OPL8eWc43Pdt7X22osHHydOm4FBPM6Slr69paX9/32Xtb614 f/7MP6vC3O5f8L3G7HJyZPHBwfz5wrF7HQ6nRwxLTOhQuU4PW+z3eq9Xa+33rq9cms7k8 pHjvfS3w8wOfk52u1u8oHpiUff897JJ8+dO/nI6LHho6OjQ3ahkMYwTTZ2O2zXutS3G/7 ayubq7Vtr/7Ve2f7RytLam4ViXq1t/vRvB0ilPsjzz3+LZ5/9j7MzM5Nf/8hj5//5H97/ YNbK5hkfTFLMxAEQQvD766v0yBGIEBEEuPUGi9dv7lx77cb3Vm9vfqc0WNi9evUKWr/xL h3rfuLj45+l0bjM7m768U98/OJ/fulLH/3wiemxeCafxRcKw7TJxKC+12RpbYdAx7HsOC rSRNpg+sQQj1w8nS0N5h8JAvm+rWr99ZmZB2qWdZq9vWt/GWBm5im+9rUn6HRGPv7EE4/ ++2P/eOFkV0FkJTDQgCaXTbO1tcV2R2EmCxBJQixs2+R9EwV00MFAceJE2ZiZOT7VaTsP LyxU5orFTK1cfphq9bX7A8zOfoV8Ps3c3NsXPvWpD37vc5//0ETNt8gNjDAzlsdAE0vli TCRxEhnC2CaRIZNMmZiaonv9mh1PcrDJQZzCfK5OGNjQ8e2tvZO37y5+ctk0naq1fn7A4 yOnmd5uVp4/PGHn/vylz8xe+zoEIP5JAMpA0OHeK6DG4TEk2li8ThaQxRpIg0q6DGUNjg 6UuLYSInhYoYoigiCgHQ6TrGYnlpd3Q1ffvk3L128+ITe2Hj1XoBLl55menqcbDb1haee evyrDz102tJaE7ctLBMqG1X23Ag7kcKOJzAADSilCVWEZdmMDaXJJCxSiRimaaK1RkqJ7 /uUSlk6Hed0oxG9HI9bm+Pjs2xsvIp5AKC15oUX/lA8f/7MF2dnz8YADMNASslypYqrUx SHyqSy+f31hzaRZRpMDKVYr+7y4usVri1WWavWCWSIZZkYhoFSIRcuTI1MTAw9OTf33Tu 7zz54SCRinD17/Pzs7AMPFQqZPlTE8vo2DlmGhgbo12BffD/8SmukitiuNxHKoDwyzPJG nTdXmtiWwdnRNCN5GxWGDA/nOH26/NGpqSfHgPU7AJcuPc0nP/kBrl698YGZmYmMEIJmx 6Hn+my0DUZGC6gIzEOnhu4Lh2GEbRocGyxRSO/7c3QgiRuEVOtdEvEQrSN8IVEq5MSJ4Y lSKX3OMKJ14G4KnnnmM9bkZPk92VyKy3M3eentJjd3FUYyjxuEeELt7/NoP+eBVAipCFX EsYE4xcydYFIeSHKynOXhUwM0mh32egH1tsdL16oo007kcskHs7kYly49fRcALqby+fQo pklkZ4jHY3g6gQgjHF/QcgQdV+7DHJoGmnzSQuvD0QGlIsJQkU4luLXR4kgxxcRgjM1mQ CyZHrv0sUe4JwKFXMmu7/VSXV9xaXqI0YzC8328QOJ4gq4raHQDGt2AtitwfIEbSAwibO vdJ7pSCiElR3IxGh2X5Y0GV66v0wnAsq3MN5759L1FqKMoCkQoX19u0QkkD47lKSYiTh1 NoSLYafu0ehrTNNBaE2mNUop2z+DEUJKBbPxecSEIgoAoUjwwmmZpdZPlmuL4oIFWkbx8 rXIvQMfZ9p2e1xBCstOJcFe6nB1NcWokhW1ZHMkazK90qXXDfZFII0NFIBW/XQiZHraoN bsU81mmjhbxfZ8gCAiCgELKQitJGCoIQ6SQO//2ze/fm4Kf/Px50dzr3Aoch1Ap2o4kn8 tgW/sHynAxzcVTBQYzFp4v6boBjidwfcFCpcmPf7/Oz+ZrvPBalb12D9/370DUGk1evr6 NacWIfD/yveDmXq3F3NxzdwH+5dkfUq8155rb9dA2QcqQcjFx57DRGgaySR47d4RHZ0pY eh/C9QSOJ3EECGWw3fJZ323j+x6e5xH4Pgu3d6g0FMWUjdvu7bo9/5oK1d0IzM09hwhCG rvNubXFylI2pum4AZXtDqEURFGE1hoNxGMW5ZyB22nS8wQ9r1+QvsDzBc1uQGW7jee6eN 4+RMfxMdHkYgatWmtur9ZaOnD8TgQMA27c+uH68s3KT8O9BoYBv3pjkxuVGo7Tw+1/MAh 83lreYm1P9r3fT4XjSVxf4voC1/NwHAfXdXFcB891KGVjhO2e16q3fzR2cjQwDPPeZrSx 8SqXL2/RqDU2EnH7I8dPjQ8v7Tqs1RwmSzEsQoQQSBHw1lKVha0AEUb4IiQQIb4I8YUkk CHTQwa5WIjne9xY2mT+VouRfI7NxfVfrK8sfTuRSAavXP3Xd7fjavWPRq1+3TeiQTVcGn h0oHwktlZzmBq0SNsRQgiuXLvNL/+nQU/aBFL1xSW+kAghEb5PEkE5q3Bdl7dv72LGCrT Xdzf+9Nb8N5dXfrG6Wf1jeNDP3nkjigOFWm2xpvx0+tjI8LnMYMnMxQT5eIjruVye36LS TRAqRSD3vZdCIqUgEj5R4CEDj2O5kMZei3rHoLXV6Sy88cp3Fhf/ew6IAAGE9wOIARmtw 9Tu7vKa1yY+Wiqeee+ZYdsi4HdvrjK/HiKUiZQhoZREQhDJAC18tPSIhEfouwSuQ9cx2V xpNK/PX/n+4uKvXwQdAAHgA/J+AAaQABJRJOydnVsrzZ1O13eMcSuezC61LJzQRgY+KvC JhI+WPpH0IAywIkEhaVIupAhdHS0t3F66Nv/iD9bW/nAFtAM4QA9wAXX3RnEvQBoYODSL +fzEmalTsx+emjl3YWjsaMlMpcwg0ggZEimFoSNsI8JSCtF1wtpmdWt1aeGVSuW133leY wNoA01gr297BzVwv/8CA0gBBaDYtzkw87ns6PhI+czM0JHjp/PFUjmZSmUM07RCKUPP6X Vae/Vqfbdys1ZbvOX5ja2+ULcP0Opbt18H/G8Ah+shDWQPzVQ/RSnLTGRsO5U0TMuMVKj C0PUjLd1+fgPAOxTybl9YcvdC9VcBDobV3x0JINm3MfYbmdX/hu57FfZFDgot6Fe8eqfw 3wLwzvVmX9jsvx8AHEAcnn91/BlySEFKTpuCtgAAABN0RVh0QXV0aG9yAHdhcnN6YXdpY W5rYQy+S5cAAABYdEVYdENvcHlyaWdodABDQzAgUHVibGljIERvbWFpbiBEZWRpY2F0aW 9uIGh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL3B1YmxpY2RvbWFpbi96ZXJvLzEuMC/ G4735AAAAIXRFWHRDcmVhdGlvbiBUaW1lADIwMTAtMDMtMjlUMDg6MDg6MzD47LxwAAAA JXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTA4LTE1VDIwOjU0OjM5LTA0OjAwNBT3DQAAACV0R Vh0ZGF0ZTptb2RpZnkAMjAyMS0wOC0xNVQyMDo1NDoxMS0wNDowMDSDBqsAAADIelRYdE Rlc2NyaXB0aW9uAAAY042OwQqCQBCGn6B3GOy+Cl0qTAjEc1HRJVhWHXUrd2pmLXr7tDr VpcMP838w/F+wxxxyprsgB2ALclAxtRAbaBirRdB4f5mHoTeuJlUxYoly8nRRxHW4HahO 30SvmI5Y+CCBF4dPhzg0CYwOLs45GdKfG+sKhBuy2H4xUlM1i76+BhcBwwirLj/bAlJqj XXzP9UyxmuHzp8feiknLPW6Q/H9moy3yK1oqvROUE2yH99suX45PwEyf2MTOoCNrQAAAB l0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABWdEVYdFNvdXJjZQBodHR wczovL29wZW5jbGlwYXJ0Lm9yZy9kZXRhaWwvMzUyMzMvdGFuZ28taW5ldHJuZXQtd2Vi LWJyb3dzZXItYnktd2Fyc3phd2lhbmth5nAuRgAAACB0RVh0VGl0bGUAdGFuZ28gaW5ld HJuZXQgd2ViIGJyb3dzZXLyr62TAAAAAElFTkSuQmCC } wm deiconify . if {![winfo ismapped .]} { tkwait visibility . } proc stdWindow {} { destroy .t toplevel .t -width 100 -height 50 wm geom .t +0+0 update } testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # [raise] and [lower] may return before the window manager has completed the # operation. The raiseDelay procedure idles for a while to give the operation # a chance to complete. # |
︙ | ︙ | |||
55 56 57 58 59 60 61 | test wm-1.1 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body { wm } -result {wrong # args: should be "wm option window ?arg ...?"} # Next test will fail every time set of subcommands is changed test wm-1.2 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body { wm foo | | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | test wm-1.1 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body { wm } -result {wrong # args: should be "wm option window ?arg ...?"} # Next test will fail every time set of subcommands is changed test wm-1.2 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body { wm foo } -result {bad option "foo": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbadge, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, touch, transient, or withdraw} test wm-1.3 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body { wm command } -result {wrong # args: should be "wm option window ?arg ...?"} test wm-1.4 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body { wm aspect bogus } -result {bad window path name "bogus"} test wm-1.5 {Tk_WmObjCmd procedure, miscellaneous errors} -body { |
︙ | ︙ | |||
124 125 126 127 128 129 130 | ### wm attributes ### test wm-attributes-1.1 {usage} -returnCodes error -body { wm attributes } -result {wrong # args: should be "wm option window ?arg ...?"} test wm-attributes-1.2.1 {usage} -constraints win -returnCodes error -body { | < < < > < < < > | | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | ### wm attributes ### test wm-attributes-1.1 {usage} -returnCodes error -body { wm attributes } -result {wrong # args: should be "wm option window ?arg ...?"} test wm-attributes-1.2.1 {usage} -constraints win -returnCodes error -body { wm attributes . _ } -result {bad attribute "_": must be -alpha, -disabled, -fullscreen, -toolwindow, -topmost, or -transparentcolor} test wm-attributes-1.2.2 {usage} -constraints win -returnCodes error -body { wm attributes . -alpha 1.0 -disabled } -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"} test wm-attributes-1.2.3 {usage} -constraints win -returnCodes error -body { wm attributes . -to } -result {bad attribute "-to": must be -alpha, -disabled, -fullscreen, -toolwindow, -topmost, or -transparentcolor} test wm-attributes-1.2.4 {usage} -constraints {unix notAqua} -returnCodes error -body { wm attributes . _ } -result {bad attribute "_": must be -alpha, -fullscreen, -topmost, -type, or -zoomed} test wm-attributes-1.2.5 {usage} -constraints aqua -returnCodes error -body { wm attributes . _ } -result {bad attribute "_": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, -transparent, or -type} ### wm client ### test wm-client-1.1 {usage} -returnCodes error -body { |
︙ | ︙ | |||
724 725 726 727 728 729 730 731 732 733 734 735 736 737 | lappend result [wm group .t] wm group .t . lappend result [wm group .t] wm group .t {} lappend result [wm group .t] } -result [list {} . {}] ### wm iconbitmap ### test wm-iconbitmap-1.1 {usage} -returnCodes error -body { wm iconbitmap } -result {wrong # args: should be "wm option window ?arg ...?"} test wm-iconbitmap-1.2.1 {usage} -constraints unix -returnCodes error -body { wm iconbitmap .t 12 13 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 | lappend result [wm group .t] wm group .t . lappend result [wm group .t] wm group .t {} lappend result [wm group .t] } -result [list {} . {}] ### wm iconbadge ### test wm-iconbadge-1.1 {usage} -body { wm iconbadge } -returnCodes error -result {wrong # args: should be "wm option window ?arg ...?"} test wm-iconbadge-1.2 {usage} -body { frame .f set ::tk::icons::base_icon(.f) icon wm iconbadge .f icon } -cleanup { destroy .f unset ::tk::icons::base_icon(.f) } -returnCodes error -result {window ".f" isn't a top-level window} test wm-iconbadge-1.3 {::tk::icons::base_icon($win) must be set on X11} -constraints { x11 } -setup { unset -nocomplain ::tk::icons::base_icon(.) } -body { wm iconbadge . ! } -returnCodes error -result {::tk::icons::base_icon(.) must be set on X11} test wm-iconbadge-1.4 {::tk::icons::base_icon($win) must be a Tk photo on X11} -constraints { x11 } -setup { catch {image delete book} } -body { set ::tk::icons::base_icon(.) book wm iconbadge . 27 } -returnCodes error -result {can't use "book" as iconphoto: not a photo image} test wm-iconbadge-1.5 {illegal badge number} -body { image create photo book -data { R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAAC wAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IM QCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc 0yv+DVSEUuFxIAOw== } set ::tk::icons::base_icon(.) book wm iconbadge . illegal } -cleanup { image delete book } -returnCodes error -result {can't use "illegal" as icon badge} test wm-iconbadge-1.6 {non-integer badge number} -body { image create photo book -data { R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAAC wAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IM QCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc 0yv+DVSEUuFxIAOw== } set ::tk::icons::base_icon(.) book wm iconbadge . 3.2 } -cleanup { image delete book } -returnCodes error -result {can't use "3.2" as icon badge} test wm-iconbadge-1.7 {negative or zero badge number} -body { image create photo book -data { R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAAC wAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IM QCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc 0yv+DVSEUuFxIAOw== } set ::tk::icons::base_icon(.) book wm iconbadge . 0 } -cleanup { image delete book } -returnCodes error -result {can't use "0" as icon badge} test wm-iconbadge-1.8 {usage, no need to call iconphoto on aqua or win32} -constraints { aquaOrWin32 } -body { wm iconbadge . 3 wm iconbadge . 5000 wm iconbadge . ! wm iconbadge . "" } -result {} ### wm iconbitmap ### test wm-iconbitmap-1.1 {usage} -returnCodes error -body { wm iconbitmap } -result {wrong # args: should be "wm option window ?arg ...?"} test wm-iconbitmap-1.2.1 {usage} -constraints unix -returnCodes error -body { wm iconbitmap .t 12 13 |
︙ | ︙ | |||
806 807 808 809 810 811 812 | frame .t.f -container 1 toplevel .t2 -use [winfo id .t.f] wm iconify .t2 } -returnCodes error -cleanup { destroy .t2 .r.f } -result {can't iconify ".t2": it is an embedded window} | | | 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 | frame .t.f -container 1 toplevel .t2 -use [winfo id .t.f] wm iconify .t2 } -returnCodes error -cleanup { destroy .t2 .r.f } -result {can't iconify ".t2": it is an embedded window} test wm-iconify-3.1 {iconify behavior} -constraints {failsOnUbuntu failsOnXQuarz} -body { toplevel .t2 wm geom .t2 -0+0 update idletasks set result [winfo ismapped .t2] wm iconify .t2 update idletasks lappend result [winfo ismapped .t2] |
︙ | ︙ | |||
880 881 882 883 884 885 886 887 888 889 890 891 892 893 | } -result {wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"} test wm-iconphoto-1.5.1 {usage} -constraints aquaOrWin32 -returnCodes error -body { wm iconphoto . -default [image create photo -file {}] } -match {glob} -result {failed to create an iconphoto with image *} test wm-iconphoto-1.5.2 {usage} -constraints x11 -body { wm iconphoto . -default [image create photo -file {}] } -result {} # All other iconphoto tests are platform specific ### wm iconposition ### test wm-iconposition-1.1 {usage} -returnCodes error -body { wm iconposition | > | 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | } -result {wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"} test wm-iconphoto-1.5.1 {usage} -constraints aquaOrWin32 -returnCodes error -body { wm iconphoto . -default [image create photo -file {}] } -match {glob} -result {failed to create an iconphoto with image *} test wm-iconphoto-1.5.2 {usage} -constraints x11 -body { wm iconphoto . -default [image create photo -file {}] } -result {} # All other iconphoto tests are platform specific ### wm iconposition ### test wm-iconposition-1.1 {usage} -returnCodes error -body { wm iconposition |
︙ | ︙ | |||
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 | } -cleanup { destroy .t } -returnCodes error -result {window ".t" isn't mapped} deleteWindows test wm-stackorder-2.1 {stacking order} -body { toplevel .t ; update wm stackorder . } -cleanup { destroy .t } -result {. .t} test wm-stackorder-2.2 {stacking order} -body { toplevel .t ; update raise . | > | 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 | } -cleanup { destroy .t } -returnCodes error -result {window ".t" isn't mapped} deleteWindows test wm-stackorder-2.1 {stacking order} -body { toplevel .t ; update raiseDelay wm stackorder . } -cleanup { destroy .t } -result {. .t} test wm-stackorder-2.2 {stacking order} -body { toplevel .t ; update raise . |
︙ | ︙ | |||
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | raiseDelay wm stackorder .parent } -cleanup { deleteWindows } -result {.parent.child2 .parent.child1 .parent} test wm-stackorder-2.6 {stacking order: non-toplevel widgets ignored} -body { toplevel .t1 button .t1.b pack .t1.b update wm stackorder . } -cleanup { destroy .t1 } -result {. .t1} test wm-stackorder-2.7 {stacking order: no children returns self} -setup { deleteWindows } -body { wm stackorder . } -result {.} deleteWindows | > | > > | 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 | raiseDelay wm stackorder .parent } -cleanup { deleteWindows } -result {.parent.child2 .parent.child1 .parent} test wm-stackorder-2.6 {stacking order: non-toplevel widgets ignored} -body { toplevel .t1 raiseDelay button .t1.b pack .t1.b update wm stackorder . } -cleanup { destroy .t1 } -result {. .t1} test wm-stackorder-2.7 {stacking order: no children returns self} -setup { deleteWindows } -body { wm stackorder . } -result {.} deleteWindows test wm-stackorder-3.1 {unmapped toplevel} -constraints {failsOnUbuntu failsOnXQuarz} -body { toplevel .t1 ; update toplevel .t2 ; update wm iconify .t1 raiseDelay wm stackorder . } -cleanup { destroy .t1 .t2 } -result {. .t2} test wm-stackorder-3.2 {unmapped toplevel} -body { toplevel .t1 ; update toplevel .t2 ; update wm withdraw .t2 raiseDelay wm stackorder . } -cleanup { destroy .t1 .t2 } -result {. .t1} test wm-stackorder-3.3 {unmapped toplevel} -body { toplevel .t1 ; update toplevel .t2 ; update |
︙ | ︙ | |||
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | destroy .t1 } -result {.t1.t2} test wm-stackorder-3.6 {unmapped toplevel} -body { toplevel .t1 ; update toplevel .t1.t2 ; update toplevel .t1.t2.t3 ; update wm withdraw .t1.t2 wm stackorder .t1 } -cleanup { destroy .t1 } -result {.t1 .t1.t2.t3} test wm-stackorder-3.7 {unmapped toplevel, mapped children returned} -body { toplevel .t1 ; update toplevel .t1.t2 ; update | > | 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 | destroy .t1 } -result {.t1.t2} test wm-stackorder-3.6 {unmapped toplevel} -body { toplevel .t1 ; update toplevel .t1.t2 ; update toplevel .t1.t2.t3 ; update wm withdraw .t1.t2 raiseDelay wm stackorder .t1 } -cleanup { destroy .t1 } -result {.t1 .t1.t2.t3} test wm-stackorder-3.7 {unmapped toplevel, mapped children returned} -body { toplevel .t1 ; update toplevel .t1.t2 ; update |
︙ | ︙ | |||
1561 1562 1563 1564 1565 1566 1567 | raiseDelay wm stackorder .t isbelow . } -cleanup { destroy .t } -result 1 test wm-stackorder-6.1 {An embedded toplevel does not appear in the \ | | > | | 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 | raiseDelay wm stackorder .t isbelow . } -cleanup { destroy .t } -result 1 test wm-stackorder-6.1 {An embedded toplevel does not appear in the \ stacking order} -body { toplevel .real -container 1 raiseDelay toplevel .embd -bg blue -use [winfo id .real] raiseDelay wm stackorder . } -cleanup { deleteWindows } -result {. .real} stdWindow |
︙ | ︙ | |||
1735 1736 1737 1738 1739 1740 1741 | wm transient .subject .top update list [wm state .subject] [winfo ismapped .subject] } -cleanup { deleteWindows } -result {withdrawn 0} test wm-transient-4.2 {already mapped transient toplevel | | | | 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 | wm transient .subject .top update list [wm state .subject] [winfo ismapped .subject] } -cleanup { deleteWindows } -result {withdrawn 0} test wm-transient-4.2 {already mapped transient toplevel is withdrawn if toplevel is iconic} -constraints {failsOnUbuntu failsOnXQuarz} -body { toplevel .top raiseDelay wm iconify .top update idletasks toplevel .subject update idletasks wm transient .subject .top update idletasks list [wm state .subject] [winfo ismapped .subject] } -cleanup { deleteWindows } -result {withdrawn 0} test wm-transient-4.3 {iconify/deiconify on the toplevel does a withdraw/deiconify on the transient} -constraints {failsOnUbuntu failsOnXQuarz} -setup { set results [list] } -body { toplevel .top toplevel .subject update idletasks wm transient .subject .top wm iconify .top |
︙ | ︙ | |||
1936 1937 1938 1939 1940 1941 1942 | # Verifies that transients stay on top of their toplevels, even if they were # made transients when those toplevels were withdrawn. toplevel .t1; wm withdraw .t1; update toplevel .t2; wm transient .t2 .t1; update lappend result [winfo ismapped .t1] [winfo ismapped .t2] wm deiconify .t1; update lappend result [winfo ismapped .t1] [winfo ismapped .t2] | | | 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 | # Verifies that transients stay on top of their toplevels, even if they were # made transients when those toplevels were withdrawn. toplevel .t1; wm withdraw .t1; update toplevel .t2; wm transient .t2 .t1; update lappend result [winfo ismapped .t1] [winfo ismapped .t2] wm deiconify .t1; update lappend result [winfo ismapped .t1] [winfo ismapped .t2] raise .t1; raiseDelay; update lappend result [lsearch -all -inline -glob [wm stackorder .] ".t?"] } -cleanup { deleteWindows } -result {0 0 1 1 {.t1 .t2}} ### wm state ### |
︙ | ︙ | |||
2002 2003 2004 2005 2006 2007 2008 | test wm-state-2.7 {state change before map} -body { toplevel .t wm iconify .t wm state .t } -cleanup { deleteWindows } -result {iconic} | | | | 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | test wm-state-2.7 {state change before map} -body { toplevel .t wm iconify .t wm state .t } -cleanup { deleteWindows } -result {iconic} test wm-state-2.8 {state change after map} -constraints {failsOnUbuntu failsOnXQuarz} -body { toplevel .t update wm state .t iconic wm state .t } -cleanup { deleteWindows } -result {iconic} test wm-state-2.9 {state change after map} -constraints {failsOnUbuntu failsOnXQuarz} -body { toplevel .t update wm iconify .t wm state .t } -cleanup { deleteWindows } -result {iconic} |
︙ | ︙ |
Changes to tests/xmfbox.test.
1 2 3 4 5 6 7 8 | # xmfbox.test -- # # This file is a Tcl script to test the file dialog that's used # when the tk_strictMotif flag is set. Because the file dialog # runs in a modal loop, the only way to test it sufficiently is # to call the internal Tcl procedures in xmfbox.tcl directly. # # Copyright © 1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # xmfbox.test -- # # This file is a Tcl script to test the file dialog that's used # when the tk_strictMotif flag is set. Because the file dialog # runs in a modal loop, the only way to test it sufficiently is # to call the internal Tcl procedures in xmfbox.tcl directly. # # Copyright © 1997 Sun Microsystems, Inc. # Copyright © 1998-1999 Scriptics Corporation. # Contributions from Don Porter, NIST, 2002. (not subject to US copyright) # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands |
︙ | ︙ | |||
87 88 89 90 91 92 93 | unix } -body { cleanup file mkdir ./~nosuchuser1 set x [tk::MotifFDialog_Create foo open {}] $::tk::dialog::file::foo(fEnt) delete 0 end $::tk::dialog::file::foo(fEnt) insert 0 [pwd]/~nosuchuser1 | | | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | unix } -body { cleanup file mkdir ./~nosuchuser1 set x [tk::MotifFDialog_Create foo open {}] $::tk::dialog::file::foo(fEnt) delete 0 end $::tk::dialog::file::foo(fEnt) insert 0 [pwd]/~nosuchuser1 file normalize [file join {*}[tk::MotifFDialog_InterpFilter $x]] } -result "$testPWD/~nosuchuser1/*" test xmfbox-2.2 {tk::MotifFDialog_InterpFilter, ~ in file names} -constraints { unix } -body { cleanup close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}] set x [tk::MotifFDialog_Create foo open {}] $::tk::dialog::file::foo(fEnt) delete 0 end $::tk::dialog::file::foo(fEnt) insert 0 [pwd]/~nosuchuser1 file normalize [file join {*}[tk::MotifFDialog_InterpFilter $x]] } -result "$testPWD/~nosuchuser1" test xmfbox-2.3 {tk::MotifFDialog_Update, ~ in file names} -constraints { unix } -body { cleanup close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}] set x [tk::MotifFDialog_Create foo open {}] |
︙ | ︙ | |||
134 135 136 137 138 139 140 | cleanup close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}] set x [tk::MotifFDialog_Create foo open {}] set i [lsearch [$::tk::dialog::file::foo(fList) get 0 end] ~nosuchuser1] $::tk::dialog::file::foo(fList) selection clear 0 end $::tk::dialog::file::foo(fList) selection set $i tk::MotifFDialog_BrowseFList $x | | | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | cleanup close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}] set x [tk::MotifFDialog_Create foo open {}] set i [lsearch [$::tk::dialog::file::foo(fList) get 0 end] ~nosuchuser1] $::tk::dialog::file::foo(fList) selection clear 0 end $::tk::dialog::file::foo(fList) selection set $i tk::MotifFDialog_BrowseFList $x file normalize [$::tk::dialog::file::foo(sEnt) get] } -result "$testPWD/~nosuchuser1" test xmfbox-2.6 {tk::MotifFDialog_ActivateFList, ~ in file names} -constraints { unix } -body { cleanup close [open ./~nosuchuser1 {CREAT TRUNC WRONLY}] set x [tk::MotifFDialog_Create foo open {}] set i [lsearch [$::tk::dialog::file::foo(fList) get 0 end] ~nosuchuser1] $::tk::dialog::file::foo(fList) selection clear 0 end $::tk::dialog::file::foo(fList) selection set $i tk::MotifFDialog_BrowseFList $x tk::MotifFDialog_ActivateFList $x list $::tk::dialog::file::foo(selectPath) \ $::tk::dialog::file::foo(selectFile) [file normalize $tk::Priv(selectFilePath)] } -result "$testPWD ~nosuchuser1 $testPWD/~nosuchuser1" # cleanup cleanup cleanupTests return # Local variables: # mode: tcl # End: |
Changes to unix/Makefile.in.
︙ | ︙ | |||
108 109 110 111 112 113 114 | # appropriate for this version of Tk: TCL_PLATFORM_DIR = $(TCLDIR)/unix # The directory containing the Tcl library archive file appropriate # for this version of Tk: TCL_BIN_DIR = @TCL_BIN_DIR@ | | | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | # appropriate for this version of Tk: TCL_PLATFORM_DIR = $(TCLDIR)/unix # The directory containing the Tcl library archive file appropriate # for this version of Tk: TCL_BIN_DIR = @TCL_BIN_DIR@ # The linker flags needed to link in the Tcl library (ex: -ltcl8.7) TCL_LIB_FLAG = @TCL_LIB_FLAG@ # Flag, 1: we're building a shared lib, 0 we're not TK_SHARED_BUILD = @TK_SHARED_BUILD@ # Subdirectory of $(libdir) containing the pkgIndex.tcl file for loadable Tk TK_PKG_DIR = @TK_PKG_DIR@ |
︙ | ︙ | |||
185 186 187 188 189 190 191 | # XStringToKeysym is plenty fast, so you needn't define REDO_KEYSYM_LOOKUP. KEYSYM_FLAGS = #KEYSYM_FLAGS = -DREDO_KEYSYM_LOOKUP # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | # XStringToKeysym is plenty fast, so you needn't define REDO_KEYSYM_LOOKUP. KEYSYM_FLAGS = #KEYSYM_FLAGS = -DREDO_KEYSYM_LOOKUP # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # Some versions of make, like SGI's, use the following variable to # determine which shell to use for executing commands: SHELL = @SHELL@ # BUILD_TCLSH is the fully qualified path name of the tclsh shell |
︙ | ︙ | |||
243 244 245 246 247 248 249 250 251 252 253 254 255 256 | # Generic stub lib name used in rules that apply to tcl and tk STUB_LIB_FILE = ${TK_STUB_LIB_FILE} TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@ #TK_STUB_LIB_FLAG = -ltkstub TK_LIB_FILE = @TK_LIB_FILE@ #TK_LIB_FILE = libtk.a # Generic lib name used in rules that apply to tcl and tk LIB_FILE = ${TK_LIB_FILE} TK_LIB_FLAG = @TK_LIB_FLAG@ #TK_LIB_FLAG = -ltk | > > | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | # Generic stub lib name used in rules that apply to tcl and tk STUB_LIB_FILE = ${TK_STUB_LIB_FILE} TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@ #TK_STUB_LIB_FLAG = -ltkstub TK_LIB_FILE = @TK_LIB_FILE@ TK_LIB_FILE_TCL8 = @TK_LIB_FILE_TCL8@ TK_LIB_FILE_TCL9 = @TK_LIB_FILE_TCL9@ #TK_LIB_FILE = libtk.a # Generic lib name used in rules that apply to tcl and tk LIB_FILE = ${TK_LIB_FILE} TK_LIB_FLAG = @TK_LIB_FLAG@ #TK_LIB_FLAG = -ltk |
︙ | ︙ | |||
281 282 283 284 285 286 287 | # Additional search flags needed to find the various shared libraries # at run-time. The first symbol is for use when creating a binary # with cc, and the second is for use when running ld directly. CC_SEARCH_FLAGS = @CC_SEARCH_FLAGS@ LD_SEARCH_FLAGS = @LD_SEARCH_FLAGS@ # support for embedded libraries on Darwin / Mac OS X | | | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | # Additional search flags needed to find the various shared libraries # at run-time. The first symbol is for use when creating a binary # with cc, and the second is for use when running ld directly. CC_SEARCH_FLAGS = @CC_SEARCH_FLAGS@ LD_SEARCH_FLAGS = @LD_SEARCH_FLAGS@ # support for embedded libraries on Darwin / Mac OS X DYLIB_INSTALL_DIR = $(libdir) # support for building the Aqua resource file TK_RSRC_FILE = @TK_RSRC_FILE@ WISH_RSRC_FILE = @WISH_RSRC_FILE@ REZ = @REZ@ REZ_SWITCHES = @REZ_FLAGS@ -i $(GENERIC_DIR) -i $(TCL_GENERIC_DIR) |
︙ | ︙ | |||
329 330 331 332 333 334 335 | CC = @CC@ CC_SWITCHES_NO_STUBS = -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} \ ${@TK_WINDOWINGSYSTEM@_INCLUDES} ${CFLAGS} ${CFLAGS_WARNING} \ ${SHLIB_CFLAGS} -I${TCL_GENERIC_DIR} -I${TCL_PLATFORM_DIR} ${AC_FLAGS} \ ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} \ | | | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | CC = @CC@ CC_SWITCHES_NO_STUBS = -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} \ ${@TK_WINDOWINGSYSTEM@_INCLUDES} ${CFLAGS} ${CFLAGS_WARNING} \ ${SHLIB_CFLAGS} -I${TCL_GENERIC_DIR} -I${TCL_PLATFORM_DIR} ${AC_FLAGS} \ ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} \ ${NO_DEPRECATED_FLAGS} -DTCL_UTF_MAX=3 @EXTRA_CC_SWITCHES@ CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) @TCL_STUB_FLAGS@ APP_CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) @EXTRA_APP_CC_SWITCHES@ DEPEND_SWITCHES = -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} \ ${@TK_WINDOWINGSYSTEM@_INCLUDES} ${CFLAGS} -I${TCL_GENERIC_DIR} \ |
︙ | ︙ | |||
385 386 387 388 389 390 391 | ttkWidget.o ttkStubInit.o STUB_OBJS = tkStubInit.o STUB_LIB_OBJS = tkStubLib.o ttkStubLib.o X11_OBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \ | | | | | | | | | < | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | ttkWidget.o ttkStubInit.o STUB_OBJS = tkStubInit.o STUB_LIB_OBJS = tkStubLib.o ttkStubLib.o X11_OBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \ tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o tkIcu.o \ tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \ tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \ tkUnixSend.o tkUnixSysNotify.o tkUnixSysTray.o tkUnixWm.o tkUnixXId.o AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \ tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \ tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \ tkMacOSXEvent.o tkMacOSXFileTypes.o tkMacOSXFont.o tkMacOSXHLEvents.o \ tkMacOSXImage.o tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \ tkMacOSXMenu.o tkMacOSXMenubutton.o tkMacOSXMenus.o \ tkMacOSXMouseEvent.o tkMacOSXNotify.o tkMacOSXPrint.o tkMacOSXRegion.o \ tkMacOSXScrlbr.o tkMacOSXSend.o tkMacOSXServices.o \ tkMacOSXSubwindows.o tkMacOSXSysTray.o tkMacOSXWindowEvent.o tkMacOSXWm.o \ tkMacOSXXStubs.o tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o \ tkUnixScale.o xcolors.o xdraw.o xgc.o ximage.o xutil.o \ ttkMacOSXTheme.o AQUA_TKTEST_OBJS = tkMacOSXTest.o OBJS = $(GENERIC_OBJS) $(WIDG_OBJS) $(CANV_OBJS) $(IMAGE_OBJS) $(TEXT_OBJS) \ $(STUB_OBJS) $(TTK_OBJS) \ $(@TK_WINDOWINGSYSTEM@_OBJS) @PLAT_OBJS@ |
︙ | ︙ | |||
503 504 505 506 507 508 509 | $(UNIX_DIR)/tkAppInit.c $(UNIX_DIR)/tkUnix.c \ $(UNIX_DIR)/tkUnix3d.c \ $(UNIX_DIR)/tkUnixButton.c $(UNIX_DIR)/tkUnixColor.c \ $(UNIX_DIR)/tkUnixConfig.c \ $(UNIX_DIR)/tkUnixCursor.c \ $(UNIX_DIR)/tkUnixDraw.c \ $(UNIX_DIR)/tkUnixEmbed.c $(UNIX_DIR)/tkUnixEvent.c \ | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > | > | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | $(UNIX_DIR)/tkAppInit.c $(UNIX_DIR)/tkUnix.c \ $(UNIX_DIR)/tkUnix3d.c \ $(UNIX_DIR)/tkUnixButton.c $(UNIX_DIR)/tkUnixColor.c \ $(UNIX_DIR)/tkUnixConfig.c \ $(UNIX_DIR)/tkUnixCursor.c \ $(UNIX_DIR)/tkUnixDraw.c \ $(UNIX_DIR)/tkUnixEmbed.c $(UNIX_DIR)/tkUnixEvent.c \ $(UNIX_DIR)/tkUnixFocus.c $(GENERIC_DIR)/tkIcu.c \ $(UNIX_DIR)/tkUnixRFont.c \ $(UNIX_DIR)/tkUnixFont.c $(UNIX_DIR)/tkUnixInit.c \ $(UNIX_DIR)/tkUnixKey.c \ $(UNIX_DIR)/tkUnixMenu.c $(UNIX_DIR)/tkUnixMenubu.c \ $(UNIX_DIR)/tkUnixScale.c $(UNIX_DIR)/tkUnixScrlbr.c \ $(UNIX_DIR)/tkUnixSelect.c $(UNIX_DIR)/tkUnixSend.c \ $(UNIX_DIR)/tkUnixSysNotify $(UNIX_DIR)/tkUnixSysTray.c \ $(UNIX_DIR)/tkUnixWm.c $(UNIX_DIR)/tkUnixXId.c AQUA_SRCS = \ $(MAC_OSX_DIR)/tkMacOSXBitmap.c $(MAC_OSX_DIR)/tkMacOSXButton.c \ $(MAC_OSX_DIR)/tkMacOSXClipboard.c $(MAC_OSX_DIR)/tkMacOSXColor.c \ $(MAC_OSX_DIR)/tkMacOSXConfig.c $(MAC_OSX_DIR)/tkMacOSXCursor.c \ $(MAC_OSX_DIR)/tkMacOSXDebug.c $(MAC_OSX_DIR)/tkMacOSXDialog.c \ $(MAC_OSX_DIR)/tkMacOSXDraw.c $(MAC_OSX_DIR)/tkMacOSXEmbed.c \ $(MAC_OSX_DIR)/tkMacOSXEntry.c $(MAC_OSX_DIR)/tkMacOSXEvent.c \ $(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXFileTypes.c\ $(MAC_OSX_DIR)/tkMacOSXHLEvents.c $(MAC_OSX_DIR)/tkMacOSXImage.c \ $(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \ $(MAC_OSX_DIR)/tkMacOSXKeyEvent.c \ $(MAC_OSX_DIR)/tkMacOSXMenu.c \ $(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \ $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(MAC_OSX_DIR)/tkMacOSXNotify.c \ $(MAC_OSX_DIR)/tkMacOSXRegion.c $(MAC_OSX_DIR)/tkMacOSXScrlbr.c \ $(MAC_OSX_DIR)/tkMacOSXServices.c $(MAC_OSX_DIR)/tkMacOSXSysTray.c \ $(MAC_OSX_DIR)/tkMacOSXSend.c $(MAC_OSX_DIR)/tkMacOSXSubwindows.c \ $(MAC_OSX_DIR)/tkMacOSXTest.c $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c \ $(MAC_OSX_DIR)/tkMacOSXWm.c $(MAC_OSX_DIR)/tkMacOSXXStubs.c \ $(GENERIC_DIR)/tkFileFilter.c $(GENERIC_DIR)/tkMacWinMenu.c \ $(GENERIC_DIR)/tkPointer.c $(UNIX_DIR)/tkUnix3d.c \ $(UNIX_DIR)/tkUnixScale.c $(XLIB_DIR)/xcolors.c $(XLIB_DIR)/xdraw.c \ $(XLIB_DIR)/xgc.c $(XLIB_DIR)/ximage.c $(XLIB_DIR)/xutil.c \ $(TTK_DIR)/ttkMacOSXTheme.c SRCS = $(GENERIC_SRCS) $(@TK_WINDOWINGSYSTEM@_SRCS) @PLAT_SRCS@ ### # Tip 430 - ZipFS Modifications ### TK_ZIP_FILE = @TK_ZIP_FILE@ TK_VFS_ROOT = libtk.vfs TK_VFS_PATH = ${TK_VFS_ROOT}/tk_library HOST_CC = @CC_FOR_BUILD@ HOST_EXEEXT = @EXEEXT_FOR_BUILD@ HOST_OBJEXT = @OBJEXT_FOR_BUILD@ ZIPFS_BUILD = @ZIPFS_BUILD@ NATIVE_ZIP = @ZIP_PROG@ ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@ ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@ SHARED_BUILD = @SHARED_BUILD@ INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ INSTALL_MSGS = @INSTALL_MSGS@ ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@ AQUA_RESOURCES = \ $(MAC_OSX_DIR)/tkAboutDlg.r $(MAC_OSX_DIR)/tkMacOSXCursors.r \ $(MAC_OSX_DIR)/tkMacOSXXCursors.r AQUA_WISH_RESOURCES = $(MAC_OSX_DIR)/tkMacOSXAETE.r AQUA_HDRS = $(MAC_OSX_DIR)/tkMacOSX.h $(GENERIC_DIR)/tkIntXlibDecls.h AQUA_XLIB_HDRS = $(XLIB_DIR)/X11/*.h $(XLIB_DIR)/xbytes.h AQUA_PRIVATE_HDRS = $(MAC_OSX_DIR)/tkMacOSXPort.h $(MAC_OSX_DIR)/tkMacOSXInt.h X11_PRIVATE_HDRS = $(UNIX_DIR)/tkUnixPort.h $(UNIX_DIR)/tkUnixInt.h $(GENERIC_DIR)/tkIntXlibDecls.h \ $(UNIX_DIR)/tkUnixDefault.h # Currently private, eventually public TTK_HDRS = $(TTK_DIR)/ttkTheme.h $(TTK_DIR)/ttkDecls.h PUBLIC_HDRS = $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkDecls.h \ $(GENERIC_DIR)/tkPlatDecls.h $(@TK_WINDOWINGSYSTEM@_HDRS) |
︙ | ︙ | |||
579 580 581 582 583 584 585 586 587 | all: binaries libraries binaries: ${LIB_FILE} ${WISH_EXE} libraries: # The following target is configured by autoconf to generate either # a shared library or non-shared library for Tk. | > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | all: binaries libraries binaries: ${LIB_FILE} ${WISH_EXE} libraries: tkzipfile: ${TK_ZIP_FILE} ${TK_ZIP_FILE}: ${ZIP_INSTALL_OBJS} @rm -rf ${TK_VFS_ROOT} @mkdir -p ${TK_VFS_PATH} @echo "creating ${TK_VFS_PATH} (prepare compression)" @if \ ln -s $(TOP_DIR)/library/* ${TK_VFS_PATH}/; \ then : ; else \ cp -a $(TOP_DIR)/library/* ${TK_VFS_PATH}; \ fi rm -rf ${TK_VFS_PATH}/demos @find ${TK_VFS_ROOT} -type d -empty -delete @echo "creating ${TK_ZIP_FILE} from ${TK_VFS_PATH}" -@if test "${ZIPFS_BUILD}" = "2" ; then \ cp ${TCL_BIN_DIR}/tclsh ${TK_VFS_ROOT}/../${TK_ZIP_FILE} || cp ${TCL_BIN_DIR}/../bin/tclsh${TCLVERSION} ${TK_VFS_ROOT}/../${TK_ZIP_FILE}; \ (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \ (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \ cd ${TK_VFS_ROOT} && $$zip -J ../${TK_ZIP_FILE}) \ fi @(zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}' || \ echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?") 2>/dev/null`; \ echo 'cd ${TK_VFS_ROOT} &&' $$zip '${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH}'; \ cd ${TK_VFS_ROOT} && \ $$zip ${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} >/dev/null) # The following target is configured by autoconf to generate either # a shared library or non-shared library for Tk. ${LIB_FILE}: ${STUB_LIB_FILE} @LIB_RSRC_FILE@ ${OBJS} ${TK_ZIP_FILE} rm -f $@ @MAKE_LIB@ @if test "${ZIPFS_BUILD}" = "1" ; then \ if test "x$(MACHER)" = "x" ; then \ cat ${TK_ZIP_FILE} >> ${LIB_FILE}; \ else $(MACHER) append ${LIB_FILE} ${TK_ZIP_FILE} /tmp/macher_output; \ mv /tmp/macher_output ${LIB_FILE}; chmod u+x ${LIB_FILE}; \ fi; \ ${NATIVE_ZIP} -A ${LIB_FILE} \ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \ fi ${STUB_LIB_FILE}: ${STUB_LIB_OBJS} @if test "x${LIB_FILE}" = "xlibtk${MAJOR_VERSION}.${MINOR_VERSION}.dll"; then \ (cd ${TOP_DIR}/win; ${MAKE} tk${MAJOR_VERSION}${MINOR_VERSION}.dll); \ cp "${TOP_DIR}/win/tk${MAJOR_VERSION}${MINOR_VERSION}.dll" .; \ fi rm -f $@ |
︙ | ︙ | |||
617 618 619 620 621 622 623 624 625 626 627 628 629 630 | # case objs: ${OBJS} ${WISH_EXE}: $(TK_STUB_LIB_FILE) $(WISH_OBJS) $(TK_LIB_FILE) @APP_RSRC_FILE@ ${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \ $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o ${WISH_EXE} # Resetting the LIB_RUNTIME_DIR below is required so that # the generated tktest executable gets the build directory # burned into its ld search path. This keeps tktest from # picking up an already installed version of the Tcl or # Tk shared libraries. | > > > > > > > > > | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | # case objs: ${OBJS} ${WISH_EXE}: $(TK_STUB_LIB_FILE) $(WISH_OBJS) $(TK_LIB_FILE) @APP_RSRC_FILE@ ${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \ $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o ${WISH_EXE} @if test "${ZIPFS_BUILD}" = "2" ; then \ if test "x$(MACHER)" = "x" ; then \ cat ${TK_ZIP_FILE} >> ${WISH_EXE}; \ else $(MACHER) append ${WISH_EXE} ${TK_ZIP_FILE} /tmp/macher_output; \ mv /tmp/macher_output ${LIB_FILE}; chmod u+x ${LIB_FILE}; \ fi; \ ${NATIVE_ZIP} -A ${WISH_EXE} \ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \ fi # Resetting the LIB_RUNTIME_DIR below is required so that # the generated tktest executable gets the build directory # burned into its ld search path. This keeps tktest from # picking up an already installed version of the Tcl or # Tk shared libraries. |
︙ | ︙ | |||
694 695 696 697 698 699 700 | valgrind: $(TKTEST_EXE) $(SHELL_ENV) valgrind $(VALGRINDARGS) ./$(TKTEST_EXE) $(TEST_DIR)/all.tcl -geometry +0+0 -singleproc 1 $(TESTFLAGS) valgrindshell: $(TKTEST_EXE) $(SHELL_ENV) valgrind $(VALGRINDARGS) ./$(TKTEST_EXE) $(SCRIPT) | | | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | valgrind: $(TKTEST_EXE) $(SHELL_ENV) valgrind $(VALGRINDARGS) ./$(TKTEST_EXE) $(TEST_DIR)/all.tcl -geometry +0+0 -singleproc 1 $(TESTFLAGS) valgrindshell: $(TKTEST_EXE) $(SHELL_ENV) valgrind $(VALGRINDARGS) ./$(TKTEST_EXE) $(SCRIPT) INSTALL_BASE_TARGETS = install-binaries ${INSTALL_LIBRARIES} INSTALL_DOC_TARGETS = install-doc INSTALL_DEV_TARGETS = install-headers INSTALL_DEMO_TARGETS = install-demos INSTALL_EXTRA_TARGETS = @EXTRA_INSTALL@ INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) $(INSTALL_DEV_TARGETS) \ $(INSTALL_DEMO_TARGETS) $(INSTALL_EXTRA_TARGETS) |
︙ | ︙ | |||
723 724 725 726 727 728 729 | else true; \ fi; \ done; @if test "x$(TK_SHARED_BUILD)" = "x1"; then \ echo "Creating package index $(PKG_INDEX)"; \ rm -f "$(PKG_INDEX)"; \ (\ | | > | > > > > | > > > > > > | > | > | | | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | else true; \ fi; \ done; @if test "x$(TK_SHARED_BUILD)" = "x1"; then \ echo "Creating package index $(PKG_INDEX)"; \ rm -f "$(PKG_INDEX)"; \ (\ echo "if {![package vsatisfies [package provide Tcl] 8.6-]} return";\ relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\ if test "x$(DLL_INSTALL_DIR)" != "x$(BIN_INSTALL_DIR)"; then \ echo "if {[package vsatisfies [package provide Tcl] 9.0]} {";\ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE_TCL9)]]]";\ echo "} else {";\ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE_TCL8)]]]";\ echo "}";\ else \ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE_TCL9)]]]";\ echo " } else {";\ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE_TCL8)]]]";\ echo " }";\ echo "} else {";\ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin tcl9tk${MAJOR_VERSION}${MINOR_VERSION}.dll]]]";\ echo " } else {";\ echo " package ifneeded tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll]]]";\ echo " }";\ echo "}";\ fi; \ echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list package require -exact tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL)]"\ ) > "$(PKG_INDEX)"; \ fi @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/" @@INSTALL_LIB@ @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @if test -f "tk${MAJOR_VERSION}${MINOR_VERSION}.dll"; then \ $(INSTALL_LIBRARY) "tk${MAJOR_VERSION}${MINOR_VERSION}.dll" "$(DLL_INSTALL_DIR)";\ chmod 555 "$(DLL_INSTALL_DIR)/tk${MAJOR_VERSION}${MINOR_VERSION}.dll";\ $(INSTALL_LIBRARY) "../win/libtk${MAJOR_VERSION}${MINOR_VERSION}.dll.a" "$(LIB_INSTALL_DIR)";\ chmod 555 "$(LIB_INSTALL_DIR)/libtk${MAJOR_VERSION}${MINOR_VERSION}.dll.a";\ fi @echo "Installing ${WISH_EXE} as $(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${WISH_EXE} "$(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}" @echo "Installing tkConfig.sh to $(CONFIG_INSTALL_DIR)/" @$(INSTALL_DATA) tkConfig.sh "$(CONFIG_INSTALL_DIR)/tkConfig.sh" @if test "$(STUB_LIB_FILE)" != "" ; then \ echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ |
︙ | ︙ | |||
898 899 900 901 902 903 904 905 | Makefile: $(UNIX_DIR)/Makefile.in $(SHELL) config.status #tkConfig.h: $(UNIX_DIR)/tkConfig.h.in # $(SHELL) config.status clean: rm -f *.a *.o libtk* core errs *~ \#* TAGS *.E a.out \ | > | > | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 | Makefile: $(UNIX_DIR)/Makefile.in $(SHELL) config.status #tkConfig.h: $(UNIX_DIR)/tkConfig.h.in # $(SHELL) config.status clean: rm -rf *.vfs rm -f *.a *.o libtk* core errs *~ \#* TAGS *.E a.out \ errors ${WISH_EXE} $(TKTEST_EXE) lib.exp Tk *.rsrc \ *.zip distclean: clean rm -rf Makefile config.status config.cache config.log tkConfig.sh \ tkConfig.h *.plist Tk.framework tk.pc depend: makedepend -- $(DEPEND_SWITCHES) -- $(SRCS) |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | -DCFG_INSTALL_DEMODIR="\"$(DEMO_INSTALL_DIR)\"" \ \ -DCFG_RUNTIME_LIBDIR="\"$(libdir)\"" \ -DCFG_RUNTIME_BINDIR="\"$(bindir)\"" \ -DCFG_RUNTIME_SCRDIR="\"$(TK_LIBRARY)\"" \ -DCFG_RUNTIME_INCDIR="\"$(includedir)\"" \ -DCFG_RUNTIME_DOCDIR="\"$(mandir)\"" \ -DCFG_RUNTIME_DEMODIR="\"$(DEMO_INSTALL_DIR)\"" \ \ $(GENERIC_DIR)/tkPkgConfig.c tkPlace.o: $(GENERIC_DIR)/tkPlace.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkPlace.c tkSelect.o: $(GENERIC_DIR)/tkSelect.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkSelect.c tkStyle.o: $(GENERIC_DIR)/tkStyle.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStyle.c tkUtil.o: $(GENERIC_DIR)/tkUtil.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkUtil.c tkVisual.o: $(GENERIC_DIR)/tkVisual.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkVisual.c | > | | | 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 | -DCFG_INSTALL_DEMODIR="\"$(DEMO_INSTALL_DIR)\"" \ \ -DCFG_RUNTIME_LIBDIR="\"$(libdir)\"" \ -DCFG_RUNTIME_BINDIR="\"$(bindir)\"" \ -DCFG_RUNTIME_SCRDIR="\"$(TK_LIBRARY)\"" \ -DCFG_RUNTIME_INCDIR="\"$(includedir)\"" \ -DCFG_RUNTIME_DOCDIR="\"$(mandir)\"" \ -DCFG_RUNTIME_DLLFILE="\"$(TK_LIB_FILE)\"" \ -DCFG_RUNTIME_DEMODIR="\"$(DEMO_INSTALL_DIR)\"" \ \ $(GENERIC_DIR)/tkPkgConfig.c tkPlace.o: $(GENERIC_DIR)/tkPlace.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkPlace.c tkSelect.o: $(GENERIC_DIR)/tkSelect.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkSelect.c tkStyle.o: $(GENERIC_DIR)/tkStyle.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStyle.c tkUtil.o: $(GENERIC_DIR)/tkUtil.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkUtil.c tkVisual.o: $(GENERIC_DIR)/tkVisual.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkVisual.c tkWindow.o: $(GENERIC_DIR)/tkWindow.c tkUuid.h $(CC) -c $(CC_SWITCHES) -I. $(GENERIC_DIR)/tkWindow.c tkButton.o: $(GENERIC_DIR)/tkButton.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkButton.c tkEntry.o: $(GENERIC_DIR)/tkEntry.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkEntry.c |
︙ | ︙ | |||
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 | tkRectOval.o: $(GENERIC_DIR)/tkRectOval.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkRectOval.c tkTrig.o: $(GENERIC_DIR)/tkTrig.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkTrig.c tkImage.o: $(GENERIC_DIR)/tkImage.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImage.c tkImgBmap.o: $(GENERIC_DIR)/tkImgBmap.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgBmap.c tkImgListFormat.o: $(GENERIC_DIR)/tkImgListFormat.c | > > > | 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 | tkRectOval.o: $(GENERIC_DIR)/tkRectOval.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkRectOval.c tkTrig.o: $(GENERIC_DIR)/tkTrig.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkTrig.c tkIcu.o: $(GENERIC_DIR)/tkIcu.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkIcu.c tkImage.o: $(GENERIC_DIR)/tkImage.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImage.c tkImgBmap.o: $(GENERIC_DIR)/tkImgBmap.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgBmap.c tkImgListFormat.o: $(GENERIC_DIR)/tkImgListFormat.c |
︙ | ︙ | |||
1155 1156 1157 1158 1159 1160 1161 | tkImgPhInstance.o: $(GENERIC_DIR)/tkImgPhInstance.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhInstance.c tkOldTest.o: $(GENERIC_DIR)/tkOldTest.c $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkOldTest.c | | | 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | tkImgPhInstance.o: $(GENERIC_DIR)/tkImgPhInstance.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhInstance.c tkOldTest.o: $(GENERIC_DIR)/tkOldTest.c $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkOldTest.c tkTest.o: $(GENERIC_DIR)/tkTest.c tkUuid.h $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkTest.c tkText.o: $(GENERIC_DIR)/tkText.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkText.c tkTextBTree.o: $(GENERIC_DIR)/tkTextBTree.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkTextBTree.c |
︙ | ︙ | |||
1189 1190 1191 1192 1193 1194 1195 | tkStubInit.o: $(GENERIC_DIR)/tkStubInit.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubInit.c # Stub library binaries, these must be compiled for use in a shared library # even though they will be placed in a static archive tkStubLib.o: $(GENERIC_DIR)/tkStubLib.c | | | 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 | tkStubInit.o: $(GENERIC_DIR)/tkStubInit.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubInit.c # Stub library binaries, these must be compiled for use in a shared library # even though they will be placed in a static archive tkStubLib.o: $(GENERIC_DIR)/tkStubLib.c $(CC) -c $(CC_SWITCHES) @CFLAGS_NOLTO@ $(GENERIC_DIR)/tkStubLib.c tkUndo.o: $(GENERIC_DIR)/tkUndo.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkUndo.c tkUnix.o: $(UNIX_DIR)/tkUnix.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnix.c |
︙ | ︙ | |||
1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 | tkUnixSelect.o: $(UNIX_DIR)/tkUnixSelect.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSelect.c tkUnixSend.o: $(UNIX_DIR)/tkUnixSend.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSend.c tkUnixWm.o: $(UNIX_DIR)/tkUnixWm.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixWm.c tkUnixXId.o: $(UNIX_DIR)/tkUnixXId.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixXId.c tkMacOSXBitmap.o: $(MAC_OSX_DIR)/tkMacOSXBitmap.c | > > > > > > | 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 | tkUnixSelect.o: $(UNIX_DIR)/tkUnixSelect.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSelect.c tkUnixSend.o: $(UNIX_DIR)/tkUnixSend.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSend.c tkUnixSysNotify.o: $(UNIX_DIR)/tkUnixSysNotify.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSysNotify.c tkUnixSysTray.o: $(UNIX_DIR)/tkUnixSysTray.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixSysTray.c tkUnixWm.o: $(UNIX_DIR)/tkUnixWm.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixWm.c tkUnixXId.o: $(UNIX_DIR)/tkUnixXId.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixXId.c tkMacOSXBitmap.o: $(MAC_OSX_DIR)/tkMacOSXBitmap.c |
︙ | ︙ | |||
1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 | tkMacOSXEntry.o: $(MAC_OSX_DIR)/tkMacOSXEntry.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXEntry.c tkMacOSXEvent.o: $(MAC_OSX_DIR)/tkMacOSXEvent.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXEvent.c tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXFont.c tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c tkMacOSXImage.o: $(MAC_OSX_DIR)/tkMacOSXImage.c | > > > | 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 | tkMacOSXEntry.o: $(MAC_OSX_DIR)/tkMacOSXEntry.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXEntry.c tkMacOSXEvent.o: $(MAC_OSX_DIR)/tkMacOSXEvent.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXEvent.c tkMacOSXFileTypes.o: $(MAC_OSX_DIR)/tkMacOSXFileTypes.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXFileTypes.c tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXFont.c tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c tkMacOSXImage.o: $(MAC_OSX_DIR)/tkMacOSXImage.c |
︙ | ︙ | |||
1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | tkMacOSXMouseEvent.o: $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c tkMacOSXNotify.o: $(MAC_OSX_DIR)/tkMacOSXNotify.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXNotify.c tkMacOSXRegion.o: $(MAC_OSX_DIR)/tkMacOSXRegion.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXRegion.c tkMacOSXScale.o: $(MAC_OSX_DIR)/tkMacOSXScale.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXScale.c tkMacOSXScrlbr.o: $(MAC_OSX_DIR)/tkMacOSXScrlbr.c | > > > | 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 | tkMacOSXMouseEvent.o: $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c tkMacOSXNotify.o: $(MAC_OSX_DIR)/tkMacOSXNotify.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXNotify.c tkMacOSXPrint.o: $(MAC_OSX_DIR)/tkMacOSXPrint.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXPrint.c tkMacOSXRegion.o: $(MAC_OSX_DIR)/tkMacOSXRegion.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXRegion.c tkMacOSXScale.o: $(MAC_OSX_DIR)/tkMacOSXScale.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXScale.c tkMacOSXScrlbr.o: $(MAC_OSX_DIR)/tkMacOSXScrlbr.c |
︙ | ︙ | |||
1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | tkMacOSXWm.o: $(MAC_OSX_DIR)/tkMacOSXWm.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXWm.c tkMacOSXXStubs.o: $(MAC_OSX_DIR)/tkMacOSXXStubs.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXXStubs.c tkFileFilter.o: $(GENERIC_DIR)/tkFileFilter.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkFileFilter.c tkMacWinMenu.o: $(GENERIC_DIR)/tkMacWinMenu.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkMacWinMenu.c tkPointer.o: $(GENERIC_DIR)/tkPointer.c | > > > | 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 | tkMacOSXWm.o: $(MAC_OSX_DIR)/tkMacOSXWm.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXWm.c tkMacOSXXStubs.o: $(MAC_OSX_DIR)/tkMacOSXXStubs.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXXStubs.c tkMacOSXSysTray.o: $(MAC_OSX_DIR)/tkMacOSXSysTray.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSysTray.c tkFileFilter.o: $(GENERIC_DIR)/tkFileFilter.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkFileFilter.c tkMacWinMenu.o: $(GENERIC_DIR)/tkMacWinMenu.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkMacWinMenu.c tkPointer.o: $(GENERIC_DIR)/tkPointer.c |
︙ | ︙ | |||
1459 1460 1461 1462 1463 1464 1465 | ttkState.o: $(TTK_DIR)/ttkState.c $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkState.c ttkStubInit.o: $(TTK_DIR)/ttkStubInit.c $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkStubInit.c ttkStubLib.o: $(TTK_DIR)/ttkStubLib.c | | | 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 | ttkState.o: $(TTK_DIR)/ttkState.c $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkState.c ttkStubInit.o: $(TTK_DIR)/ttkStubInit.c $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkStubInit.c ttkStubLib.o: $(TTK_DIR)/ttkStubLib.c $(CC) -c $(CC_SWITCHES) @CFLAGS_NOLTO@ $(TTK_DIR)/ttkStubLib.c ttkTagSet.o: $(TTK_DIR)/ttkTagSet.c $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTagSet.c ttkTheme.o: $(TTK_DIR)/ttkTheme.c $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTheme.c |
︙ | ︙ | |||
1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 | $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTreeview.c ttkWidget.o: $(TTK_DIR)/ttkWidget.c $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkWidget.c ttkMacOSXTheme.o: $(MAC_OSX_DIR)/ttkMacOSXTheme.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/ttkMacOSXTheme.c .c.o: $(CC) -c $(CC_SWITCHES) $< # # Target to regenerate header files and stub files from the *.decls tables. # | > > > > > | 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 | $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTreeview.c ttkWidget.o: $(TTK_DIR)/ttkWidget.c $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkWidget.c ttkMacOSXTheme.o: $(MAC_OSX_DIR)/ttkMacOSXTheme.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/ttkMacOSXTheme.c tkUuid.h: $(TOP_DIR)/manifest.uuid echo "#define TK_VERSION_UUID \\" >$@ cat $(TOP_DIR)/manifest.uuid >>$@ echo "" >>$@ .c.o: $(CC) -c $(CC_SWITCHES) $< # # Target to regenerate header files and stub files from the *.decls tables. # |
︙ | ︙ | |||
1577 1578 1579 1580 1581 1582 1583 | cd $(UNIX_DIR); autoconf $(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure cd $(MAC_OSX_DIR); autoconf $(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure cd $(MAC_OSX_DIR); autoheader; touch $@ $(TOP_DIR)/manifest.uuid: | | | | | 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 | cd $(UNIX_DIR); autoconf $(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure cd $(MAC_OSX_DIR); autoconf $(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure cd $(MAC_OSX_DIR); autoheader; touch $@ $(TOP_DIR)/manifest.uuid: printf "git-" >$(TOP_DIR)/manifest.uuid (cd $(TOP_DIR); git rev-parse HEAD >>$(TOP_DIR)/manifest.uuid || printf "unknown" >$(TOP_DIR)/manifest.uuid) dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure $(TOP_DIR)/doc/man.macros $(TOP_DIR)/manifest.uuid rm -rf $(DISTDIR) $(INSTALL_DATA_DIR) $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(TOP_DIR)/manifest.uuid $(DISTDIR) $(DIST_INSTALL_DATA) $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tk.spec \ $(UNIX_DIR)/aclocal.m4 $(UNIX_DIR)/tcl.m4 \ |
︙ | ︙ | |||
1611 1612 1613 1614 1615 1616 1617 | $(TOP_DIR)/ChangeLog.2??? $(TOP_DIR)/README.md \ $(TOP_DIR)/license.terms $(DISTDIR) rm -f $(DISTDIR)/generic/blt*.[ch] $(INSTALL_DATA_DIR) $(DISTDIR)/generic/ttk $(DIST_INSTALL_DATA) $(TTK_DIR)/*.[ch] $(TTK_DIR)/ttk.decls \ $(DISTDIR)/generic/ttk $(INSTALL_DATA_DIR) $(DISTDIR)/win | | < > > > < < < < < < < < < | 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 | $(TOP_DIR)/ChangeLog.2??? $(TOP_DIR)/README.md \ $(TOP_DIR)/license.terms $(DISTDIR) rm -f $(DISTDIR)/generic/blt*.[ch] $(INSTALL_DATA_DIR) $(DISTDIR)/generic/ttk $(DIST_INSTALL_DATA) $(TTK_DIR)/*.[ch] $(TTK_DIR)/ttk.decls \ $(DISTDIR)/generic/ttk $(INSTALL_DATA_DIR) $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.in $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/win/configure.ac \ $(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \ $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat \ $(TOP_DIR)/win/*.vc $(TOP_DIR)/win/README \ $(TOP_DIR)/license.terms \ $(DISTDIR)/win $(DIST_INSTALL_SCRIPT) $(TOP_DIR)/win/configure $(DISTDIR)/win $(INSTALL_DATA_DIR) $(DISTDIR)/win/rc $(DIST_INSTALL_DATA) $(TOP_DIR)/win/rc/*.{rc,cur,ico,bmp} $(DISTDIR)/win/rc $(INSTALL_DATA_DIR) $(DISTDIR)/macosx $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \ $(MAC_OSX_DIR)/*.icns $(MAC_OSX_DIR)/*.tiff \ $(MAC_OSX_DIR)/*.[ch] $(MAC_OSX_DIR)/*.in \ $(MAC_OSX_DIR)/*.ac $(MAC_OSX_DIR)/*.xcconfig \ $(MAC_OSX_DIR)/*.sdef \ $(DISTDIR)/macosx $(DIST_INSTALL_SCRIPT) $(MAC_OSX_DIR)/configure $(DISTDIR)/macosx $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/macosx $(INSTALL_DATA_DIR) $(DISTDIR)/macosx/Tk.xcodeproj $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/Tk.xcodeproj/project.pbxproj \ $(MAC_OSX_DIR)/Tk.xcodeproj/default.pbxuser \ $(DISTDIR)/macosx/Tk.xcodeproj $(INSTALL_DATA_DIR) $(DISTDIR)/compat $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/compat/stdint.h \ $(TOP_DIR)/compat/stdbool.h $(DISTDIR)/compat |
︙ | ︙ | |||
1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 | $(TOP_DIR)/doc/man.macros $(DISTDIR)/doc $(INSTALL_DATA_DIR) $(DISTDIR)/tests $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \ $(TEST_DIR)/README $(TEST_DIR)/*.{gif,png,ppm,xbm} \ $(TEST_DIR)/option.file* $(DISTDIR)/tests $(INSTALL_DATA_DIR) $(DISTDIR)/tests/ttk $(DIST_INSTALL_DATA) $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk alldist: dist rm -f $(DISTROOT)/$(DISTNAME)-src.tar.gz $(DISTROOT)/$(ZIPNAME) cd $(DISTROOT); tar cf $(DISTNAME)-src.tar $(DISTNAME); \ gzip -9 $(DISTNAME)-src.tar; zip -qr8 $(ZIPNAME) $(DISTNAME) # | > > > | 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 | $(TOP_DIR)/doc/man.macros $(DISTDIR)/doc $(INSTALL_DATA_DIR) $(DISTDIR)/tests $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \ $(TEST_DIR)/README $(TEST_DIR)/*.{gif,png,ppm,xbm} \ $(TEST_DIR)/option.file* $(DISTDIR)/tests $(INSTALL_DATA_DIR) $(DISTDIR)/tests/ttk $(DIST_INSTALL_DATA) $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk cp -p $(TOP_DIR)/.travis.yml $(DISTDIR) mkdir -p $(DISTDIR)/.github/workflows cp -p $(TOP_DIR)/.github/workflows/*.yml $(DISTDIR)/.github/workflows alldist: dist rm -f $(DISTROOT)/$(DISTNAME)-src.tar.gz $(DISTROOT)/$(ZIPNAME) cd $(DISTROOT); tar cf $(DISTNAME)-src.tar $(DISTNAME); \ gzip -9 $(DISTNAME)-src.tar; zip -qr8 $(ZIPNAME) $(DISTNAME) # |
︙ | ︙ |
Changes to unix/configure.
1 2 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. | | | > > | > | > > > > > > > > < < < < < < < < | | < | | < < < < < < | < < < < < < < | > > | < < > | | > > > > > > > > > | > > > > | < < < < < < < > | > > > | | < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for tk 8.7. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also |
︙ | ︙ | |||
148 149 150 151 152 153 154 | *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. | | | | > > | | > | > > | > | | > | > | > > > | | > | > > > > > > | | > | < > | > | | > | | | | | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell [email protected] about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi |
︙ | ︙ | |||
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( | > > > > > > > > > | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q |
︙ | ︙ | |||
366 367 368 369 370 371 372 | } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. | | > | | > | > > > > > > > > | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else |
︙ | ︙ | |||
435 436 437 438 439 440 441 | as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || | | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q |
︙ | ︙ | |||
479 480 481 482 483 484 485 | N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || | | > > > > > > > > > > > | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null |
︙ | ︙ | |||
580 581 582 583 584 585 586 | PACKAGE_VERSION='8.7' PACKAGE_STRING='tk 8.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ | | | | | < < < < < < < < < < < < < < > > > > > > > > > > | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | PACKAGE_VERSION='8.7' PACKAGE_STRING='tk 8.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include <stddef.h> #ifdef HAVE_STDIO_H # include <stdio.h> #endif #ifdef HAVE_STDLIB_H # include <stdlib.h> #endif #ifdef HAVE_STRING_H # include <string.h> #endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #ifdef HAVE_STDINT_H # include <stdint.h> #endif #ifdef HAVE_STRINGS_H # include <strings.h> #endif #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif" ac_header_c_list= ac_subst_vars='LTLIBOBJS REZ_FLAGS REZ APP_RSRC_FILE LIB_RSRC_FILE WISH_RSRC_FILE TK_RSRC_FILE |
︙ | ︙ | |||
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | TK_INCLUDE_SPEC TK_STUB_LIB_PATH TK_STUB_LIB_SPEC TK_STUB_LIB_FLAG TK_STUB_LIB_FILE TK_LIB_SPEC TK_LIB_FLAG TK_LIB_FILE TK_YEAR TK_PATCH_LEVEL TK_MINOR_VERSION TK_MAJOR_VERSION TK_VERSION TK_DEMO_DIR DEMO_DIR UNIX_FONT_OBJS XFT_LIBS XFT_CFLAGS XMKMF LDFLAGS_DEFAULT CFLAGS_DEFAULT INSTALL_STUB_LIB DLL_INSTALL_DIR INSTALL_LIB MAKE_STUB_LIB MAKE_LIB SHLIB_SUFFIX SHLIB_CFLAGS SHLIB_LD_LIBS TK_SHLIB_LD_EXTRAS TCL_SHLIB_LD_EXTRAS SHLIB_LD STLIB_LD LD_SEARCH_FLAGS CC_SEARCH_FLAGS LDFLAGS_OPTIMIZE LDFLAGS_DEBUG CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG LDAIX_SRC PLAT_SRCS PLAT_OBJS DL_OBJS DL_LIBS TCL_LIBS | > > > > > > > > > > > > > > > > > < < < | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | TK_INCLUDE_SPEC TK_STUB_LIB_PATH TK_STUB_LIB_SPEC TK_STUB_LIB_FLAG TK_STUB_LIB_FILE TK_LIB_SPEC TK_LIB_FLAG TK_LIB_FILE_TCL9 TK_LIB_FILE_TCL8 TK_LIB_FILE TK_YEAR TK_PATCH_LEVEL TK_MINOR_VERSION TK_MAJOR_VERSION TK_VERSION TK_DEMO_DIR DEMO_DIR INSTALL_MSGS INSTALL_LIBRARIES TK_ZIP_FILE ZIPFS_BUILD ZIP_INSTALL_OBJS ZIP_PROG_VFSSEARCH ZIP_PROG_OPTIONS ZIP_PROG MACHER_PROG EXEEXT_FOR_BUILD CC_FOR_BUILD UNIX_FONT_OBJS XFT_LIBS XFT_CFLAGS XMKMF EGREP GREP CPP LDFLAGS_DEFAULT CFLAGS_DEFAULT INSTALL_STUB_LIB DLL_INSTALL_DIR INSTALL_LIB MAKE_STUB_LIB MAKE_LIB SHLIB_SUFFIX SHLIB_CFLAGS SHLIB_LD_LIBS TK_SHLIB_LD_EXTRAS TCL_SHLIB_LD_EXTRAS SHLIB_LD STLIB_LD LD_SEARCH_FLAGS CC_SEARCH_FLAGS LDFLAGS_OPTIMIZE LDFLAGS_DEBUG CFLAGS_NOLTO CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG LDAIX_SRC PLAT_SRCS PLAT_OBJS DL_OBJS DL_LIBS TCL_LIBS LIBOBJS AR RANLIB SHARED_BUILD OBJEXT EXEEXT ac_ct_CC |
︙ | ︙ | |||
736 737 738 739 740 741 742 743 744 745 746 747 748 749 | pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir | > | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir |
︙ | ︙ | |||
776 777 778 779 780 781 782 783 784 785 786 787 788 789 | enable_load enable_symbols enable_aqua with_x enable_xft enable_xss enable_framework ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS | > | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | enable_load enable_symbols enable_aqua with_x enable_xft enable_xss enable_framework enable_zipfs ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS |
︙ | ︙ | |||
825 826 827 828 829 830 831 832 833 834 835 836 837 838 | sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' | > | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' |
︙ | ︙ | |||
854 855 856 857 858 859 860 | case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac | < < | 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) |
︙ | ︙ | |||
896 897 898 899 900 901 902 | | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | | | | 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 | | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac |
︙ | ︙ | |||
922 923 924 925 926 927 928 | -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | | | | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac |
︙ | ︙ | |||
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; | > > > > > > > > > | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; |
︙ | ︙ | |||
1126 1127 1128 1129 1130 1131 1132 | -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | | | | | | 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac |
︙ | ︙ | |||
1188 1189 1190 1191 1192 1193 1194 | as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. | | | | | | 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; |
︙ | ︙ | |||
1270 1271 1272 1273 1274 1275 1276 | ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || | | | 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 | ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q |
︙ | ︙ | |||
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 | Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] | > | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
︙ | ︙ | |||
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | on) --enable-symbols build with debugging symbols (default: off) --enable-aqua=yes|no use Aqua windowingsystem on Mac OS X (default: no) --enable-xft use freetype/fontconfig/xft (default: on) --enable-xss use XScreenSaver for activity timer (default: on) --enable-framework package shared libraries in MacOSX frameworks (default: off) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) | > | < | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | on) --enable-symbols build with debugging symbols (default: off) --enable-aqua=yes|no use Aqua windowingsystem on Mac OS X (default: no) --enable-xft use freetype/fontconfig/xft (default: on) --enable-xss use XScreenSaver for activity timer (default: on) --enable-framework package shared libraries in MacOSX frameworks (default: off) --enable-zipfs build with Zipfs support (default: on) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) --with-encoding encoding for configuration values (default: utf-8) --with-x use the X Window System Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> |
︙ | ︙ | |||
1460 1461 1462 1463 1464 1465 1466 | { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) | | | | 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 | { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix |
︙ | ︙ | |||
1490 1491 1492 1493 1494 1495 1496 | ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } | | > | | | | | | | > | | | | | > | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | > | | | | > | | | | | | > | | | | < < < | < < < < | | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | | | > | | > | | | | | > > > > > > > > > > > > > > > > > > > > | | | 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 | ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF tk configure 8.7 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case <limits.h> declares $2. For example, HP-UX 11i <limits.h> declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. */ #include <limits.h> #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by tk $as_me 8.7, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## |
︙ | ︙ | |||
1962 1963 1964 1965 1966 1967 1968 | _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS | > | > > > | | 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 | _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF |
︙ | ︙ | |||
1998 1999 2000 2001 2002 2003 2004 | do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) | | | 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 | do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. |
︙ | ︙ | |||
2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 | # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo | > > | | | | 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 | # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac |
︙ | ︙ | |||
2073 2074 2075 2076 2077 2078 2079 | sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo | | | | | | | | | | | < | < < | < < | < < | < < | < < | < < < < | < < < < | < | < > | | > > > > > | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | > | | | > | | | > | | | | | 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 | sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include <stddef.h> #include <stdarg.h> struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include <stdbool.h> extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 TK_PATCH_LEVEL="a6" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" #-------------------------------------------------------------------- # Find and load the tclConfig.sh file #-------------------------------------------------------------------- # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl was given. if test ${with_tcl+y} then : withval=$with_tcl; with_tclconfig="${withval}" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 printf %s "checking for Tcl configuration... " >&6; } if test ${ac_cv_c_tclconfig+y} then : printf %s "(cached) " >&6 else $as_nop # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case "${with_tclconfig}" in */tclConfig.sh ) if test -f "${with_tclconfig}"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5 printf "%s\n" "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;} with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`" fi ;; esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`" else as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5 |
︙ | ︙ | |||
2408 2409 2410 2411 2412 2413 2414 | if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" as_fn_error $? "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" "$LINENO" 5 else no_tcl= TCL_BIN_DIR="${ac_cv_c_tclconfig}" | | | | | | | | | | 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 | if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" as_fn_error $? "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" "$LINENO" 5 else no_tcl= TCL_BIN_DIR="${ac_cv_c_tclconfig}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 printf "%s\n" "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 printf %s "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; } if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: loading" >&5 printf "%s\n" "loading" >&6; } . "${TCL_BIN_DIR}/tclConfig.sh" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 printf "%s\n" "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an |
︙ | ︙ | |||
2485 2486 2487 2488 2489 2490 2491 | if test "${TCL_MINOR_VERSION}" -lt 6 ; then as_fn_error $? "${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+ Found config for Tcl ${TCL_VERSION}" "$LINENO" 5 fi fi | | | | > | | | | | | | | | | | 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 | if test "${TCL_MINOR_VERSION}" -lt 6 ; then as_fn_error $? "${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+ Found config for Tcl ${TCL_VERSION}" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 printf %s "checking for tclsh... " >&6; } if test ${ac_cv_path_tclsh+y} then : printf %s "(cached) " >&6 else $as_nop search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/tclsh[8-9]* 2> /dev/null` \ `ls -r $dir/tclsh* 2> /dev/null` ; do if test x"$ac_cv_path_tclsh" = x ; then if test -f "$j" ; then ac_cv_path_tclsh=$j break fi fi done done fi if test -f "$ac_cv_path_tclsh" ; then TCLSH_PROG="$ac_cv_path_tclsh" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5 printf "%s\n" "$TCLSH_PROG" >&6; } else # It is not an error if an installed version of Tcl can't be located. TCLSH_PROG="" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5 printf "%s\n" "No tclsh found on PATH" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5 printf %s "checking for tclsh in Tcl build directory... " >&6; } BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5 printf "%s\n" "$BUILD_TCLSH" >&6; } #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ |
︙ | ︙ | |||
2547 2548 2549 2550 2551 2552 2553 | TK_SRC_DIR="`cd "$srcdir"/..; pwd`" #------------------------------------------------------------------------ # Compress and/or soft link the manpages? #------------------------------------------------------------------------ | | | | > | | | | | | > | | | | | | | | | | > | | | > > > > > > > > > | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | > | | | > | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | > | | | | | | > | | | | | | | | | > | | | | > | | | | > > | | | | > | | | | > | | | > | | | > | | | | | | > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | > | < | | < < < | | | < > | > > > > | | | > | | > | | | > | | | | | > | | | | 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 | TK_SRC_DIR="`cd "$srcdir"/..; pwd`" #------------------------------------------------------------------------ # Compress and/or soft link the manpages? #------------------------------------------------------------------------ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use symlinks for manpages" >&5 printf %s "checking whether to use symlinks for manpages... " >&6; } # Check whether --enable-man-symlinks was given. if test ${enable_man_symlinks+y} then : enableval=$enable_man_symlinks; test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks" else $as_nop enableval="no" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 printf "%s\n" "$enableval" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to compress the manpages" >&5 printf %s "checking whether to compress the manpages... " >&6; } # Check whether --enable-man-compression was given. if test ${enable_man_compression+y} then : enableval=$enable_man_compression; case $enableval in yes) as_fn_error $? "missing argument to --enable-man-compression" "$LINENO" 5;; no) ;; *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";; esac else $as_nop enableval="no" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 printf "%s\n" "$enableval" >&6; } if test "$enableval" != "no"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compressed file suffix" >&5 printf %s "checking for compressed file suffix... " >&6; } touch TeST $enableval TeST Z=`ls TeST* | sed 's/^....//'` rm -f TeST* MAN_FLAGS="$MAN_FLAGS --extension $Z" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $Z" >&5 printf "%s\n" "$Z" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to add a package name suffix for the manpages" >&5 printf %s "checking whether to add a package name suffix for the manpages... " >&6; } # Check whether --enable-man-suffix was given. if test ${enable_man_suffix+y} then : enableval=$enable_man_suffix; case $enableval in yes) enableval="tk" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; no) ;; *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; esac else $as_nop enableval="no" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 printf "%s\n" "$enableval" >&6; } #------------------------------------------------------------------------ # Standard compiler checks #------------------------------------------------------------------------ # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> int main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 printf %s "checking for inline... " >&6; } if test ${ac_cv_c_inline+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo (void) {return 0; } $ac_kw foo_t foo (void) {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; |
︙ | ︙ | |||
3454 3455 3456 3457 3458 3459 3460 | #------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" && test -n "$GCC"; then | | | | > | | | | > | | | | | > < | < | | | | > | < < < < < < < < | | | | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < | < < | | < < | | < < < < < < < < < < < < < < < < < | < < < < < < | < < | < < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < | | | > | | | | | | > | | | | > | | | > | | | | > | | | | | > | | | | | > | | | | | | > | | | | | | | | | > | | < < < | | > | | | | | > | | 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 | #------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" && test -n "$GCC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -pipe" >&5 printf %s "checking if the compiler understands -pipe... " >&6; } if test ${tcl_cv_cc_pipe+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_cc_pipe=yes else $as_nop tcl_cv_cc_pipe=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_pipe" >&5 printf "%s\n" "$tcl_cv_cc_pipe" >&6; } if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi #------------------------------------------------------------------------ # Embedded configuration information, encoding to use for the values, TIP #59 #------------------------------------------------------------------------ # Check whether --with-encoding was given. if test ${with_encoding+y} then : withval=$with_encoding; with_tcencoding=${withval} fi if test x"${with_tcencoding}" != x ; then printf "%s\n" "#define TCL_CFGVAL_ENCODING \"${with_tcencoding}\"" >>confdefs.h else printf "%s\n" "#define TCL_CFGVAL_ENCODING \"utf-8\"" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 printf %s "checking how to build libraries... " >&6; } # Check whether --enable-shared was given. if test ${enable_shared+y} then : enableval=$enable_shared; tcl_ok=$enableval else $as_nop tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: shared" >&5 printf "%s\n" "shared" >&6; } SHARED_BUILD=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static" >&5 printf "%s\n" "static" >&6; } SHARED_BUILD=0 printf "%s\n" "#define STATIC_BUILD 1" >>confdefs.h fi #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called # after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi # Step 0.a: Enable 64 bit support? { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5 printf %s "checking if 64bit support is requested... " >&6; } # Check whether --enable-64bit was given. if test ${enable_64bit+y} then : enableval=$enable_64bit; do64bit=$enableval else $as_nop do64bit=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5 printf "%s\n" "$do64bit" >&6; } # Step 0.b: Enable Solaris 64 bit VIS support? { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if 64bit Sparc VIS support is requested" >&5 printf %s "checking if 64bit Sparc VIS support is requested... " >&6; } # Check whether --enable-64bit-vis was given. if test ${enable_64bit_vis+y} then : enableval=$enable_64bit_vis; do64bitVIS=$enableval else $as_nop do64bitVIS=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $do64bitVIS" >&5 printf "%s\n" "$do64bitVIS" >&6; } # Force 64bit on with VIS if test "$do64bitVIS" = "yes" then : do64bit=yes fi # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports visibility \"hidden\"" >&5 printf %s "checking if compiler supports visibility \"hidden\"... " >&6; } if test ${tcl_cv_cc_visibility_hidden+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) void f(void); void f(void) {} int main (void) { f(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_cc_visibility_hidden=yes else $as_nop tcl_cv_cc_visibility_hidden=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5 printf "%s\n" "$tcl_cv_cc_visibility_hidden" >&6; } if test $tcl_cv_cc_visibility_hidden = yes then : printf "%s\n" "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h printf "%s\n" "#define HAVE_HIDDEN 1" >>confdefs.h fi # Step 0.d: Disable -rpath support? { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5 printf %s "checking if rpath support is requested... " >&6; } # Check whether --enable-rpath was given. if test ${enable_rpath+y} then : enableval=$enable_rpath; doRpath=$enableval else $as_nop doRpath=yes fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $doRpath" >&5 printf "%s\n" "$doRpath" >&6; } # Step 1: set the variable "system" to hold the name and version number # for the system. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking system version" >&5 printf %s "checking system version... " >&6; } if test ${tcl_cv_sys_version+y} then : printf %s "(cached) " >&6 else $as_nop if test "${TEA_PLATFORM}" = "windows" ; then tcl_cv_sys_version=windows else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: can't find uname command" >&5 printf "%s\n" "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then tcl_cv_sys_version=NetBSD-Debian fi fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_sys_version" >&5 printf "%s\n" "$tcl_cv_sys_version" >&6; } system=$tcl_cv_sys_version # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : have_dl=yes else $as_nop have_dl=no fi # Require ranlib early so we can override it in special cases below. |
︙ | ︙ | |||
4232 4233 4234 4235 4236 4237 4238 | # is disabled by the user. [Bug 1016796] LDFLAGS_ARCH="" UNSHARED_LIB_SUFFIX="" TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g | | > | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | > | > | | | > | > | | | | > | > | | | > | | 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 | # is disabled by the user. [Bug 1016796] LDFLAGS_ARCH="" UNSHARED_LIB_SUFFIX="" TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g if test "$GCC" = yes then : CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" case "${CC}" in *++|*++-*) ;; *) CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers" ;; esac else $as_nop CFLAGS_OPTIMIZE=-O CFLAGS_WARNING="" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi STLIB_LD='${AR} cr' LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" if test "x${SHLIB_VERSION}" = x then : SHLIB_VERSION="1.0" fi case $system in AIX-*) if test "$GCC" != "yes" then : # AIX requires the _r compiler when gcc isn't being used case "${CC}" in *_r|*_r\ *) # ok ... ;; *) # Make sure only first arg gets _r CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'` ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5 printf "%s\n" "Using $CC for compiling with threads" >&6; } fi LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" LD_LIBRARY_PATH_VAR="LIBPATH" # ldAix No longer needed with use of -bexpall/-brtl # but some extensions may still reference it LDAIX_SRC='$(UNIX_DIR)/ldAix' # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes then : if test "$GCC" = yes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 printf "%s\n" "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else $as_nop do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS_ARCH="-q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" fi fi if test "`uname -m`" = ia64 then : # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" # AIX-5 has dl* in libc.so DL_LIBS="" if test "$GCC" = yes then : CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' else $as_nop CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else $as_nop if test "$GCC" = yes then : SHLIB_LD='${CC} -shared -Wl,-bexpall' else $as_nop SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry" LDFLAGS="$LDFLAGS -brtl" fi SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" |
︙ | ︙ | |||
4449 4450 4451 4452 4453 4454 4455 | DL_LIBS="-ldl" #----------------------------------------------------------- # Check for inet_ntoa in -lbind, for BeOS (which also needs # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- | | | | > | | < < < | | > | | | | | > | 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 | DL_LIBS="-ldl" #----------------------------------------------------------- # Check for inet_ntoa in -lbind, for BeOS (which also needs # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lbind" >&5 printf %s "checking for inet_ntoa in -lbind... " >&6; } if test ${ac_cv_lib_bind_inet_ntoa+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char inet_ntoa (); int main (void) { return inet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_bind_inet_ntoa=yes else $as_nop ac_cv_lib_bind_inet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_inet_ntoa" >&5 printf "%s\n" "$ac_cv_lib_bind_inet_ntoa" >&6; } if test "x$ac_cv_lib_bind_inet_ntoa" = xyes then : LIBS="$LIBS -lbind -lsocket" fi ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" SHLIB_LD="shlicc -r" |
︙ | ︙ | |||
4509 4510 4511 4512 4513 4514 4515 | SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; | | | | | > | | | | > | | | | | | | 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 | SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; CYGWIN_*|MINGW32_*|MSYS_*) SHLIB_CFLAGS="-fno-common" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" DL_OBJS="tclLoadDl.o" PLAT_OBJS='${CYGWIN_OBJS}' PLAT_SRCS='${CYGWIN_SRCS}' DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}.dll.a' SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\[email protected]" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Cygwin version of gcc" >&5 printf %s "checking for Cygwin version of gcc... " >&6; } if test ${ac_cv_cygwin+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __CYGWIN__ #error cygwin #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_cygwin=no else $as_nop ac_cv_cygwin=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cygwin" >&5 printf "%s\n" "$ac_cv_cygwin" >&6; } if test "$ac_cv_cygwin" = "no"; then as_fn_error $? "${CC} is not a cygwin compiler." "$LINENO" 5 fi do64bit_ok=yes if test "x${SHARED_BUILD}" = "x1"; then echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32" # The eval makes quoting arguments work. if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32; cd ../unix then : else { echo "configure: error: configure failed for ../win" 1>&2; exit 1; } fi fi ;; dgux*) |
︙ | ︙ | |||
4583 4584 4585 4586 4587 4588 4589 | Haiku*) LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-lroot" | | | | > | | < < < | | > | | | | | > | | | > | | | | > | | < < < | | > | | | | | > | | > | > | | > | > | > | | | | | | > | | < < < | | > | | | | | > | | > | 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 | Haiku*) LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-lroot" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnetwork" >&5 printf %s "checking for inet_ntoa in -lnetwork... " >&6; } if test ${ac_cv_lib_network_inet_ntoa+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lnetwork $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char inet_ntoa (); int main (void) { return inet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_network_inet_ntoa=yes else $as_nop ac_cv_lib_network_inet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_inet_ntoa" >&5 printf "%s\n" "$ac_cv_lib_network_inet_ntoa" >&6; } if test "x$ac_cv_lib_network_inet_ntoa" = xyes then : LIBS="$LIBS -lnetwork" fi ;; HP-UX-*.11.*) # Use updated header definitions where possible printf "%s\n" "#define _XOPEN_SOURCE_EXTENDED 1" >>confdefs.h printf "%s\n" "#define _XOPEN_SOURCE 1" >>confdefs.h LIBS="$LIBS -lxnet" # Use the XOPEN network library if test "`uname -m`" = ia64 then : SHLIB_SUFFIX=".so" else $as_nop SHLIB_SUFFIX=".sl" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 printf %s "checking for shl_load in -ldld... " >&6; } if test ${ac_cv_lib_dld_shl_load+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char shl_load (); int main (void) { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_shl_load=yes else $as_nop ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes then : tcl_ok=yes else $as_nop tcl_ok=no fi if test "$tcl_ok" = yes then : SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi if test "$GCC" = yes then : SHLIB_LD='${CC} -shared' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else $as_nop CFLAGS="$CFLAGS -z" fi # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" then : if test "$GCC" = yes then : case `${CC} -dumpmachine` in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD='${CC} -shared' if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 printf "%s\n" "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} ;; esac else $as_nop do64bit_ok=yes CFLAGS="$CFLAGS +DD64" LDFLAGS_ARCH="+DD64" fi fi ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 printf %s "checking for shl_load in -ldld... " >&6; } if test ${ac_cv_lib_dld_shl_load+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char shl_load (); int main (void) { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_shl_load=yes else $as_nop ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes then : tcl_ok=yes else $as_nop tcl_ok=no fi if test "$tcl_ok" = yes then : SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS="" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" |
︙ | ︙ | |||
4811 4812 4813 4814 4815 4816 4817 | DL_LIBS="" case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; esac | | > | > | > | | 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 | DL_LIBS="" case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; esac if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi ;; IRIX-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; esac if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes then : CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" else $as_nop case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) |
︙ | ︙ | |||
4866 4867 4868 4869 4870 4871 4872 | DL_LIBS="" case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; esac | | > | > | > | | | | > > > > > > > > > > > > > > | > | > | > | | | > | | | | > | | | | | > | > | > | > | 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 | DL_LIBS="" case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; esac if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes then : if test "$GCC" = yes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported by gcc" >&5 printf "%s\n" "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} else $as_nop do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" fi fi ;; Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*) SHLIB_CFLAGS="-fPIC -fno-common" SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE="-O2" # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" case $system in DragonFly-*|FreeBSD-*) if test "${TCL_THREADS}" = "1" then : # The -pthread needs to go in the LDFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_LIBS" fi ;; esac if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "`uname -m`" = "alpha" then : CFLAGS="$CFLAGS -mieee" fi if test $do64bit = yes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -m64 flag" >&5 printf %s "checking if compiler accepts -m64 flag... " >&6; } if test ${tcl_cv_cc_m64+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_cc_m64=yes else $as_nop tcl_cv_cc_m64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_m64" >&5 printf "%s\n" "$tcl_cv_cc_m64" >&6; } if test $tcl_cv_cc_m64 = yes then : CFLAGS="$CFLAGS -m64" do64bit_ok=yes fi fi # The combo of gcc + glibc has a bug related to inlining of # functions like strtol()/strtoul(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. if test x"${USE_COMPAT}" != x then : CFLAGS="$CFLAGS -fno-inline" fi ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE=-02 SHLIB_LD='${CC} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' fi ;; OpenBSD-*) arch=`arch -s` case "$arch" in alpha|sparc64) SHLIB_CFLAGS="-fPIC" ;; *) SHLIB_CFLAGS="-fpic" ;; esac SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" |
︙ | ︙ | |||
5017 5018 5019 5020 5021 5022 5023 | # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" | | > < < < < < < < < < < < < < < < < < < < < < < < < < < | | > | | | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | | | | > | | | | | > | | | | | > | | | | | | | > | | | | | | > | | | > | | | | > | | | | | > | | | > | | | | > | | | | | > | > | | | | | > | | | | > | | | > | | | > | | > | | | > | | | > | | | > | | | > | | | | > | | | | | > | | | > | | | | > | > | | > | | 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 | # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; Darwin-*) CFLAGS_OPTIMIZE="-O2" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if ($i~/^(isysroot|mmacosx-version-min)/) print "-"$i}'`" CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`" if test $do64bit = yes then : case `arch` in ppc) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch ppc64 flag" >&5 printf %s "checking if compiler accepts -arch ppc64 flag... " >&6; } if test ${tcl_cv_cc_arch_ppc64+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_cc_arch_ppc64=yes else $as_nop tcl_cv_cc_arch_ppc64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_ppc64" >&5 printf "%s\n" "$tcl_cv_cc_arch_ppc64" >&6; } if test $tcl_cv_cc_arch_ppc64 = yes then : CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes fi;; i386|x86_64) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch x86_64 flag" >&5 printf %s "checking if compiler accepts -arch x86_64 flag... " >&6; } if test ${tcl_cv_cc_arch_x86_64+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_cc_arch_x86_64=yes else $as_nop tcl_cv_cc_arch_x86_64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_x86_64" >&5 printf "%s\n" "$tcl_cv_cc_arch_x86_64" >&6; } if test $tcl_cv_cc_arch_x86_64 = yes then : CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes fi;; arm64|arm64e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch arm64e flag" >&5 printf %s "checking if compiler accepts -arch arm64e flag... " >&6; } if test ${tcl_cv_cc_arch_arm64e+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch arm64e" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_cc_arch_arm64e=yes else $as_nop tcl_cv_cc_arch_arm64e=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_arm64e" >&5 printf "%s\n" "$tcl_cv_cc_arch_arm64e" >&6; } if test $tcl_cv_cc_arch_arm64e = yes then : CFLAGS="$CFLAGS -arch arm64e" do64bit_ok=yes fi;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 printf "%s\n" "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; esac else $as_nop # Check for combined 32-bit and 64-bit fat build if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64|arm64e) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) ' then : fat_32_64=yes fi fi SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5 printf %s "checking if ld accepts -single_module flag... " >&6; } if test ${tcl_cv_ld_single_module+y} then : printf %s "(cached) " >&6 else $as_nop hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { int i; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_ld_single_module=yes else $as_nop tcl_cv_ld_single_module=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_single_module" >&5 printf "%s\n" "$tcl_cv_ld_single_module" >&6; } if test $tcl_cv_ld_single_module = yes then : SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" LDFLAGS="$LDFLAGS -headerpad_max_install_names" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -search_paths_first flag" >&5 printf %s "checking if ld accepts -search_paths_first flag... " >&6; } if test ${tcl_cv_ld_search_paths_first+y} then : printf %s "(cached) " >&6 else $as_nop hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { int i; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_ld_search_paths_first=yes else $as_nop tcl_cv_ld_search_paths_first=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_search_paths_first" >&5 printf "%s\n" "$tcl_cv_ld_search_paths_first" >&6; } if test $tcl_cv_ld_search_paths_first = yes then : LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi if test "$tcl_cv_cc_visibility_hidden" != yes then : printf "%s\n" "#define MODULE_SCOPE __private_extern__" >>confdefs.h tcl_cv_cc_visibility_hidden=yes fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" printf "%s\n" "#define MAC_OSX_TCL 1" >>confdefs.h PLAT_OBJS='${MAC_OSX_OBJS}' PLAT_SRCS='${MAC_OSX_SRCS}' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use CoreFoundation" >&5 printf %s "checking whether to use CoreFoundation... " >&6; } # Check whether --enable-corefoundation was given. if test ${enable_corefoundation+y} then : enableval=$enable_corefoundation; tcl_corefoundation=$enableval else $as_nop tcl_corefoundation=yes fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_corefoundation" >&5 printf "%s\n" "$tcl_corefoundation" >&6; } if test $tcl_corefoundation = yes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CoreFoundation.framework" >&5 printf %s "checking for CoreFoundation.framework... " >&6; } if test ${tcl_cv_lib_corefoundation+y} then : printf %s "(cached) " >&6 else $as_nop hold_libs=$LIBS if test "$fat_32_64" = yes then : for v in CFLAGS CPPFLAGS LDFLAGS; do # On Tiger there is no 64-bit CF, so remove 64-bit # archs from CFLAGS et al. while testing for # presence of CF. 64-bit CF is disabled in # tclUnixPort.h if necessary. eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi LIBS="$LIBS -framework CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <CoreFoundation/CoreFoundation.h> int main (void) { CFBundleRef b = CFBundleGetMainBundle(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_lib_corefoundation=yes else $as_nop tcl_cv_lib_corefoundation=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test "$fat_32_64" = yes then : for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi LIBS=$hold_libs fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation" >&5 printf "%s\n" "$tcl_cv_lib_corefoundation" >&6; } if test $tcl_cv_lib_corefoundation = yes then : LIBS="$LIBS -framework CoreFoundation" printf "%s\n" "#define HAVE_COREFOUNDATION 1" >>confdefs.h else $as_nop tcl_corefoundation=no fi if test "$fat_32_64" = yes -a $tcl_corefoundation = yes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit CoreFoundation" >&5 printf %s "checking for 64-bit CoreFoundation... " >&6; } if test ${tcl_cv_lib_corefoundation_64+y} then : printf %s "(cached) " >&6 else $as_nop for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <CoreFoundation/CoreFoundation.h> int main (void) { CFBundleRef b = CFBundleGetMainBundle(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_lib_corefoundation_64=yes else $as_nop tcl_cv_lib_corefoundation_64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation_64" >&5 printf "%s\n" "$tcl_cv_lib_corefoundation_64" >&6; } if test $tcl_cv_lib_corefoundation_64 = no then : printf "%s\n" "#define NO_COREFOUNDATION_64 1" >>confdefs.h LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings" fi fi fi ;; OS/390-*) SHLIB_LD_LIBS="" CFLAGS_OPTIMIZE="" # Optimizer is buggy printf "%s\n" "#define _OE_SOCKETS 1" >>confdefs.h ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" if test "$SHARED_BUILD" = 1 then : SHLIB_LD='${CC} -shared' else $as_nop SHLIB_LD='${CC} -non_shared' fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes then : CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes then : CFLAGS="$CFLAGS -mieee" else $as_nop CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi # see pthread_intro(3) for pthread support on osf1, k.furukawa CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` if test "$GCC" = yes then : LIBS="$LIBS -lpthread -lmach -lexc" else $as_nop CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi ;; QNX-6*) |
︙ | ︙ | |||
5429 5430 5431 5432 5433 5434 5435 | CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. | | > | | | | > | | | | > | > | > | > | | | | | > | | | > | > | | | | | | | > | | | | > | | | | > < | | | | > | > | > | | > | | > | | 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 | CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. if test "$GCC" = yes then : SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else $as_nop SHLIB_CFLAGS="-Kpic -belf" LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-5.[0-6]) # Careful to not let 5.10+ fall into this case # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. printf "%s\n" "#define _REENTRANT 1" >>confdefs.h printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h SHLIB_CFLAGS="-KPIC" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = yes then : SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else $as_nop SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi ;; SunOS-5*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. printf "%s\n" "#define _REENTRANT 1" >>confdefs.h printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes then : arch=`isainfo` if test "$arch" = "sparcv9 sparc" then : if test "$GCC" = yes then : if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3 then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 printf "%s\n" "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} else $as_nop do64bit_ok=yes CFLAGS="$CFLAGS -m64 -mcpu=v9" LDFLAGS="$LDFLAGS -m64 -mcpu=v9" SHLIB_CFLAGS="-fPIC" fi else $as_nop do64bit_ok=yes if test "$do64bitVIS" = yes then : CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" else $as_nop CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi else $as_nop if test "$arch" = "amd64 i386" then : if test "$GCC" = yes then : case $system in SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*) do64bit_ok=yes CFLAGS="$CFLAGS -m64" LDFLAGS="$LDFLAGS -m64";; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 printf "%s\n" "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;};; esac else $as_nop do64bit_ok=yes case $system in SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*) CFLAGS="$CFLAGS -m64" LDFLAGS="$LDFLAGS -m64";; *) CFLAGS="$CFLAGS -xarch=amd64" LDFLAGS="$LDFLAGS -xarch=amd64";; esac fi else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported for $arch" >&5 printf "%s\n" "$as_me: WARNING: 64bit mode not supported for $arch" >&2;} fi fi fi #-------------------------------------------------------------------- # On Solaris 5.x i386 with the sunpro compiler we need to link # with sunmath to get floating point rounding control #-------------------------------------------------------------------- if test "$GCC" = yes then : use_sunmath=no else $as_nop arch=`isainfo` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use -lsunmath for fp rounding control" >&5 printf %s "checking whether to use -lsunmath for fp rounding control... " >&6; } if test "$arch" = "amd64 i386" -o "$arch" = "i386" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } MATH_LIBS="-lsunmath $MATH_LIBS" ac_fn_c_check_header_compile "$LINENO" "sunmath.h" "ac_cv_header_sunmath_h" "$ac_includes_default" if test "x$ac_cv_header_sunmath_h" = xyes then : fi use_sunmath=yes else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } use_sunmath=no fi fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = yes then : SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "$do64bit_ok" = yes then : if test "$arch" = "sparcv9 sparc" then : # We need to specify -static-libgcc or we need to # add the path to the sparv9 libgcc. SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" # for finding sparcv9 libgcc, get the regular libgcc # path, remove so name and append 'sparcv9' #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" else $as_nop if test "$arch" = "amd64 i386" then : SHLIB_LD="$SHLIB_LD -m64 -static-libgcc" fi fi fi else $as_nop if test "$use_sunmath" = yes then : textmode=textoff else $as_nop textmode=text fi case $system in SunOS-5.[1-9][0-9]*|SunOS-5.[7-9]) SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";; *) SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";; |
︙ | ︙ | |||
5660 5661 5662 5663 5664 5665 5666 | SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. | | | | > | | | | > | | | | | > | > | | | > | | > | | > | > | | | | > | | | | > | | > | > | > | > | | | > | | > | | > | | | | | | > | | | | | | > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > | | > | < | 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 | SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld accepts -Bexport flag" >&5 printf %s "checking for ld accepts -Bexport flag... " >&6; } if test ${tcl_cv_ld_Bexport+y} then : printf %s "(cached) " >&6 else $as_nop hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { int i; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_ld_Bexport=yes else $as_nop tcl_cv_ld_Bexport=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_Bexport" >&5 printf "%s\n" "$tcl_cv_ld_Bexport" >&6; } if test $tcl_cv_ld_Bexport = yes then : LDFLAGS="$LDFLAGS -Wl,-Bexport" fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac if test "$do64bit" = yes -a "$do64bit_ok" = no then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 printf "%s\n" "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} fi if test "$do64bit" = yes -a "$do64bit_ok" = yes then : printf "%s\n" "#define TCL_CFG_DO64BIT 1" >>confdefs.h fi # Step 4: disable dynamic loading if requested via a command-line switch. # Check whether --enable-load was given. if test ${enable_load+y} then : enableval=$enable_load; tcl_ok=$enableval else $as_nop tcl_ok=yes fi if test "$tcl_ok" = no then : DL_OBJS="" fi if test "x$DL_OBJS" != x then : BUILD_DLTEST="\$(DLTEST_TARGETS)" else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5 printf "%s\n" "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;} SHLIB_CFLAGS="" SHLIB_LD="" SHLIB_SUFFIX="" DL_OBJS="tclLoadNone.o" DL_LIBS="" LDFLAGS="$LDFLAGS_ORIG" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" BUILD_DLTEST="" fi LDFLAGS="$LDFLAGS $LDFLAGS_ARCH" # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes then : case $system in AIX-*) ;; BSD/OS*) ;; CYGWIN_*|MINGW32_*|MSYS_*) ;; HP-UX*) ;; Darwin-*) ;; IRIX*) ;; Linux*|GNU*) ;; NetBSD-*|OpenBSD-*) ;; OSF1-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac fi if test "$tcl_cv_cc_visibility_hidden" != yes then : printf "%s\n" "#define MODULE_SCOPE extern" >>confdefs.h fi if test "$SHARED_LIB_SUFFIX" = "" then : SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}' fi if test "$UNSHARED_LIB_SUFFIX" = "" then : UNSHARED_LIB_SUFFIX='${VERSION}.a' fi DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)" if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != "" then : LIB_SUFFIX=${SHARED_LIB_SUFFIX} MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' if test "${SHLIB_SUFFIX}" = ".dll" then : INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;' DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)" else $as_nop INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"' fi else $as_nop LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} if test "$RANLIB" = "" then : MAKE_LIB='$(STLIB_LD) $@ ${OBJS}' else $as_nop MAKE_LIB='${STLIB_LD} $@ ${OBJS} ; ${RANLIB} $@' fi INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"' fi # Stub lib does not depend on shared/static configuration if test "$RANLIB" = "" then : MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}' else $as_nop MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS} ; ${RANLIB} $@' fi INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"' # Define TCL_LIBS now that we know what DL_LIBS is. # The trick here is that we don't want to change the value of TCL_LIBS if # it is already set when tclConfig.sh had been loaded by Tk. if test "x${TCL_LIBS}" = x then : TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}" fi # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 printf %s "checking for cast to union support... " >&6; } if test ${tcl_cv_cast_to_union+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { union foo { int i; double d; }; union foo f = (union foo) (int) 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_cast_to_union=yes else $as_nop tcl_cv_cast_to_union=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 printf "%s\n" "$tcl_cv_cast_to_union" >&6; } if test "$tcl_cv_cast_to_union" = "yes"; then printf "%s\n" "#define HAVE_CAST_TO_UNION 1" >>confdefs.h fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -fno-lto" >&5 printf %s "checking for working -fno-lto... " >&6; } if test ${ac_cv_nolto+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_nolto=yes else $as_nop ac_cv_nolto=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_nolto" >&5 printf "%s\n" "$ac_cv_nolto" >&6; } CFLAGS=$hold_cflags if test "$ac_cv_nolto" = "yes" ; then CFLAGS_NOLTO="-fno-lto" else CFLAGS_NOLTO="" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -finput-charset" >&5 printf %s "checking if the compiler understands -finput-charset... " >&6; } if test ${tcl_cv_cc_input_charset+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_cc_input_charset=yes else $as_nop tcl_cv_cc_input_charset=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_input_charset" >&5 printf "%s\n" "$tcl_cv_cc_input_charset" >&6; } if test $tcl_cv_cc_input_charset = yes; then CFLAGS="$CFLAGS -finput-charset=UTF-8" fi ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default" if test "x$ac_cv_header_stdbool_h" = xyes then : printf "%s\n" "#define HAVE_STDBOOL_H 1" >>confdefs.h fi # FIXME: This subst was left in only because the TCL_DL_LIBS # entry in tclConfig.sh uses it. It is not clear why someone # would use TCL_DL_LIBS instead of TCL_LIBS. |
︙ | ︙ | |||
5917 5918 5919 5920 5921 5922 5923 |
| | | < | | | > | | | | | | | | | | | | | | | > | | | | > | | | > | | | | | > | | | | > | | | > | | | | | > | | | | > | | | > | | | | | | | | | | | > | | < < < < < < < < < < < < < < < < < < | | | > | | | | | < < < < < < < < | | | > | | | | > | | | | | | | | > | | | | > | | | | | | | | > | | | | > | | | | | > | | > | > | > | | < < < | | | > | | | | > | | | | | | | | | | > | | | > | 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 | printf "%s\n" "#define TCL_SHLIB_EXT \"${SHLIB_SUFFIX}\"" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5 printf %s "checking for build with symbols... " >&6; } # Check whether --enable-symbols was given. if test ${enable_symbols+y} then : enableval=$enable_symbols; tcl_ok=$enableval else $as_nop tcl_ok=no fi # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' printf "%s\n" "#define NDEBUG 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h else CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' if test "$tcl_ok" = "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5 printf "%s\n" "yes (standard debugging)" >&6; } fi fi if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then printf "%s\n" "#define TCL_MEM_DEBUG 1" >>confdefs.h fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem debugging" >&5 printf "%s\n" "enabled symbols mem debugging" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5 printf "%s\n" "enabled $tcl_ok debugging" >&6; } fi fi #-------------------------------------------------------------------- # Detect what compiler flags to set for 64-bit support. #-------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for required early compiler flags" >&5 printf %s "checking for required early compiler flags... " >&6; } tcl_flags="" if test ${tcl_cv_flag__isoc99_source+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main (void) { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_flag__isoc99_source=no else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _ISOC99_SOURCE 1 #include <stdlib.h> int main (void) { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_flag__isoc99_source=yes else $as_nop tcl_cv_flag__isoc99_source=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then printf "%s\n" "#define _ISOC99_SOURCE 1" >>confdefs.h tcl_flags="$tcl_flags _ISOC99_SOURCE" fi if test ${tcl_cv_flag__largefile64_source+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/stat.h> int main (void) { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_flag__largefile64_source=no else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE64_SOURCE 1 #include <sys/stat.h> int main (void) { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_flag__largefile64_source=yes else $as_nop tcl_cv_flag__largefile64_source=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then printf "%s\n" "#define _LARGEFILE64_SOURCE 1" >>confdefs.h tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" fi if test ${tcl_cv_flag__largefile_source64+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/stat.h> int main (void) { char *p = (char *)open64; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_flag__largefile_source64=no else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE_SOURCE64 1 #include <sys/stat.h> int main (void) { char *p = (char *)open64; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_flag__largefile_source64=yes else $as_nop tcl_cv_flag__largefile_source64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then printf "%s\n" "#define _LARGEFILE_SOURCE64 1" >>confdefs.h tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" fi if test "x${tcl_flags}" = "x" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 printf "%s\n" "none" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${tcl_flags}" >&5 printf "%s\n" "${tcl_flags}" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit integer type" >&5 printf %s "checking for 64-bit integer type... " >&6; } if test ${tcl_cv_type_64bit+y} then : printf %s "(cached) " >&6 else $as_nop tcl_cv_type_64bit=none # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { switch (0) { case 1: case (sizeof(long long)==sizeof(long)): ; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_type_64bit="long long" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test "${tcl_cv_type_64bit}" = none ; then printf "%s\n" "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else # Now check for auxiliary declarations { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent64" >&5 printf %s "checking for struct dirent64... " >&6; } if test ${tcl_cv_struct_dirent64+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <dirent.h> int main (void) { struct dirent64 p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_struct_dirent64=yes else $as_nop tcl_cv_struct_dirent64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_dirent64" >&5 printf "%s\n" "$tcl_cv_struct_dirent64" >&6; } if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then printf "%s\n" "#define HAVE_STRUCT_DIRENT64 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for DIR64" >&5 printf %s "checking for DIR64... " >&6; } if test ${tcl_cv_DIR64+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <dirent.h> int main (void) { struct dirent64 *p; DIR64 d = opendir64("."); p = readdir64(d); rewinddir64(d); closedir64(d); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_DIR64=yes else $as_nop tcl_cv_DIR64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_DIR64" >&5 printf "%s\n" "$tcl_cv_DIR64" >&6; } if test "x${tcl_cv_DIR64}" = "xyes" ; then printf "%s\n" "#define HAVE_DIR64 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct stat64" >&5 printf %s "checking for struct stat64... " >&6; } if test ${tcl_cv_struct_stat64+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/stat.h> int main (void) { struct stat64 p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_struct_stat64=yes else $as_nop tcl_cv_struct_stat64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_stat64" >&5 printf "%s\n" "$tcl_cv_struct_stat64" >&6; } if test "x${tcl_cv_struct_stat64}" = "xyes" ; then printf "%s\n" "#define HAVE_STRUCT_STAT64 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "open64" "ac_cv_func_open64" if test "x$ac_cv_func_open64" = xyes then : printf "%s\n" "#define HAVE_OPEN64 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "lseek64" "ac_cv_func_lseek64" if test "x$ac_cv_func_lseek64" = xyes then : printf "%s\n" "#define HAVE_LSEEK64 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5 printf %s "checking for off64_t... " >&6; } if test ${tcl_cv_type_off64_t+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> int main (void) { off64_t offset; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_type_off64_t=yes else $as_nop tcl_cv_type_off64_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then printf "%s\n" "#define HAVE_TYPE_OFF64_T 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi #-------------------------------------------------------------------- # Check endianness because we can optimize some operations #-------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 printf %s "checking whether byte ordering is bigendian... " >&6; } if test ${ac_cv_c_bigendian+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO" then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then |
︙ | ︙ | |||
6400 6401 6402 6403 6404 6405 6406 | esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi | | | | > | | > | | | | | > | | > | | | | > | | | | | | > | | | | > | | | | | | | | | | | | > | | | | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > | < | < > | > | > | > > > > > | > > > | > > > > > > > > > > > > > > > | | < < < < < < < < < < < | < < < < < < < < < < < | < < < < < < < < < | < | < | < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < | < | < | < | < < < < < | < < < < < < < < | < < < | | < < < < < < < < < < < < < < < < < < < < < | | | > | | | | > | | | | | | | | > | | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < | | | < < < < < < < < < < < | | | > | | | | > | | | | < < | | < > | < < < | | | > | | | | > | | | | | | | | > | | | | > | | | | | | | > > > > > > | | | | | > | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 | esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/param.h> int main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/param.h> int main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> int main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> int main (void) { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_bigendian=no else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 printf "%s\n" "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac #------------------------------------------------------------------------ # If Tcl and Tk are installed in different places, adjust the library # search path to reflect this. #------------------------------------------------------------------------ LIB_RUNTIME_DIR='$(libdir)' if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib" fi if test "$TCL_PREFIX" != "$prefix"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Different --prefix selected for Tk and Tcl! [package require tk] may not work correctly in tclsh." >&5 printf "%s\n" "$as_me: WARNING: Different --prefix selected for Tk and Tcl! [package require tk] may not work correctly in tclsh." >&2;} fi #-------------------------------------------------------------------- # Include sys/select.h if it exists and if it supplies things # that appear to be useful and aren't already in sys/types.h. # This appears to be true only on the RS/6000 under AIX. Some # systems like OSF/1 have a sys/select.h that's of no use, and # other systems like SCO UNIX have a sys/select.h that's # pernicious. If "fd_set" isn't defined anywhere then set a # special flag. #-------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fd_set in sys/types" >&5 printf %s "checking for fd_set in sys/types... " >&6; } if test ${tcl_cv_type_fd_set+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> int main (void) { fd_set readMask, writeMask; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_type_fd_set=yes else $as_nop tcl_cv_type_fd_set=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_type_fd_set" >&5 printf "%s\n" "$tcl_cv_type_fd_set" >&6; } tk_ok=$tcl_cv_type_fd_set if test $tk_ok = no; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CC needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fd_mask in sys/select" >&5 printf %s "checking for fd_mask in sys/select... " >&6; } if test ${tcl_cv_grep_fd_mask+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/select.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "fd_mask" >/dev/null 2>&1 then : tcl_cv_grep_fd_mask=present else $as_nop tcl_cv_grep_fd_mask=missing fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_fd_mask" >&5 printf "%s\n" "$tcl_cv_grep_fd_mask" >&6; } if test $tcl_cv_grep_fd_mask = present; then printf "%s\n" "#define HAVE_SYS_SELECT_H 1" >>confdefs.h tk_ok=yes fi fi if test $tk_ok = no; then printf "%s\n" "#define NO_FD_SET 1" >>confdefs.h fi #------------------------------------------------------------------------------ # Find out all about time handling differences. #------------------------------------------------------------------------------ #-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes then : else $as_nop printf "%s\n" "#define mode_t int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default " if test "x$ac_cv_type_pid_t" = xyes then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _WIN64 && !defined __CYGWIN__ LLP64 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_pid_type='int' else $as_nop ac_pid_type='__int64' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else $as_nop printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" " #include <stdint.h> " if test "x$ac_cv_type_intptr_t" = xyes then : printf "%s\n" "#define HAVE_INTPTR_T 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" " #include <stdint.h> " if test "x$ac_cv_type_uintptr_t" = xyes then : printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h fi #------------------------------------------- # In OS/390 struct pwd has no pw_gecos field #------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pw_gecos in struct pwd" >&5 printf %s "checking pw_gecos in struct pwd... " >&6; } if test ${tcl_cv_pwd_pw_gecos+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pwd.h> int main (void) { struct passwd pwd; (void)pwd.pw_gecos; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_pwd_pw_gecos=yes else $as_nop tcl_cv_pwd_pw_gecos=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_pwd_pw_gecos" >&5 printf "%s\n" "$tcl_cv_pwd_pw_gecos" >&6; } if test $tcl_cv_pwd_pw_gecos = yes; then printf "%s\n" "#define HAVE_PW_GECOS 1" >>confdefs.h fi #-------------------------------------------------------------------- # On Mac OS X, we can build either with X11 or with Aqua #-------------------------------------------------------------------- if test "`uname -s`" = "Darwin" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use Aqua" >&5 printf %s "checking whether to use Aqua... " >&6; } # Check whether --enable-aqua was given. if test ${enable_aqua+y} then : enableval=$enable_aqua; tk_aqua=$enableval else $as_nop tk_aqua=no fi if test $tk_aqua = yes -o $tk_aqua = cocoa; then tk_aqua=yes if test $tcl_corefoundation = no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Aqua can only be used when CoreFoundation is available" >&5 printf "%s\n" "$as_me: WARNING: Aqua can only be used when CoreFoundation is available" >&2;} tk_aqua=no fi if test ! -d /System/Library/Frameworks/Cocoa.framework; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Aqua can only be used when Cocoa is available" >&5 printf "%s\n" "$as_me: WARNING: Aqua can only be used when Cocoa is available" >&2;} tk_aqua=no fi if test "`uname -r | awk -F. '{print $1}'`" -lt 9; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Aqua requires Mac OS X 10.5 or later" >&5 printf "%s\n" "$as_me: WARNING: Aqua requires Mac OS X 10.5 or later" >&2;} tk_aqua=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tk_aqua" >&5 printf "%s\n" "$tk_aqua" >&6; } if test $tk_aqua = no; then # check if weak linking whole libraries is possible. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -weak-l flag" >&5 printf %s "checking if ld accepts -weak-l flag... " >&6; } if test ${tcl_cv_ld_weak_l+y} then : printf %s "(cached) " >&6 else $as_nop hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-weak-lm" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <math.h> int main (void) { double f = sin(1.0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_ld_weak_l=yes else $as_nop tcl_cv_ld_weak_l=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_weak_l" >&5 printf "%s\n" "$tcl_cv_ld_weak_l" >&6; } fi ac_fn_c_check_header_compile "$LINENO" "AvailabilityMacros.h" "ac_cv_header_AvailabilityMacros_h" "$ac_includes_default" if test "x$ac_cv_header_AvailabilityMacros_h" = xyes then : printf "%s\n" "#define HAVE_AVAILABILITYMACROS_H 1" >>confdefs.h fi if test "$ac_cv_header_AvailabilityMacros_h" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if weak import is available" >&5 printf %s "checking if weak import is available... " >&6; } if test ${tcl_cv_cc_weak_import+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 #endif #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020 #endif int rand(void) __attribute__((weak_import)); int main (void) { rand(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_cc_weak_import=yes else $as_nop tcl_cv_cc_weak_import=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_weak_import" >&5 printf "%s\n" "$tcl_cv_cc_weak_import" >&6; } if test $tcl_cv_cc_weak_import = yes; then printf "%s\n" "#define HAVE_WEAK_IMPORT 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if Darwin SUSv3 extensions are available" >&5 printf %s "checking if Darwin SUSv3 extensions are available... " >&6; } if test ${tcl_cv_cc_darwin_c_source+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 #endif #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050 #endif #define _DARWIN_C_SOURCE 1 #include <sys/cdefs.h> int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_cc_darwin_c_source=yes else $as_nop tcl_cv_cc_darwin_c_source=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_darwin_c_source" >&5 printf "%s\n" "$tcl_cv_cc_darwin_c_source" >&6; } if test $tcl_cv_cc_darwin_c_source = yes; then printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h fi fi else tk_aqua=no fi if test $tk_aqua = yes; then printf "%s\n" "#define MAC_OSX_TK 1" >>confdefs.h LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore -framework Security" if test -d /System/Library/Frameworks/UserNotifications.framework; then LIBS="$LIBS -framework UserNotifications" fi if test -d "/System/Library/Frameworks/UniformTypeIdentifiers.framework"; then LIBS="$LIBS -framework UniformTypeIdentifiers" fi EXTRA_CC_SWITCHES='-x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then printf "%s\n" "#define TK_MAC_DEBUG 1" >>confdefs.h fi else #-------------------------------------------------------------------- # Locate the X11 header files and the X11 library archive. Try # the ac_path_x macro first, but if it doesn't find the X stuff # (e.g. because there's no xmkmf program) then check through # a list of possible directories. Under some conditions the # autoconf macro will return an include directory that contains # no include files, so double-check its result just to be safe. #-------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X" >&5 printf %s "checking for X... " >&6; } # Check whether --with-x was given. if test ${with_x+y} then : withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if test ${ac_cv_have_x+y} then : printf %s "(cached) " >&6 else $as_nop # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no # Do we need to do anything special at all? ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <X11/Xlib.h> int main (void) { XrmInitialize () ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : # We can compile and link X programs with no special options. ac_x_includes= ac_x_libraries= fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" # If that didn't work, only try xmkmf and file system searches # for native compilation. if test x"$ac_x_includes" = xno && test "$cross_compiling" = no then : rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' |
︙ | ︙ | |||
7242 7243 7244 7245 7246 7247 7248 | *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi | | | 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 | *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R7/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include |
︙ | ︙ | |||
7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 | /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R7 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include | > > | 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 | /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R7 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /opt/X11/include /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include |
︙ | ︙ | |||
7290 7291 7292 7293 7294 7295 7296 | if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <X11/Xlib.h> _ACEOF | | > | | | > | | | > > | | | | | | | | | > | | | | > | | | | | | | | | | | | > | | < < < | | > | | | | | > | | | 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 | if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <X11/Xlib.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # We can compile using X headers with no special include directory. ac_x_includes= else $as_nop for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.i conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <X11/Xlib.h> int main (void) { XrmInitialize () ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else $as_nop LIBS=$ac_save_LIBS for ac_dir in `printf "%s\n" "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no fi # Record the results. case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) : # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no" ;; #( *) : # Record where we found X for the cache. ac_cv_have_x="have_x=yes\ ac_x_includes='$ac_x_includes'\ ac_x_libraries='$ac_x_libraries'" ;; esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 printf "%s\n" "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 printf "%s\n" "libraries $x_libraries, headers $x_includes" >&6; } fi not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <X11/Xlib.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop not_really_there="yes" fi rm -f conftest.err conftest.i conftest.$ac_ext else if test ! -r $x_includes/X11/Xlib.h; then not_really_there="yes" fi fi fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X11 header files" >&5 printf %s "checking for X11 header files... " >&6; } found_xincludes="no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <X11/Xlib.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : found_xincludes="yes" else $as_nop found_xincludes="no" fi rm -f conftest.err conftest.i conftest.$ac_ext if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Xlib.h; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $i" >&5 printf "%s\n" "$i" >&6; } XINCLUDES=" -I$i" found_xincludes="yes" break fi done fi else if test "$x_includes" != ""; then XINCLUDES="-I$x_includes" found_xincludes="yes" fi fi if test "$found_xincludes" = "no"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: couldn't find any!" >&5 printf "%s\n" "couldn't find any!" >&6; } fi if test "$no_x" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X11 libraries" >&5 printf %s "checking for X11 libraries... " >&6; } XLIBSW=nope dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $i" >&5 printf "%s\n" "$i" >&6; } XLIBSW="-L$i -lX11" x_libraries="$i" break fi done else if test "$x_libraries" = ""; then XLIBSW=-lX11 else XLIBSW="-L$x_libraries -lX11" fi fi if test "$XLIBSW" = nope ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XCreateWindow in -lXwindow" >&5 printf %s "checking for XCreateWindow in -lXwindow... " >&6; } if test ${ac_cv_lib_Xwindow_XCreateWindow+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXwindow $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char XCreateWindow (); int main (void) { return XCreateWindow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xwindow_XCreateWindow=yes else $as_nop ac_cv_lib_Xwindow_XCreateWindow=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xwindow_XCreateWindow" >&5 printf "%s\n" "$ac_cv_lib_Xwindow_XCreateWindow" >&6; } if test "x$ac_cv_lib_Xwindow_XCreateWindow" = xyes then : XLIBSW=-lXwindow fi fi if test "$XLIBSW" = nope ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find any! Using -lX11." >&5 printf "%s\n" "could not find any! Using -lX11." >&6; } XLIBSW=-lX11 fi TK_WINDOWINGSYSTEM=X11 fi #-------------------------------------------------------------------- |
︙ | ︙ | |||
7545 7546 7547 7548 7549 7550 7551 | # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- if test $tk_aqua = no; then | | | | > | | | | > | | | | | > | | | | > | | | | | | | | | > | | | | | | > | < | | | > | | < < < | | > | | | | | | | < | | | | > | | < < < | | > | | | | | > | | | | 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 | # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- if test $tk_aqua = no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lXbsd" >&5 printf %s "checking for main in -lXbsd... " >&6; } if test ${ac_cv_lib_Xbsd_main+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXbsd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xbsd_main=yes else $as_nop ac_cv_lib_Xbsd_main=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xbsd_main" >&5 printf "%s\n" "$ac_cv_lib_Xbsd_main" >&6; } if test "x$ac_cv_lib_Xbsd_main" = xyes then : LIBS="$LIBS -lXbsd" fi fi #-------------------------------------------------------------------- # One more check related to the X libraries. The standard releases # of Ultrix don't support the "xauth" mechanism, so send won't work # unless TK_NO_SECURITY is defined. However, there are usually copies # of the MIT X server available as well, which do support xauth. # Check for the MIT stuff and use it if it exists. # # Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1) # because it can't deal with the "-" in the library name. #-------------------------------------------------------------------- if test -d /usr/include/mit -a $tk_aqua = no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking MIT X libraries" >&5 printf %s "checking MIT X libraries... " >&6; } tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I/usr/include/mit" tk_oldLibs=$LIBS LIBS="$LIBS -lX11-mit" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <X11/Xlib.h> int main (void) { XOpenDisplay(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } XLIBSW="-lX11-mit" XINCLUDES="-I/usr/include/mit" else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- # Check for freetype / fontconfig / Xft support. #-------------------------------------------------------------------- if test $tk_aqua = no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use xft" >&5 printf %s "checking whether to use xft... " >&6; } # Check whether --enable-xft was given. if test ${enable_xft+y} then : enableval=$enable_xft; enable_xft=$enableval else $as_nop enable_xft="default" fi XFT_CFLAGS="" XFT_LIBS="" if test "$enable_xft" = "no" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_xft" >&5 printf "%s\n" "$enable_xft" >&6; } else found_xft="yes" XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no" XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no" if test "$found_xft" = "no" ; then found_xft=yes XFT_CFLAGS=`pkg-config --cflags xft fontconfig 2>/dev/null` || found_xft="no" XFT_LIBS=`pkg-config --libs xft fontconfig 2>/dev/null` || found_xft="no" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $found_xft" >&5 printf "%s\n" "$found_xft" >&6; } if test "$found_xft" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" tk_oldLibs=$LIBS LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" ac_fn_c_check_header_compile "$LINENO" "X11/Xft/Xft.h" "ac_cv_header_X11_Xft_Xft_h" "#include <X11/Xlib.h> " if test "x$ac_cv_header_X11_Xft_Xft_h" = xyes then : else $as_nop found_xft=no fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi if test "$found_xft" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" tk_oldLibs=$LIBS LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XftFontOpen in -lXft" >&5 printf %s "checking for XftFontOpen in -lXft... " >&6; } if test ${ac_cv_lib_Xft_XftFontOpen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXft $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char XftFontOpen (); int main (void) { return XftFontOpen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xft_XftFontOpen=yes else $as_nop ac_cv_lib_Xft_XftFontOpen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xft_XftFontOpen" >&5 printf "%s\n" "$ac_cv_lib_Xft_XftFontOpen" >&6; } if test "x$ac_cv_lib_Xft_XftFontOpen" = xyes then : printf "%s\n" "#define HAVE_LIBXFT 1" >>confdefs.h LIBS="-lXft $LIBS" else $as_nop found_xft=no fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi if test "$found_xft" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" tk_oldLibs=$LIBS LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW -lfontconfig" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FcFontSort in -lfontconfig" >&5 printf %s "checking for FcFontSort in -lfontconfig... " >&6; } if test ${ac_cv_lib_fontconfig_FcFontSort+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lfontconfig $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char FcFontSort (); int main (void) { return FcFontSort (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_fontconfig_FcFontSort=yes else $as_nop ac_cv_lib_fontconfig_FcFontSort=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fontconfig_FcFontSort" >&5 printf "%s\n" "$ac_cv_lib_fontconfig_FcFontSort" >&6; } if test "x$ac_cv_lib_fontconfig_FcFontSort" = xyes then : XFT_LIBS="$XFT_LIBS -lfontconfig" fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi if test "$found_xft" = "no" ; then if test "$enable_xft" = "yes" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Can't find xft configuration, or xft is unusable" >&5 printf "%s\n" "$as_me: WARNING: Can't find xft configuration, or xft is unusable" >&2;} fi enable_xft=no XFT_CFLAGS="" XFT_LIBS="" else enable_xft=yes fi fi if test $enable_xft = "yes" ; then UNIX_FONT_OBJS=tkUnixRFont.o printf "%s\n" "#define HAVE_XFT 1" >>confdefs.h else UNIX_FONT_OBJS=tkUnixFont.o fi |
︙ | ︙ | |||
7828 7829 7830 7831 7832 7833 7834 | if test $tk_aqua = no; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES" tk_oldLibs=$LIBS LIBS="$tk_oldLibs $XLIBSW" xss_header_found=no xss_lib_found=no | | | | > | | | | | | > < | > | | | | > | | < < < | | > | | | | | > | | | | > | | < < < | | > | | | | | > | 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 | if test $tk_aqua = no; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES" tk_oldLibs=$LIBS LIBS="$tk_oldLibs $XLIBSW" xss_header_found=no xss_lib_found=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to try to use XScreenSaver" >&5 printf %s "checking whether to try to use XScreenSaver... " >&6; } # Check whether --enable-xss was given. if test ${enable_xss+y} then : enableval=$enable_xss; enable_xss=$enableval else $as_nop enable_xss=yes fi if test "$enable_xss" = "no" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_xss" >&5 printf "%s\n" "$enable_xss" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_xss" >&5 printf "%s\n" "$enable_xss" >&6; } ac_fn_c_check_header_compile "$LINENO" "X11/extensions/scrnsaver.h" "ac_cv_header_X11_extensions_scrnsaver_h" "#include <X11/Xlib.h> " if test "x$ac_cv_header_X11_extensions_scrnsaver_h" = xyes then : xss_header_found=yes fi ac_fn_c_check_func "$LINENO" "XScreenSaverQueryInfo" "ac_cv_func_XScreenSaverQueryInfo" if test "x$ac_cv_func_XScreenSaverQueryInfo" = xyes then : else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverQueryInfo in -lXext" >&5 printf %s "checking for XScreenSaverQueryInfo in -lXext... " >&6; } if test ${ac_cv_lib_Xext_XScreenSaverQueryInfo+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXext $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char XScreenSaverQueryInfo (); int main (void) { return XScreenSaverQueryInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xext_XScreenSaverQueryInfo=yes else $as_nop ac_cv_lib_Xext_XScreenSaverQueryInfo=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XScreenSaverQueryInfo" >&5 printf "%s\n" "$ac_cv_lib_Xext_XScreenSaverQueryInfo" >&6; } if test "x$ac_cv_lib_Xext_XScreenSaverQueryInfo" = xyes then : XLIBSW="$XLIBSW -lXext" xss_lib_found=yes else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverQueryInfo in -lXss" >&5 printf %s "checking for XScreenSaverQueryInfo in -lXss... " >&6; } if test ${ac_cv_lib_Xss_XScreenSaverQueryInfo+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXss -lXext $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char XScreenSaverQueryInfo (); int main (void) { return XScreenSaverQueryInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xss_XScreenSaverQueryInfo=yes else $as_nop ac_cv_lib_Xss_XScreenSaverQueryInfo=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xss_XScreenSaverQueryInfo" >&5 printf "%s\n" "$ac_cv_lib_Xss_XScreenSaverQueryInfo" >&6; } if test "x$ac_cv_lib_Xss_XScreenSaverQueryInfo" = xyes then : if test "$tcl_cv_ld_weak_l" = yes; then # On Darwin, weak link libXss if possible, # as it is only available on Tiger or later. XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext" else XLIBSW="$XLIBSW -lXss -lXext" |
︙ | ︙ | |||
7958 7959 7960 7961 7962 7963 7964 | fi fi if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then | | | | | > | | | | > | | | | | | > > > > > > | 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 | fi fi if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then printf "%s\n" "#define HAVE_XSS 1" >>confdefs.h fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- # Figure out whether "char" is unsigned. If so, set a # #define for __CHAR_UNSIGNED__. #-------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 printf %s "checking whether char is unsigned... " >&6; } if test ${ac_cv_c_char_unsigned+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { static int test_array [1 - 2 * !(((char) -1) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_char_unsigned=no else $as_nop ac_cv_c_char_unsigned=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5 printf "%s\n" "$ac_cv_c_char_unsigned" >&6; } if test $ac_cv_c_char_unsigned = yes; then printf "%s\n" "#define __CHAR_UNSIGNED__ 1" >>confdefs.h fi #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" eval "TK_LIB_FILE_TCL8=libtk${LIB_SUFFIX}" if test ${TCL_MAJOR_VERSION} = 8 ; then eval "TK_LIB_FILE=libtk${LIB_SUFFIX}" else eval "TK_LIB_FILE=libtcl9tk${LIB_SUFFIX}" fi eval "TK_LIB_FILE_TCL9=libtcl9tk${LIB_SUFFIX}" # tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed # since on some platforms TK_LIB_FILE contains shell escapes. eval "TK_LIB_FILE=${TK_LIB_FILE}" if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then |
︙ | ︙ | |||
8038 8039 8040 8041 8042 8043 8044 | # path name of the Tcl directory rather than "..": this is because # AIX remembers this path and will attempt to use it at run-time to look # up the Tcl library. if test "`uname -s`" = "Darwin" ; then if test "`uname -s`" = "Darwin" ; then | | | | > | | | | | | | | | | | > > | > | | > | > > > > > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 | # path name of the Tcl directory rather than "..": this is because # AIX remembers this path and will attempt to use it at run-time to look # up the Tcl library. if test "`uname -s`" = "Darwin" ; then if test "`uname -s`" = "Darwin" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to package libraries" >&5 printf %s "checking how to package libraries... " >&6; } # Check whether --enable-framework was given. if test ${enable_framework+y} then : enableval=$enable_framework; enable_framework=$enableval else $as_nop enable_framework=no fi if test $enable_framework = yes; then if test $SHARED_BUILD = 0; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Frameworks can only be built if --enable-shared is yes" >&5 printf "%s\n" "$as_me: WARNING: Frameworks can only be built if --enable-shared is yes" >&2;} enable_framework=no fi if test $tcl_corefoundation = no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Frameworks can only be used when CoreFoundation is available" >&5 printf "%s\n" "$as_me: WARNING: Frameworks can only be used when CoreFoundation is available" >&2;} enable_framework=no fi fi if test $enable_framework = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: framework" >&5 printf "%s\n" "framework" >&6; } FRAMEWORK_BUILD=1 else if test $SHARED_BUILD = 1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: shared library" >&5 printf "%s\n" "shared library" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static library" >&5 printf "%s\n" "static library" >&6; } fi FRAMEWORK_BUILD=0 fi fi TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk '{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}'`" TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}/${TK_LIB_FILE}" -unexported_symbols_list $$(f=$(TK_LIB_FILE).E && nm -gp tkMacOSX*.o 2>/dev/null | awk "/^[0-9a-f]+ . \.objc/ {print \$$3}" > $$f && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[^_] >> $$f && echo $$f)' echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000' TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist' EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist' EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -sectcreate __TEXT __credits_html Credits.html' if test "${SHARED_BUILD}" = "0"; then EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -ObjC' fi ac_config_files="$ac_config_files Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in" for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done TK_YEAR="`date +%Y`" fi if test "$FRAMEWORK_BUILD" = "1" ; then printf "%s\n" "#define TK_FRAMEWORK 1" >>confdefs.h # Construct a fake local framework structure to make linking with # '-framework Tk' and running of tktest work ac_config_commands="$ac_config_commands Tk.framework" LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" if test "${libdir}" = '${exec_prefix}/lib'; then # override libdir default libdir="/Library/Frameworks" fi if test ${TCL_MAJOR_VERSION} = 8 ; then TK_LIB_FILE="Tk" else TK_LIB_FILE="Tk" fi TK_LIB_FILE_TCL8="Tk" TK_LIB_FILE_TCL9="Tk" TK_LIB_FLAG="-framework Tk" TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk" TK_LIB_SPEC="-F${libdir} -framework Tk" libdir="${libdir}/Tk.framework/Versions/\${VERSION}" TK_LIBRARY="${libdir}/Resources/Scripts" TK_PKG_DIR="Resources/Scripts" TK_RSRC_FILE="Tk.rsrc" WISH_RSRC_FILE="Wish.rsrc" includedir="${libdir}/Headers" PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders" HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk" EXTRA_INSTALL="install-private-headers html-tk" EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html' EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Credits.html "$(LIB_INSTALL_DIR)/Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"' if test $tk_aqua = yes; then EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'/" && $(INSTALL_DATA_DIR) "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' bindir="${libdir}/Resources/Wish.app/Contents/MacOS" EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA_DIR) "$(BIN_INSTALL_DIR)/../Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) Credits.html "$(BIN_INSTALL_DIR)/../Resources"' fi EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."' # Don't use AC_DEFINE for the following as the framework version define # needs to go into the Makefile even when using autoheader, so that we # can pick up a potential make override of VERSION. Also, don't put this # into CFLAGS as it should not go into tkConfig.sh EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"' else if test $tk_aqua = yes; then EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done' fi # libdir must be a fully qualified path and not ${exec_prefix}/lib eval libdir="$libdir" TK_LIB_FLAG="-l" if test "${TCL_MAJOR_VERSION}" -gt 8 ; then TK_LIB_FLAG="${TK_LIB_FLAG}tcl9" fi if test "${ac_cv_cygwin}" = "yes" -a "$SHARED_BUILD" = "1"; then TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`" TK_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win ${TK_LIB_FLAG}" else if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then TK_LIB_FLAG="${TK_LIB_FLAG}tk${TK_VERSION}" else TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`" fi TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" fi TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" fi #-------------------------------------------------------------------- # Zipfs support - Tip 430 #-------------------------------------------------------------------- # Check whether --enable-zipfs was given. if test ${enable_zipfs+y} then : enableval=$enable_zipfs; tcl_ok=$enableval else $as_nop tcl_ok=yes fi if test "$tcl_ok" = "yes" -a "x$enable_framework" != "xyes"; then # # Find a native compiler # # Put a plausible default for CC_FOR_BUILD in Makefile. if test -z "$CC_FOR_BUILD"; then if test "x$cross_compiling" = "xno"; then CC_FOR_BUILD='$(CC)' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 printf %s "checking for gcc... " >&6; } if test ${ac_cv_path_cc+y} then : printf %s "(cached) " >&6 else $as_nop search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/gcc 2> /dev/null` \ `ls -r $dir/gcc 2> /dev/null` ; do if test x"$ac_cv_path_cc" = x ; then if test -f "$j" ; then ac_cv_path_cc=$j break fi fi done done fi fi fi # Also set EXEEXT_FOR_BUILD. if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' OBJEXT_FOR_BUILD='$(OBJEXT)' else OBJEXT_FOR_BUILD='.no' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 printf %s "checking for build system executable suffix... " >&6; } if test ${bfd_cv_build_exeext+y} then : printf %s "(cached) " >&6 else $as_nop rm -f conftest* echo 'int main () { return 0; }' > conftest.c bfd_cv_build_exeext= ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; esac done rm -f conftest* test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5 printf "%s\n" "$bfd_cv_build_exeext" >&6; } EXEEXT_FOR_BUILD="" test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} fi # # Find a native zip implementation # MACHER_PROG="" ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" ZIP_INSTALL_OBJS="" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macher" >&5 printf %s "checking for macher... " >&6; } if test ${ac_cv_path_macher+y} then : printf %s "(cached) " >&6 else $as_nop search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/macher 2> /dev/null` \ `ls -r $dir/macher 2> /dev/null` ; do if test x"$ac_cv_path_macher" = x ; then if test -f "$j" ; then ac_cv_path_macher=$j break fi fi done done fi if test -f "$ac_cv_path_macher" ; then MACHER_PROG="$ac_cv_path_macher" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MACHER_PROG" >&5 printf "%s\n" "$MACHER_PROG" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found macher in environment" >&5 printf "%s\n" "Found macher in environment" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 printf %s "checking for zip... " >&6; } if test ${ac_cv_path_zip+y} then : printf %s "(cached) " >&6 else $as_nop search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/zip 2> /dev/null` \ `ls -r $dir/zip 2> /dev/null` ; do if test x"$ac_cv_path_zip" = x ; then if test -f "$j" ; then ac_cv_path_zip=$j break fi fi done done fi if test -f "$ac_cv_path_zip" ; then ZIP_PROG="$ac_cv_path_zip" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 printf "%s\n" "$ZIP_PROG" >&6; } ZIP_PROG_OPTIONS="-rq" ZIP_PROG_VFSSEARCH="*" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5 printf "%s\n" "Found INFO Zip in environment" >&6; } # Use standard arguments for zip else # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="-o -r" ZIP_PROG_VFSSEARCH="*" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH. Building minizip" >&5 printf "%s\n" "No zip found on PATH. Building minizip" >&6; } fi ZIPFS_BUILD=1 TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip else ZIPFS_BUILD=0 TK_ZIP_FILE= fi # Do checking message here to not mess up interleaved configure output { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 printf %s "checking for building with zipfs... " >&6; } if test "${ZIPFS_BUILD}" = 1; then if test "${SHARED_BUILD}" = 0; then ZIPFS_BUILD=2; printf "%s\n" "#define ZIPFS_BUILD 2" >>confdefs.h INSTALL_LIBRARIES=install-demos { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else printf "%s\n" "#define ZIPFS_BUILD 1" >>confdefs.h \ INSTALL_LIBRARIES=install-demos { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } INSTALL_LIBRARIES=install-libraries INSTALL_MSGS=install-msgs fi #-------------------------------------------------------------------- # The statements below define various symbols relating to Tk # stub support. #-------------------------------------------------------------------- # Replace ${VERSION} with contents of ${TK_VERSION} |
︙ | ︙ | |||
8178 8179 8180 8181 8182 8183 8184 | # Install time header dir can be set via --includedir eval "TK_INCLUDE_SPEC=\"-I${includedir}\"" #------------------------------------------------------------------------ # Demo dir #------------------------------------------------------------------------ | | > > > | 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 | # Install time header dir can be set via --includedir eval "TK_INCLUDE_SPEC=\"-I${includedir}\"" #------------------------------------------------------------------------ # Demo dir #------------------------------------------------------------------------ if test x"${DEMO_DIR}" = x then : DEMO_DIR='$(TK_LIBRARY)/demos' fi eval "TK_DEMO_DIR=\"`echo ${DEMO_DIR} | tr '()' '{}'`\"" eval "TK_DEMO_DIR=\"`echo ${TK_DEMO_DIR} | tr '()' '{}'`\"" #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ TK_SHARED_BUILD=${SHARED_BUILD} |
︙ | ︙ | |||
8272 8273 8274 8275 8276 8277 8278 | # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( | | | | 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 | # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac |
︙ | ︙ | |||
8303 8304 8305 8306 8307 8308 8309 | esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear | | | | | | | 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 | esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' |
︙ | ︙ | |||
8379 8380 8381 8382 8383 8384 8385 | ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' | | | | | 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 | ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS="" : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. |
︙ | ︙ | |||
8421 8422 8423 8424 8425 8426 8427 | cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh | > | > | > > > > > > > > < < < < < < < < | | < | | < < < < < < | < < < < < < < | > > | < < > | | > > > > > > > > > | > > > > | < < < < < < < > | > > > | | < < < < < < < < < < < < < < < < < < < < | | > | 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 | cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { |
︙ | ︙ | |||
8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 | # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. | > | > | | > | | 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 | # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith |
︙ | ︙ | |||
8642 8643 8644 8645 8646 8647 8648 | as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || | | | 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 | as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q |
︙ | ︙ | |||
8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 | # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null | > > > > > > > > > > | 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 | # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null |
︙ | ︙ | |||
8718 8719 8720 8721 8722 8723 8724 | case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( | | | | 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 | case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q |
︙ | ︙ | |||
8790 8791 8792 8793 8794 8795 8796 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by tk $as_me 8.7, which was | | | 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by tk $as_me 8.7, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ |
︙ | ︙ | |||
8843 8844 8845 8846 8847 8848 8849 8850 | Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | > > | | | | 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 | Configuration commands: $config_commands Report bugs to the package provider." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ tk config.status 8.7 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF |
︙ | ︙ | |||
8887 8888 8889 8890 8891 8892 8893 | esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) | | | | | | 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 | esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; |
︙ | ︙ | |||
8929 8930 8931 8932 8933 8934 8935 | fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift | | | > | | | 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 | fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # VERSION=${TK_VERSION} && tk_aqua=${tk_aqua} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Tk-Info.plist") CONFIG_FILES="$CONFIG_FILES Tk-Info.plist:../macosx/Tk-Info.plist.in" ;; "Wish-Info.plist") CONFIG_FILES="$CONFIG_FILES Wish-Info.plist:../macosx/Wish-Info.plist.in" ;; "Credits.html") CONFIG_FILES="$CONFIG_FILES Credits.html:../macosx/Credits.html.in" ;; "Tk.framework") CONFIG_COMMANDS="$CONFIG_COMMANDS Tk.framework" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;; "tkConfig.sh") CONFIG_FILES="$CONFIG_FILES tkConfig.sh:../unix/tkConfig.sh.in" ;; "tk.pc") CONFIG_FILES="$CONFIG_FILES tk.pc:../unix/tk.pc.in" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: |
︙ | ︙ | |||
9207 9208 9209 9210 9211 9212 9213 | test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac | | | | | | | | 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 | test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q |
︙ | ︙ | |||
9266 9267 9268 9269 9270 9271 9272 | s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) | | | | 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 | s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix |
︙ | ︙ | |||
9321 9322 9323 9324 9325 9326 9327 | /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) | | | | 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 | /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g |
︙ | ︙ | |||
9364 9365 9366 9367 9368 9369 9370 | eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && | | | | | | 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 | eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "Tk.framework":C) n=Tk && f=$n.framework && v=Versions/$VERSION && |
︙ | ︙ | |||
9427 9428 9429 9430 9431 9432 9433 | $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then | | | > | 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 | $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi |
Changes to unix/configure.ac.
|
| | | | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ! /bin/bash -norc dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. AC_INIT([tk],[8.7]) AC_PREREQ([2.69]) dnl This is only used when included from macosx/configure.ac m4_ifdef([SC_USE_CONFIG_HEADERS], [ AC_CONFIG_HEADERS([tkConfig.h:../unix/tkConfig.h.in]) AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TK_CONFIG_H -imacros tkConfig.h"]) AH_TOP([ #ifndef _TKCONFIG #define _TKCONFIG]) AH_BOTTOM([ /* Undef unused package specific autoheader defines so that we can * include both tclConfig.h and tkConfig.h at the same time: */ /* override */ #undef PACKAGE_NAME /* override */ #undef PACKAGE_TARNAME /* override */ #undef PACKAGE_VERSION /* override */ #undef PACKAGE_STRING #endif /* _TKCONFIG */]) ]) TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 TK_PATCH_LEVEL="a6" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" #-------------------------------------------------------------------- # Find and load the tclConfig.sh file #-------------------------------------------------------------------- |
︙ | ︙ | |||
88 89 90 91 92 93 94 | # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" && test -n "$GCC"; then AC_CACHE_CHECK([if the compiler understands -pipe], tcl_cv_cc_pipe, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" && test -n "$GCC"; then AC_CACHE_CHECK([if the compiler understands -pipe], tcl_cv_cc_pipe, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_pipe=yes],[tcl_cv_cc_pipe=no]) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi #------------------------------------------------------------------------ |
︙ | ︙ | |||
141 142 143 144 145 146 147 | if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib" fi if test "$TCL_PREFIX" != "$prefix"; then AC_MSG_WARN([ Different --prefix selected for Tk and Tcl! | | | < | < < | < < < < < < < < < < < < < < | < < < < < < < < < < < < < < | < | < | < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | > > > > > > | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib" fi if test "$TCL_PREFIX" != "$prefix"; then AC_MSG_WARN([ Different --prefix selected for Tk and Tcl! [[package require tk]] may not work correctly in tclsh.]) fi #-------------------------------------------------------------------- # Include sys/select.h if it exists and if it supplies things # that appear to be useful and aren't already in sys/types.h. # This appears to be true only on the RS/6000 under AIX. Some # systems like OSF/1 have a sys/select.h that's of no use, and # other systems like SCO UNIX have a sys/select.h that's # pernicious. If "fd_set" isn't defined anywhere then set a # special flag. #-------------------------------------------------------------------- AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[fd_set readMask, writeMask;]])],[tcl_cv_type_fd_set=yes],[tcl_cv_type_fd_set=no])]) tk_ok=$tcl_cv_type_fd_set if test $tk_ok = no; then AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [ AC_EGREP_HEADER(fd_mask, sys/select.h, tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)]) if test $tcl_cv_grep_fd_mask = present; then AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Should we include <sys/select.h>?]) tk_ok=yes fi fi if test $tk_ok = no; then AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?]) fi #------------------------------------------------------------------------------ # Find out all about time handling differences. #------------------------------------------------------------------------------ AC_CHECK_HEADERS_ONCE([sys/time.h]) #-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_CHECK_TYPES([intptr_t, uintptr_t],,,[[ #include <stdint.h> ]]) #------------------------------------------- # In OS/390 struct pwd has no pw_gecos field #------------------------------------------- AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pwd.h>]], [[struct passwd pwd; (void)pwd.pw_gecos;]])],[tcl_cv_pwd_pw_gecos=yes],[tcl_cv_pwd_pw_gecos=no])]) if test $tcl_cv_pwd_pw_gecos = yes; then AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?]) fi #-------------------------------------------------------------------- # On Mac OS X, we can build either with X11 or with Aqua #-------------------------------------------------------------------- if test "`uname -s`" = "Darwin" ; then AC_MSG_CHECKING([whether to use Aqua]) AC_ARG_ENABLE(aqua, AS_HELP_STRING([--enable-aqua=yes|no], [use Aqua windowingsystem on Mac OS X (default: no)]), [tk_aqua=$enableval], [tk_aqua=no]) if test $tk_aqua = yes -o $tk_aqua = cocoa; then tk_aqua=yes if test $tcl_corefoundation = no; then AC_MSG_WARN([Aqua can only be used when CoreFoundation is available]) tk_aqua=no fi if test ! -d /System/Library/Frameworks/Cocoa.framework; then AC_MSG_WARN([Aqua can only be used when Cocoa is available]) tk_aqua=no fi if test "`uname -r | awk -F. '{print [$]1}'`" -lt 9; then AC_MSG_WARN([Aqua requires Mac OS X 10.5 or later]) tk_aqua=no fi fi AC_MSG_RESULT([$tk_aqua]) if test $tk_aqua = no; then # check if weak linking whole libraries is possible. AC_CACHE_CHECK([if ld accepts -weak-l flag], tcl_cv_ld_weak_l, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-weak-lm" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[double f = sin(1.0);]])], [tcl_cv_ld_weak_l=yes],[tcl_cv_ld_weak_l=no]) LDFLAGS=$hold_ldflags]) fi AC_CHECK_HEADERS(AvailabilityMacros.h) if test "$ac_cv_header_AvailabilityMacros_h" = yes; then AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 #endif #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020 #endif int rand(void) __attribute__((weak_import)); ]], [[rand();]])], [tcl_cv_cc_weak_import=yes],[tcl_cv_cc_weak_import=no]) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_weak_import = yes; then AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?]) fi AC_CACHE_CHECK([if Darwin SUSv3 extensions are available], tcl_cv_cc_darwin_c_source, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 #endif #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050 #endif #define _DARWIN_C_SOURCE 1 #include <sys/cdefs.h> ]], [[]])],[tcl_cv_cc_darwin_c_source=yes],[tcl_cv_cc_darwin_c_source=no]) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_darwin_c_source = yes; then AC_DEFINE(_DARWIN_C_SOURCE, 1, [Are Darwin SUSv3 extensions available?]) fi fi else tk_aqua=no fi if test $tk_aqua = yes; then AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?]) LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore -framework Security" if test -d /System/Library/Frameworks/UserNotifications.framework; then LIBS="$LIBS -framework UserNotifications" fi if test -d "/System/Library/Frameworks/UniformTypeIdentifiers.framework"; then LIBS="$LIBS -framework UniformTypeIdentifiers" fi EXTRA_CC_SWITCHES='-x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) fi else #-------------------------------------------------------------------- # Locate the X11 header files and the X11 library archive. Try |
︙ | ︙ | |||
417 418 419 420 421 422 423 | if test -d /usr/include/mit -a $tk_aqua = no; then AC_MSG_CHECKING([MIT X libraries]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I/usr/include/mit" tk_oldLibs=$LIBS LIBS="$LIBS -lX11-mit" | | | | | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | if test -d /usr/include/mit -a $tk_aqua = no; then AC_MSG_CHECKING([MIT X libraries]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I/usr/include/mit" tk_oldLibs=$LIBS LIBS="$LIBS -lX11-mit" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <X11/Xlib.h> ]], [[ XOpenDisplay(0); ]])],[ AC_MSG_RESULT([yes]) XLIBSW="-lX11-mit" XINCLUDES="-I/usr/include/mit" ],[AC_MSG_RESULT(no)]) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- # Check for freetype / fontconfig / Xft support. #-------------------------------------------------------------------- if test $tk_aqua = no; then AC_MSG_CHECKING([whether to use xft]) AC_ARG_ENABLE(xft, AS_HELP_STRING([--enable-xft], [use freetype/fontconfig/xft (default: on)]), [enable_xft=$enableval], [enable_xft="default"]) XFT_CFLAGS="" XFT_LIBS="" if test "$enable_xft" = "no" ; then AC_MSG_RESULT([$enable_xft]) else |
︙ | ︙ | |||
533 534 535 536 537 538 539 | CFLAGS="$CFLAGS $XINCLUDES" tk_oldLibs=$LIBS LIBS="$tk_oldLibs $XLIBSW" xss_header_found=no xss_lib_found=no AC_MSG_CHECKING([whether to try to use XScreenSaver]) AC_ARG_ENABLE(xss, | | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | CFLAGS="$CFLAGS $XINCLUDES" tk_oldLibs=$LIBS LIBS="$tk_oldLibs $XLIBSW" xss_header_found=no xss_lib_found=no AC_MSG_CHECKING([whether to try to use XScreenSaver]) AC_ARG_ENABLE(xss, AS_HELP_STRING([--enable-xss], [use XScreenSaver for activity timer (default: on)]), [enable_xss=$enableval], [enable_xss=yes]) if test "$enable_xss" = "no" ; then AC_MSG_RESULT([$enable_xss]) else AC_MSG_RESULT([$enable_xss]) AC_CHECK_HEADER(X11/extensions/scrnsaver.h, [ |
︙ | ︙ | |||
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" eval "TK_LIB_FILE=libtk${LIB_SUFFIX}" # tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed # since on some platforms TK_LIB_FILE contains shell escapes. eval "TK_LIB_FILE=${TK_LIB_FILE}" if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then | > > > > > > | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" eval "TK_LIB_FILE_TCL8=libtk${LIB_SUFFIX}" if test ${TCL_MAJOR_VERSION} = 8 ; then eval "TK_LIB_FILE=libtk${LIB_SUFFIX}" else eval "TK_LIB_FILE=libtcl9tk${LIB_SUFFIX}" fi eval "TK_LIB_FILE_TCL9=libtcl9tk${LIB_SUFFIX}" # tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed # since on some platforms TK_LIB_FILE contains shell escapes. eval "TK_LIB_FILE=${TK_LIB_FILE}" if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then |
︙ | ︙ | |||
613 614 615 616 617 618 619 | if test "`uname -s`" = "Darwin" ; then SC_ENABLE_FRAMEWORK TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`" TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}/${TK_LIB_FILE}" -unexported_symbols_list $$(f=$(TK_LIB_FILE).E && nm -gp tkMacOSX*.o 2>/dev/null | awk "/^[[0-9a-f]]+ . \.objc/ {print \$$3}" > $$f && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[[^_]] >> $$f && echo $$f)' echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000' TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist' EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist' | > > | > | | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | if test "`uname -s`" = "Darwin" ; then SC_ENABLE_FRAMEWORK TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`" TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}/${TK_LIB_FILE}" -unexported_symbols_list $$(f=$(TK_LIB_FILE).E && nm -gp tkMacOSX*.o 2>/dev/null | awk "/^[[0-9a-f]]+ . \.objc/ {print \$$3}" > $$f && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[[^_]] >> $$f && echo $$f)' echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000' TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist' EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist' EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -sectcreate __TEXT __credits_html Credits.html' if test "${SHARED_BUILD}" = "0"; then EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -ObjC' fi AC_CONFIG_FILES([Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in]) for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done TK_YEAR="`date +%Y`" fi if test "$FRAMEWORK_BUILD" = "1" ; then AC_DEFINE(TK_FRAMEWORK, 1, [Is Tk built as a framework?]) # Construct a fake local framework structure to make linking with |
︙ | ︙ | |||
636 637 638 639 640 641 642 | unset n f v ], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}) LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" if test "${libdir}" = '${exec_prefix}/lib'; then # override libdir default libdir="/Library/Frameworks" fi | > | > > > > > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | unset n f v ], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}) LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" if test "${libdir}" = '${exec_prefix}/lib'; then # override libdir default libdir="/Library/Frameworks" fi if test ${TCL_MAJOR_VERSION} = 8 ; then TK_LIB_FILE="Tk" else TK_LIB_FILE="Tk" fi TK_LIB_FILE_TCL8="Tk" TK_LIB_FILE_TCL9="Tk" TK_LIB_FLAG="-framework Tk" TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk" TK_LIB_SPEC="-F${libdir} -framework Tk" libdir="${libdir}/Tk.framework/Versions/\${VERSION}" TK_LIBRARY="${libdir}/Resources/Scripts" TK_PKG_DIR="Resources/Scripts" TK_RSRC_FILE="Tk.rsrc" WISH_RSRC_FILE="Wish.rsrc" includedir="${libdir}/Headers" PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders" HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk" EXTRA_INSTALL="install-private-headers html-tk" EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html' EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Credits.html "$(LIB_INSTALL_DIR)/Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"' if test $tk_aqua = yes; then EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'/" && $(INSTALL_DATA_DIR) "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' bindir="${libdir}/Resources/Wish.app/Contents/MacOS" EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA_DIR) "$(BIN_INSTALL_DIR)/../Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) Credits.html "$(BIN_INSTALL_DIR)/../Resources"' fi EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."' # Don't use AC_DEFINE for the following as the framework version define # needs to go into the Makefile even when using autoheader, so that we # can pick up a potential make override of VERSION. Also, don't put this # into CFLAGS as it should not go into tkConfig.sh EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"' else if test $tk_aqua = yes; then EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done' fi # libdir must be a fully qualified path and not ${exec_prefix}/lib eval libdir="$libdir" TK_LIB_FLAG="-l" if test "${TCL_MAJOR_VERSION}" -gt 8 ; then TK_LIB_FLAG="${TK_LIB_FLAG}tcl9" fi if test "${ac_cv_cygwin}" = "yes" -a "$SHARED_BUILD" = "1"; then TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`" TK_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win ${TK_LIB_FLAG}" else if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then TK_LIB_FLAG="${TK_LIB_FLAG}tk${TK_VERSION}" else TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`" fi TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" fi TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" fi #-------------------------------------------------------------------- # Zipfs support - Tip 430 #-------------------------------------------------------------------- AC_ARG_ENABLE(zipfs, AS_HELP_STRING([--enable-zipfs],[build with Zipfs support (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) if test "$tcl_ok" = "yes" -a "x$enable_framework" != "xyes"; then # # Find a native compiler # AX_CC_FOR_BUILD # # Find a native zip implementation # SC_ZIPFS_SUPPORT ZIPFS_BUILD=1 TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip else ZIPFS_BUILD=0 TK_ZIP_FILE= fi # Do checking message here to not mess up interleaved configure output AC_MSG_CHECKING([for building with zipfs]) if test "${ZIPFS_BUILD}" = 1; then if test "${SHARED_BUILD}" = 0; then ZIPFS_BUILD=2; AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) INSTALL_LIBRARIES=install-demos AC_MSG_RESULT([yes]) else AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ INSTALL_LIBRARIES=install-demos AC_MSG_RESULT([yes]) fi else AC_MSG_RESULT([no]) INSTALL_LIBRARIES=install-libraries INSTALL_MSGS=install-msgs fi AC_SUBST(ZIPFS_BUILD) AC_SUBST(TK_ZIP_FILE) AC_SUBST(INSTALL_LIBRARIES) AC_SUBST(INSTALL_MSGS) #-------------------------------------------------------------------- # The statements below define various symbols relating to Tk # stub support. #-------------------------------------------------------------------- # Replace ${VERSION} with contents of ${TK_VERSION} |
︙ | ︙ | |||
733 734 735 736 737 738 739 740 741 742 743 744 745 746 | AC_SUBST(TK_VERSION) AC_SUBST(TK_MAJOR_VERSION) AC_SUBST(TK_MINOR_VERSION) AC_SUBST(TK_PATCH_LEVEL) AC_SUBST(TK_YEAR) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_LIB_FLAG) AC_SUBST(TK_LIB_SPEC) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) AC_SUBST(TK_STUB_LIB_SPEC) AC_SUBST(TK_STUB_LIB_PATH) AC_SUBST(TK_INCLUDE_SPEC) | > > | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | AC_SUBST(TK_VERSION) AC_SUBST(TK_MAJOR_VERSION) AC_SUBST(TK_MINOR_VERSION) AC_SUBST(TK_PATCH_LEVEL) AC_SUBST(TK_YEAR) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_LIB_FILE_TCL8) AC_SUBST(TK_LIB_FILE_TCL9) AC_SUBST(TK_LIB_FLAG) AC_SUBST(TK_LIB_SPEC) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) AC_SUBST(TK_STUB_LIB_SPEC) AC_SUBST(TK_STUB_LIB_PATH) AC_SUBST(TK_INCLUDE_SPEC) |
︙ | ︙ |
Changes to unix/installManPage.
︙ | ︙ | |||
113 114 115 116 117 118 119 | if test -z "$First" ; then First=$Target sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \ $ManPage > "$Dir/$First" chmod 644 "$Dir/$First" $Gzip "$Dir/$First" else | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 | if test -z "$First" ; then First=$Target sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \ $ManPage > "$Dir/$First" chmod 644 "$Dir/$First" $Gzip "$Dir/$First" else ln $SymOrLoc"$First$Gz" "$Dir/$Target$Gz" fi done ######################################################################## exit 0 |
Changes to unix/tcl.m4.
︙ | ︙ | |||
24 25 26 27 28 29 30 | # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true AC_ARG_WITH(tcl, | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true AC_ARG_WITH(tcl, AS_HELP_STRING([--with-tcl], [directory containing tcl configuration (tclConfig.sh)]), [with_tclconfig="${withval}"]) AC_MSG_CHECKING([for Tcl configuration]) AC_CACHE_VAL(ac_cv_c_tclconfig,[ # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case "${with_tclconfig}" in */tclConfig.sh ) |
︙ | ︙ | |||
157 158 159 160 161 162 163 | # the alternative search directory is invoked by --with-tk # if test x"${no_tk}" = x ; then # we reset no_tk in case something fails here no_tk=true AC_ARG_WITH(tk, | | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | # the alternative search directory is invoked by --with-tk # if test x"${no_tk}" = x ; then # we reset no_tk in case something fails here no_tk=true AC_ARG_WITH(tk, AS_HELP_STRING([--with-tk], [directory containing tk configuration (tkConfig.sh)]), [with_tkconfig="${withval}"]) AC_MSG_CHECKING([for Tk configuration]) AC_CACHE_VAL(ac_cv_c_tkconfig,[ # First check to see if --with-tkconfig was specified. if test x"${with_tkconfig}" != x ; then case "${with_tkconfig}" in */tkConfig.sh ) |
︙ | ︙ | |||
504 505 506 507 508 509 510 | # Sets the following vars: # SHARED_BUILD Value of 1 or 0 #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SHARED], [ AC_MSG_CHECKING([how to build libraries]) AC_ARG_ENABLE(shared, | | < < < < < < < < | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | # Sets the following vars: # SHARED_BUILD Value of 1 or 0 #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SHARED], [ AC_MSG_CHECKING([how to build libraries]) AC_ARG_ENABLE(shared, AS_HELP_STRING([--enable-shared], [build and link with shared libraries (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) if test "$tcl_ok" = "yes" ; then AC_MSG_RESULT([shared]) SHARED_BUILD=1 else AC_MSG_RESULT([static]) SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) |
︙ | ︙ | |||
547 548 549 550 551 552 553 | # FRAMEWORK_BUILD Value of 1 or 0 #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_FRAMEWORK], [ if test "`uname -s`" = "Darwin" ; then AC_MSG_CHECKING([how to package libraries]) AC_ARG_ENABLE(framework, | | | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | # FRAMEWORK_BUILD Value of 1 or 0 #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_FRAMEWORK], [ if test "`uname -s`" = "Darwin" ; then AC_MSG_CHECKING([how to package libraries]) AC_ARG_ENABLE(framework, AS_HELP_STRING([--enable-framework], [package shared libraries in MacOSX frameworks (default: off)]), [enable_framework=$enableval], [enable_framework=no]) if test $enable_framework = yes; then if test $SHARED_BUILD = 0; then AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes]) enable_framework=no fi |
︙ | ︙ | |||
605 606 607 608 609 610 611 | # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true # Sets to $(LDFLAGS_OPTIMIZE) if false #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SYMBOLS], [ AC_MSG_CHECKING([for build with symbols]) AC_ARG_ENABLE(symbols, | | | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true # Sets to $(LDFLAGS_OPTIMIZE) if false #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SYMBOLS], [ AC_MSG_CHECKING([for build with symbols]) AC_ARG_ENABLE(symbols, AS_HELP_STRING([--enable-symbols], [build with debugging symbols (default: off)]), [tcl_ok=$enableval], [tcl_ok=no]) # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' AC_DEFINE(NDEBUG, 1, [Is no debugging enabled?]) |
︙ | ︙ | |||
664 665 666 667 668 669 670 | # # Defines the following vars: # HAVE_LANGINFO Triggers use of nl_langinfo if defined. #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_LANGINFO], [ AC_ARG_ENABLE(langinfo, | | | | | 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | # # Defines the following vars: # HAVE_LANGINFO Triggers use of nl_langinfo if defined. #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_LANGINFO], [ AC_ARG_ENABLE(langinfo, AS_HELP_STRING([--enable-langinfo], [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]), [langinfo_ok=$enableval], [langinfo_ok=yes]) HAVE_LANGINFO=0 if test "$langinfo_ok" = "yes"; then AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no]) fi AC_MSG_CHECKING([whether to use nl_langinfo]) if test "$langinfo_ok" = "yes"; then AC_CACHE_VAL(tcl_cv_langinfo_h, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])], [tcl_cv_langinfo_h=yes], [tcl_cv_langinfo_h=no])]) AC_MSG_RESULT([$tcl_cv_langinfo_h]) if test $tcl_cv_langinfo_h = yes; then AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?]) fi else AC_MSG_RESULT([$langinfo_ok]) fi |
︙ | ︙ | |||
716 717 718 719 720 721 722 | # according to the user's selection. # #-------------------------------------------------------------------- AC_DEFUN([SC_CONFIG_MANPAGES], [ AC_MSG_CHECKING([whether to use symlinks for manpages]) AC_ARG_ENABLE(man-symlinks, | | | | | | | | > | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | # according to the user's selection. # #-------------------------------------------------------------------- AC_DEFUN([SC_CONFIG_MANPAGES], [ AC_MSG_CHECKING([whether to use symlinks for manpages]) AC_ARG_ENABLE(man-symlinks, AS_HELP_STRING([--enable-man-symlinks], [use symlinks for the manpages (default: off)]), [test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks"], [enableval="no"]) AC_MSG_RESULT([$enableval]) AC_MSG_CHECKING([whether to compress the manpages]) AC_ARG_ENABLE(man-compression, AS_HELP_STRING([--enable-man-compression=PROG], [compress the manpages with PROG (default: off)]), [case $enableval in yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);; no) ;; *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";; esac], [enableval="no"]) AC_MSG_RESULT([$enableval]) if test "$enableval" != "no"; then AC_MSG_CHECKING([for compressed file suffix]) touch TeST $enableval TeST Z=`ls TeST* | sed 's/^....//'` rm -f TeST* MAN_FLAGS="$MAN_FLAGS --extension $Z" AC_MSG_RESULT([$Z]) fi AC_MSG_CHECKING([whether to add a package name suffix for the manpages]) AC_ARG_ENABLE(man-suffix, AS_HELP_STRING([--enable-man-suffix=STRING], [use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]), [case $enableval in yes) enableval="AC_PACKAGE_NAME" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; no) ;; *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; esac], [enableval="no"]) AC_MSG_RESULT([$enableval]) AC_SUBST(MAN_FLAGS) ]) #-------------------------------------------------------------------- # SC_CONFIG_SYSTEM # # Determine what the system is (some things cannot be easily checked # on a feature-driven basis, alas). This can usually be done via the # "uname" command. # # Arguments: # none # # Results: # Defines the following var: # # system - System/platform/version identification code. # #-------------------------------------------------------------------- AC_DEFUN([SC_CONFIG_SYSTEM], [ AC_CACHE_CHECK([system version], tcl_cv_sys_version, [ if test "${TEA_PLATFORM}" = "windows" ; then tcl_cv_sys_version=windows else |
︙ | ︙ | |||
888 889 890 891 892 893 894 | AC_DEFUN([SC_CONFIG_CFLAGS], [ # Step 0.a: Enable 64 bit support? AC_MSG_CHECKING([if 64bit support is requested]) AC_ARG_ENABLE(64bit, | | | | > | | | | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | AC_DEFUN([SC_CONFIG_CFLAGS], [ # Step 0.a: Enable 64 bit support? AC_MSG_CHECKING([if 64bit support is requested]) AC_ARG_ENABLE(64bit, AS_HELP_STRING([--enable-64bit], [enable 64bit support (default: off)]), [do64bit=$enableval], [do64bit=no]) AC_MSG_RESULT([$do64bit]) # Step 0.b: Enable Solaris 64 bit VIS support? AC_MSG_CHECKING([if 64bit Sparc VIS support is requested]) AC_ARG_ENABLE(64bit-vis, AS_HELP_STRING([--enable-64bit-vis], [enable 64bit Sparc VIS support (default: off)]), [do64bitVIS=$enableval], [do64bitVIS=no]) AC_MSG_RESULT([$do64bitVIS]) # Force 64bit on with VIS AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes]) # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. AC_CACHE_CHECK([if compiler supports visibility "hidden"], tcl_cv_cc_visibility_hidden, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern __attribute__((__visibility__("hidden"))) void f(void); void f(void) {}]], [[f();]])], [tcl_cv_cc_visibility_hidden=yes], [tcl_cv_cc_visibility_hidden=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [ AC_DEFINE(MODULE_SCOPE, [extern __attribute__((__visibility__("hidden")))], [Compiler support for module scope symbols]) AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols]) ]) # Step 0.d: Disable -rpath support? AC_MSG_CHECKING([if rpath support is requested]) AC_ARG_ENABLE(rpath, AS_HELP_STRING([--disable-rpath], [disable rpath support (default: on)]), [doRpath=$enableval], [doRpath=yes]) AC_MSG_RESULT([$doRpath]) # Step 1: set the variable "system" to hold the name and version number # for the system. |
︙ | ︙ | |||
967 968 969 970 971 972 973 | AS_IF([test "$GCC" = yes], [ CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" case "${CC}" in *++|*++-*) ;; *) | | | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | AS_IF([test "$GCC" = yes], [ CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" case "${CC}" in *++|*++-*) ;; *) CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers" ;; esac ], [ CFLAGS_OPTIMIZE=-O CFLAGS_WARNING="" ]) |
︙ | ︙ | |||
1079 1080 1081 1082 1083 1084 1085 | SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; | | | | | | | | | 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; CYGWIN_*|MINGW32_*|MSYS_*) SHLIB_CFLAGS="-fno-common" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" DL_OBJS="tclLoadDl.o" PLAT_OBJS='${CYGWIN_OBJS}' PLAT_SRCS='${CYGWIN_SRCS}' DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}.dll.a' SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a" AC_CACHE_CHECK(for Cygwin version of gcc, ac_cv_cygwin, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef __CYGWIN__ #error cygwin #endif ]], [[]])], [ac_cv_cygwin=no], [ac_cv_cygwin=yes]) ) if test "$ac_cv_cygwin" = "no"; then AC_MSG_ERROR([${CC} is not a cygwin compiler.]) fi do64bit_ok=yes if test "x${SHARED_BUILD}" = "x1"; then echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32" # The eval makes quoting arguments work. if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32; cd ../unix then : else { echo "configure: error: configure failed for ../win" 1>&2; exit 1; } fi fi ;; dgux*) |
︙ | ︙ | |||
1264 1265 1266 1267 1268 1269 1270 | do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" ]) ]) ;; | | > > > > > > > > > > > > | | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" ]) ]) ;; Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*) SHLIB_CFLAGS="-fPIC -fno-common" SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE="-O2" # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" case $system in DragonFly-*|FreeBSD-*) AS_IF([test "${TCL_THREADS}" = "1"], [ # The -pthread needs to go in the LDFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_LIBS"]) ;; esac AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"]) AS_IF([test $do64bit = yes], [ AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_m64 = yes], [ CFLAGS="$CFLAGS -m64" do64bit_ok=yes ]) ]) |
︙ | ︙ | |||
1358 1359 1360 1361 1362 1363 1364 | CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; | < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | > > > > > > > > > > > > | > | > | | | | | | | | | | | | 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 | CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; Darwin-*) CFLAGS_OPTIMIZE="-O2" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`" CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`" AS_IF([test $do64bit = yes], [ case `arch` in ppc) AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag], tcl_cv_cc_arch_ppc64, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes ]);; i386|x86_64) AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag], tcl_cv_cc_arch_x86_64, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [ CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes ]);; arm64|arm64e) AC_CACHE_CHECK([if compiler accepts -arch arm64e flag], tcl_cv_cc_arch_arm64e, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch arm64e" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [tcl_cv_cc_arch_arm64e=yes],[tcl_cv_cc_arch_arm64e=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_arch_arm64e = yes], [ CFLAGS="$CFLAGS -arch arm64e" do64bit_ok=yes ]);; *) AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);; esac ], [ # Check for combined 32-bit and 64-bit fat build AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64|arm64e) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [ fat_32_64=yes]) ]) SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_single_module=yes], [tcl_cv_ld_single_module=no]) LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_single_module = yes], [ SHLIB_LD="${SHLIB_LD} -Wl,-single_module" ]) SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" LDFLAGS="$LDFLAGS -headerpad_max_install_names" AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], [tcl_cv_ld_search_paths_first=yes], [tcl_cv_ld_search_paths_first=no]) LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_search_paths_first = yes], [ LDFLAGS="$LDFLAGS -Wl,-search_paths_first" ]) AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [ AC_DEFINE(MODULE_SCOPE, [__private_extern__], [Compiler support for module scope symbols]) tcl_cv_cc_visibility_hidden=yes ]) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?]) PLAT_OBJS='${MAC_OSX_OBJS}' PLAT_SRCS='${MAC_OSX_SRCS}' AC_MSG_CHECKING([whether to use CoreFoundation]) AC_ARG_ENABLE(corefoundation, AS_HELP_STRING([--enable-corefoundation], [use CoreFoundation API on MacOSX (default: on)]), [tcl_corefoundation=$enableval], [tcl_corefoundation=yes]) AC_MSG_RESULT([$tcl_corefoundation]) AS_IF([test $tcl_corefoundation = yes], [ AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [ hold_libs=$LIBS AS_IF([test "$fat_32_64" = yes], [ for v in CFLAGS CPPFLAGS LDFLAGS; do # On Tiger there is no 64-bit CF, so remove 64-bit # archs from CFLAGS et al. while testing for # presence of CF. 64-bit CF is disabled in # tclUnixPort.h if necessary. eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done]) LIBS="$LIBS -framework CoreFoundation" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <CoreFoundation/CoreFoundation.h>]], [[CFBundleRef b = CFBundleGetMainBundle();]])], [tcl_cv_lib_corefoundation=yes], [tcl_cv_lib_corefoundation=no]) AS_IF([test "$fat_32_64" = yes], [ for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done]) LIBS=$hold_libs]) AS_IF([test $tcl_cv_lib_corefoundation = yes], [ LIBS="$LIBS -framework CoreFoundation" AC_DEFINE(HAVE_COREFOUNDATION, 1, [Do we have access to Darwin CoreFoundation.framework?]) ], [tcl_corefoundation=no]) AS_IF([test "$fat_32_64" = yes -a $tcl_corefoundation = yes],[ AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [ for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <CoreFoundation/CoreFoundation.h>]], [[CFBundleRef b = CFBundleGetMainBundle();]])], [tcl_cv_lib_corefoundation_64=yes], [tcl_cv_lib_corefoundation_64=no]) for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done]) AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [ AC_DEFINE(NO_COREFOUNDATION_64, 1, [Is Darwin CoreFoundation unavailable for 64-bit?]) LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings" |
︙ | ︙ | |||
1527 1528 1529 1530 1531 1532 1533 | AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h [Should OS/390 do the right thing with sockets?]) ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" AS_IF([test "$SHARED_BUILD" = 1], [ | | | | 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 | AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h [Should OS/390 do the right thing with sockets?]) ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" AS_IF([test "$SHARED_BUILD" = 1], [ SHLIB_LD='${CC} -shared' ], [ SHLIB_LD='${CC} -non_shared' ]) SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) |
︙ | ︙ | |||
1725 1726 1727 1728 1729 1730 1731 | DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" | | | 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 | DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_Bexport=yes],[tcl_cv_ld_Bexport=no]) LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_Bexport = yes], [ LDFLAGS="$LDFLAGS -Wl,-Bexport" ]) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; |
︙ | ︙ | |||
1752 1753 1754 1755 1756 1757 1758 | dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's dnl # preprocessing tests use only CPPFLAGS. AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""]) # Step 4: disable dynamic loading if requested via a command-line switch. AC_ARG_ENABLE(load, | | | 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 | dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's dnl # preprocessing tests use only CPPFLAGS. AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""]) # Step 4: disable dynamic loading if requested via a command-line switch. AC_ARG_ENABLE(load, AS_HELP_STRING([--enable-load], [allow dynamic loading and "load" command (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) AS_IF([test "$tcl_ok" = no], [DL_OBJS=""]) AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [ AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.]) SHLIB_CFLAGS="" |
︙ | ︙ | |||
1779 1780 1781 1782 1783 1784 1785 | # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [ case $system in AIX-*) ;; BSD/OS*) ;; | | | | | 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 | # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [ case $system in AIX-*) ;; BSD/OS*) ;; CYGWIN_*|MINGW32_*|MSYS_*) ;; HP-UX*) ;; Darwin-*) ;; IRIX*) ;; Linux*|GNU*) ;; NetBSD-*|OpenBSD-*) ;; OSF1-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac]) AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [ AC_DEFINE(MODULE_SCOPE, [extern], [No Compiler support for module scope symbols]) |
︙ | ︙ | |||
1836 1837 1838 1839 1840 1841 1842 | # Define TCL_LIBS now that we know what DL_LIBS is. # The trick here is that we don't want to change the value of TCL_LIBS if # it is already set when tclConfig.sh had been loaded by Tk. AS_IF([test "x${TCL_LIBS}" = x], [ TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"]) AC_SUBST(TCL_LIBS) | | | | | | | < | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > | 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 | # Define TCL_LIBS now that we know what DL_LIBS is. # The trick here is that we don't want to change the value of TCL_LIBS if # it is already set when tclConfig.sh had been loaded by Tk. AS_IF([test "x${TCL_LIBS}" = x], [ TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"]) AC_SUBST(TCL_LIBS) # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. AC_CACHE_CHECK(for cast to union support, tcl_cv_cast_to_union, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ union foo { int i; double d; }; union foo f = (union foo) (int) 0; ]])], [tcl_cv_cast_to_union=yes], [tcl_cv_cast_to_union=no]) ) if test "$tcl_cv_cast_to_union" = "yes"; then AC_DEFINE(HAVE_CAST_TO_UNION, 1, [Defined when compiler supports casting to union type.]) fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" AC_CACHE_CHECK(for working -fno-lto, ac_cv_nolto, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [ac_cv_nolto=yes], [ac_cv_nolto=no]) ) CFLAGS=$hold_cflags if test "$ac_cv_nolto" = "yes" ; then CFLAGS_NOLTO="-fno-lto" else CFLAGS_NOLTO="" fi AC_CACHE_CHECK([if the compiler understands -finput-charset], tcl_cv_cc_input_charset, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_input_charset=yes],[tcl_cv_cc_input_charset=no]) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_input_charset = yes; then CFLAGS="$CFLAGS -finput-charset=UTF-8" fi AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],) # FIXME: This subst was left in only because the TCL_DL_LIBS # entry in tclConfig.sh uses it. It is not clear why someone # would use TCL_DL_LIBS instead of TCL_LIBS. AC_SUBST(DL_LIBS) AC_SUBST(DL_OBJS) AC_SUBST(PLAT_OBJS) AC_SUBST(PLAT_SRCS) AC_SUBST(LDAIX_SRC) AC_SUBST(CFLAGS) AC_SUBST(CFLAGS_DEBUG) AC_SUBST(CFLAGS_OPTIMIZE) AC_SUBST(CFLAGS_WARNING) AC_SUBST(CFLAGS_NOLTO) AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS_DEBUG) AC_SUBST(LDFLAGS_OPTIMIZE) AC_SUBST(CC_SEARCH_FLAGS) AC_SUBST(LD_SEARCH_FLAGS) |
︙ | ︙ | |||
1923 1924 1925 1926 1927 1928 1929 | # HAVE_SYS_PARAM_H # HAVE_STRING_H ? # #-------------------------------------------------------------------- AC_DEFUN([SC_MISSING_POSIX_HEADERS], [ AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [ | | | | | 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 | # HAVE_SYS_PARAM_H # HAVE_STRING_H ? # #-------------------------------------------------------------------- AC_DEFUN([SC_MISSING_POSIX_HEADERS], [ AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #include <dirent.h>]], [[ #ifndef _POSIX_SOURCE # ifdef __Lynx__ /* * Generate compilation error to make the test fail: Lynx headers * are only valid if really in the POSIX environment. */ missing_procedure(); # endif #endif DIR *d; struct dirent *entryPtr; char *p; d = opendir("foobar"); entryPtr = readdir(d); p = entryPtr->d_name; closedir(d); ]])],[tcl_cv_dirent_h=yes],[tcl_cv_dirent_h=no])]) if test $tcl_cv_dirent_h = no; then AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?]) fi AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) |
︙ | ︙ | |||
1969 1970 1971 1972 1973 1974 1975 | AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?]) fi AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])]) AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])]) # OS/390 lacks sys/param.h (and doesn't need it, by chance). | | | 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 | AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?]) fi AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])]) AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])]) # OS/390 lacks sys/param.h (and doesn't need it, by chance). AC_CHECK_HEADERS([sys/param.h]) ]) #-------------------------------------------------------------------- # SC_PATH_X # # Locate the X11 header files and the X11 library archive. Try # the ac_path_x macro first, but if it doesn't find the X stuff |
︙ | ︙ | |||
1998 1999 2000 2001 2002 2003 2004 | #-------------------------------------------------------------------- AC_DEFUN([SC_PATH_X], [ AC_PATH_X not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then | | | | 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 | #-------------------------------------------------------------------- AC_DEFUN([SC_PATH_X], [ AC_PATH_X not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[],[not_really_there="yes"]) else if test ! -r $x_includes/X11/Xlib.h; then not_really_there="yes" fi fi fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then AC_MSG_CHECKING([for X11 header files]) found_xincludes="no" AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[found_xincludes="yes"],[found_xincludes="no"]) if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Xlib.h; then AC_MSG_RESULT([$i]) XINCLUDES=" -I$i" found_xincludes="yes" |
︙ | ︙ | |||
2116 2117 2118 2119 2120 2121 2122 | # HAVE_TM_TZADJ # HAVE_TIMEZONE_VAR # #-------------------------------------------------------------------- AC_DEFUN([SC_TIME_HANDLER], [ AC_CHECK_HEADERS(sys/time.h) | | | | > | | > | > | | | | > | | | | > | | 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 | # HAVE_TM_TZADJ # HAVE_TIMEZONE_VAR # #-------------------------------------------------------------------- AC_DEFUN([SC_TIME_HANDLER], [ AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS_ONCE([sys/time.h]) AC_CHECK_FUNCS(gmtime_r localtime_r mktime) AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_tzadj;]])], [tcl_cv_member_tm_tzadj=yes], [tcl_cv_member_tm_tzadj=no])]) if test $tcl_cv_member_tm_tzadj = yes ; then AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?]) fi AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_gmtoff;]])], [tcl_cv_member_tm_gmtoff=yes], [tcl_cv_member_tm_gmtoff=no])]) if test $tcl_cv_member_tm_gmtoff = yes ; then AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?]) fi # # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h> #include <stdlib.h>]], [[extern long timezone; timezone += 1; exit (0);]])], [tcl_cv_timezone_long=yes], [tcl_cv_timezone_long=no])]) if test $tcl_cv_timezone_long = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?]) else # # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. # AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h> #include <stdlib.h>]], [[extern time_t timezone; timezone += 1; exit (0);]])], [tcl_cv_timezone_time=yes], [tcl_cv_timezone_time=no])]) if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?]) fi fi ]) #-------------------------------------------------------------------- # SC_TCL_LINK_LIBS # # Search for the libraries needed to link the Tcl shell. # Things like the math library (-lm), socket stuff (-lsocket vs. # -lnsl), zlib (-lz) and libtommath (-ltommath) or thread library # (-lpthread) are dealt with here. # # Arguments: # None. # # Results: # # Sets the following vars: |
︙ | ︙ | |||
2309 2310 2311 2312 2313 2314 2315 | # _LARGEFILE64_SOURCE # _LARGEFILE_SOURCE64 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_EARLY_FLAG],[ AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), | > | < | | | | 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 | # _LARGEFILE64_SOURCE # _LARGEFILE_SOURCE64 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_EARLY_FLAG],[ AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ 1 ]$2]], [[$3]])], [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)])) if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then AC_DEFINE($1, 1, [Add the ]$1[ flag when building]) tcl_flags="$tcl_flags $1" fi ]) AC_DEFUN([SC_TCL_EARLY_FLAGS],[ |
︙ | ︙ | |||
2348 2349 2350 2351 2352 2353 2354 | # Arguments: # None # # Results: # # Might define the following vars: # TCL_WIDE_INT_IS_LONG | < < < < | | | < < < < | | | | | | | | | | | | | | 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 | # Arguments: # None # # Results: # # Might define the following vars: # TCL_WIDE_INT_IS_LONG # HAVE_STRUCT_DIRENT64, HAVE_DIR64 # HAVE_STRUCT_STAT64 # HAVE_TYPE_OFF64_T # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_64BIT_FLAGS], [ AC_MSG_CHECKING([for 64-bit integer type]) AC_CACHE_VAL(tcl_cv_type_64bit,[ tcl_cv_type_64bit=none # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) { case 1: case (sizeof(long long)==sizeof(long)): ; }]])],[tcl_cv_type_64bit="long long"],[])]) if test "${tcl_cv_type_64bit}" = none ; then AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?]) AC_MSG_RESULT([yes]) else # Now check for auxiliary declarations AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #include <dirent.h>]], [[struct dirent64 p;]])], [tcl_cv_struct_dirent64=yes],[tcl_cv_struct_dirent64=no])]) if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?]) fi AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #include <dirent.h>]], [[struct dirent64 *p; DIR64 d = opendir64("."); p = readdir64(d); rewinddir64(d); closedir64(d);]])], [tcl_cv_DIR64=yes], [tcl_cv_DIR64=no])]) if test "x${tcl_cv_DIR64}" = "xyes" ; then AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?]) fi AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat64 p; ]])], [tcl_cv_struct_stat64=yes], [tcl_cv_struct_stat64=no])]) if test "x${tcl_cv_struct_stat64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?]) fi AC_CHECK_FUNCS(open64 lseek64) AC_MSG_CHECKING([for off64_t]) AC_CACHE_VAL(tcl_cv_type_off64_t,[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[off64_t offset; ]])], [tcl_cv_type_off64_t=yes], [tcl_cv_type_off64_t=no])]) dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the dnl functions lseek64 and open64 are defined. if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?]) AC_MSG_RESULT([yes]) |
︙ | ︙ | |||
2440 2441 2442 2443 2444 2445 2446 | # Will define the following vars: # TCL_CFGVAL_ENCODING # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_CFG_ENCODING], [ AC_ARG_WITH(encoding, | | | | | | 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 | # Will define the following vars: # TCL_CFGVAL_ENCODING # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_CFG_ENCODING], [ AC_ARG_WITH(encoding, AS_HELP_STRING([--with-encoding], [encoding for configuration values (default: utf-8)]), [with_tcencoding=${withval}]) if test x"${with_tcencoding}" != x ; then AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}", [What encoding should be used for embedded configuration info?]) else AC_DEFINE(TCL_CFGVAL_ENCODING,"utf-8", [What encoding should be used for embedded configuration info?]) fi ]) #-------------------------------------------------------------------- # SC_TCL_CHECK_BROKEN_FUNC # |
︙ | ︙ | |||
2473 2474 2475 2476 2477 2478 2479 | # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[ AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0) if test ["$tcl_ok"] = 1; then AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken], | | | | | 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 | # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[ AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0) if test ["$tcl_ok"] = 1; then AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken], AC_RUN_IFELSE([AC_LANG_SOURCE([[[ #include <stdlib.h> #include <string.h> int main() {]$2[}]]])],[tcl_cv_$1_unbroken=ok], [tcl_cv_$1_unbroken=broken],[tcl_cv_$1_unbroken=unknown])) if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then tcl_ok=1 else tcl_ok=0 fi fi if test ["$tcl_ok"] = 0; then |
︙ | ︙ | |||
2522 2523 2524 2525 2526 2527 2528 | AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_DECL], [AC_CHECK_DECLS(gethostbyaddr_r, [ tcl_cv_api_gethostbyaddr_r=yes],[tcl_cv_api_gethostbyaddr_r=no],[#include <netdb.h>]) ]) AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_TYPE], [AC_CHECK_FUNC(gethostbyaddr_r, [ AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [ | | | | | | | | 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 | AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_DECL], [AC_CHECK_DECLS(gethostbyaddr_r, [ tcl_cv_api_gethostbyaddr_r=yes],[tcl_cv_api_gethostbyaddr_r=no],[#include <netdb.h>]) ]) AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_TYPE], [AC_CHECK_FUNC(gethostbyaddr_r, [ AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <netdb.h> ]], [[ char *addr; int length; int type; struct hostent *result; char buffer[2048]; int buflen = 2048; int h_errnop; (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, &h_errnop); ]])],[tcl_cv_api_gethostbyaddr_r_7=yes],[tcl_cv_api_gethostbyaddr_r_7=no])]) tcl_ok=$tcl_cv_api_gethostbyaddr_r_7 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [Define to 1 if gethostbyaddr_r takes 7 args.]) else AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <netdb.h> ]], [[ char *addr; int length; int type; struct hostent *result, *resultp; char buffer[2048]; int buflen = 2048; int h_errnop; (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, &resultp, &h_errnop); ]])],[tcl_cv_api_gethostbyaddr_r_8=yes],[tcl_cv_api_gethostbyaddr_r_8=no])]) tcl_ok=$tcl_cv_api_gethostbyaddr_r_8 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [Define to 1 if gethostbyaddr_r takes 8 args.]) fi fi if test "$tcl_ok" = yes; then |
︙ | ︙ | |||
2603 2604 2605 2606 2607 2608 2609 | AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_DECL], [AC_CHECK_DECLS(gethostbyname_r, [ tcl_cv_api_gethostbyname_r=yes],[tcl_cv_api_gethostbyname_r=no],[#include <netdb.h>]) ]) AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_TYPE], [AC_CHECK_FUNC(gethostbyname_r, [ AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [ | | | | | | | | | | | 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 | AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_DECL], [AC_CHECK_DECLS(gethostbyname_r, [ tcl_cv_api_gethostbyname_r=yes],[tcl_cv_api_gethostbyname_r=no],[#include <netdb.h>]) ]) AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_TYPE], [AC_CHECK_FUNC(gethostbyname_r, [ AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <netdb.h> ]], [[ char *name; struct hostent *he, *res; char buffer[2048]; int buflen = 2048; int h_errnop; (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop); ]])],[tcl_cv_api_gethostbyname_r_6=yes],[tcl_cv_api_gethostbyname_r_6=no])]) tcl_ok=$tcl_cv_api_gethostbyname_r_6 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [Define to 1 if gethostbyname_r takes 6 args.]) else AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <netdb.h> ]], [[ char *name; struct hostent *he; char buffer[2048]; int buflen = 2048; int h_errnop; (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop); ]])],[tcl_cv_api_gethostbyname_r_5=yes],[tcl_cv_api_gethostbyname_r_5=no])]) tcl_ok=$tcl_cv_api_gethostbyname_r_5 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [Define to 1 if gethostbyname_r takes 5 args.]) else AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <netdb.h> ]], [[ char *name; struct hostent *he; struct hostent_data data; (void) gethostbyname_r(name, he, &data); ]])],[tcl_cv_api_gethostbyname_r_3=yes],[tcl_cv_api_gethostbyname_r_3=no])]) tcl_ok=$tcl_cv_api_gethostbyname_r_3 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [Define to 1 if gethostbyname_r takes 3 args.]) fi fi fi |
︙ | ︙ | |||
2679 2680 2681 2682 2683 2684 2685 | # HAVE_GETPWUID_R_4 # HAVE_GETPWUID_R_5 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [ AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [ | | | | | | | | 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 | # HAVE_GETPWUID_R_4 # HAVE_GETPWUID_R_5 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [ AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <pwd.h> ]], [[ uid_t uid; struct passwd pw, *pwp; char buf[512]; int buflen = 512; (void) getpwuid_r(uid, &pw, buf, buflen, &pwp); ]])],[tcl_cv_api_getpwuid_r_5=yes],[tcl_cv_api_getpwuid_r_5=no])]) tcl_ok=$tcl_cv_api_getpwuid_r_5 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETPWUID_R_5, 1, [Define to 1 if getpwuid_r takes 5 args.]) else AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <pwd.h> ]], [[ uid_t uid; struct passwd pw; char buf[512]; int buflen = 512; (void)getpwnam_r(uid, &pw, buf, buflen); ]])],[tcl_cv_api_getpwuid_r_4=yes],[tcl_cv_api_getpwuid_r_4=no])]) tcl_ok=$tcl_cv_api_getpwuid_r_4 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETPWUID_R_4, 1, [Define to 1 if getpwuid_r takes 4 args.]) fi fi if test "$tcl_ok" = yes; then |
︙ | ︙ | |||
2739 2740 2741 2742 2743 2744 2745 | # HAVE_GETPWNAM_R_4 # HAVE_GETPWNAM_R_5 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [ AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [ | | | | | | | | 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 | # HAVE_GETPWNAM_R_4 # HAVE_GETPWNAM_R_5 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [ AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <pwd.h> ]], [[ char *name; struct passwd pw, *pwp; char buf[512]; int buflen = 512; (void) getpwnam_r(name, &pw, buf, buflen, &pwp); ]])],[tcl_cv_api_getpwnam_r_5=yes],[tcl_cv_api_getpwnam_r_5=no])]) tcl_ok=$tcl_cv_api_getpwnam_r_5 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETPWNAM_R_5, 1, [Define to 1 if getpwnam_r takes 5 args.]) else AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <pwd.h> ]], [[ char *name; struct passwd pw; char buf[512]; int buflen = 512; (void)getpwnam_r(name, &pw, buf, buflen); ]])],[tcl_cv_api_getpwnam_r_4=yes],[tcl_cv_api_getpwnam_r_4=no])]) tcl_ok=$tcl_cv_api_getpwnam_r_4 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETPWNAM_R_4, 1, [Define to 1 if getpwnam_r takes 4 args.]) fi fi if test "$tcl_ok" = yes; then |
︙ | ︙ | |||
2799 2800 2801 2802 2803 2804 2805 | # HAVE_GETGRGID_R_4 # HAVE_GETGRGID_R_5 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [ AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [ | | | | | | | | 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 | # HAVE_GETGRGID_R_4 # HAVE_GETGRGID_R_5 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [ AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <grp.h> ]], [[ gid_t gid; struct group gr, *grp; char buf[512]; int buflen = 512; (void) getgrgid_r(gid, &gr, buf, buflen, &grp); ]])],[tcl_cv_api_getgrgid_r_5=yes],[tcl_cv_api_getgrgid_r_5=no])]) tcl_ok=$tcl_cv_api_getgrgid_r_5 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETGRGID_R_5, 1, [Define to 1 if getgrgid_r takes 5 args.]) else AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <grp.h> ]], [[ gid_t gid; struct group gr; char buf[512]; int buflen = 512; (void)getgrgid_r(gid, &gr, buf, buflen); ]])],[tcl_cv_api_getgrgid_r_4=yes],[tcl_cv_api_getgrgid_r_4=no])]) tcl_ok=$tcl_cv_api_getgrgid_r_4 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETGRGID_R_4, 1, [Define to 1 if getgrgid_r takes 4 args.]) fi fi if test "$tcl_ok" = yes; then |
︙ | ︙ | |||
2859 2860 2861 2862 2863 2864 2865 | # HAVE_GETGRNAM_R_4 # HAVE_GETGRNAM_R_5 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [ AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [ | | | | | | | | 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 | # HAVE_GETGRNAM_R_4 # HAVE_GETGRNAM_R_5 # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [ AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <grp.h> ]], [[ char *name; struct group gr, *grp; char buf[512]; int buflen = 512; (void) getgrnam_r(name, &gr, buf, buflen, &grp); ]])],[tcl_cv_api_getgrnam_r_5=yes],[tcl_cv_api_getgrnam_r_5=no])]) tcl_ok=$tcl_cv_api_getgrnam_r_5 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETGRNAM_R_5, 1, [Define to 1 if getgrnam_r takes 5 args.]) else AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <grp.h> ]], [[ char *name; struct group gr; char buf[512]; int buflen = 512; (void)getgrnam_r(name, &gr, buf, buflen); ]])],[tcl_cv_api_getgrnam_r_4=yes],[tcl_cv_api_getgrnam_r_4=no])]) tcl_ok=$tcl_cv_api_getgrnam_r_4 if test "$tcl_ok" = yes; then AC_DEFINE(HAVE_GETGRNAM_R_4, 1, [Define to 1 if getgrnam_r takes 4 args.]) fi fi if test "$tcl_ok" = yes; then |
︙ | ︙ | |||
2993 2994 2995 2996 2997 2998 2999 | # Locate a zip encoder installed on the system path, or none. # # Arguments: # none # # Results: # Substitutes the following vars: | > | > > > > > > > > > > > > > > > > > > > > > | 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 | # Locate a zip encoder installed on the system path, or none. # # Arguments: # none # # Results: # Substitutes the following vars: # MACHER_PROG # ZIP_PROG # ZIP_PROG_OPTIONS # ZIP_PROG_VFSSEARCH # ZIP_INSTALL_OBJS #------------------------------------------------------------------------ AC_DEFUN([SC_ZIPFS_SUPPORT], [ MACHER_PROG="" ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" ZIP_INSTALL_OBJS="" AC_MSG_CHECKING([for macher]) AC_CACHE_VAL(ac_cv_path_macher, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/macher 2> /dev/null` \ `ls -r $dir/macher 2> /dev/null` ; do if test x"$ac_cv_path_macher" = x ; then if test -f "$j" ; then ac_cv_path_macher=$j break fi fi done done ]) if test -f "$ac_cv_path_macher" ; then MACHER_PROG="$ac_cv_path_macher" AC_MSG_RESULT([$MACHER_PROG]) AC_MSG_RESULT([Found macher in environment]) fi AC_MSG_CHECKING([for zip]) AC_CACHE_VAL(ac_cv_path_zip, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/zip 2> /dev/null` \ `ls -r $dir/zip 2> /dev/null` ; do if test x"$ac_cv_path_zip" = x ; then |
︙ | ︙ | |||
3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 | # We can use the locally distributed minizip instead ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="-o -r" ZIP_PROG_VFSSEARCH="*" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH. Building minizip]) fi AC_SUBST(ZIP_PROG) AC_SUBST(ZIP_PROG_OPTIONS) AC_SUBST(ZIP_PROG_VFSSEARCH) AC_SUBST(ZIP_INSTALL_OBJS) ]) # Local Variables: # mode: autoconf # End: | > | 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 | # We can use the locally distributed minizip instead ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="-o -r" ZIP_PROG_VFSSEARCH="*" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH. Building minizip]) fi AC_SUBST(MACHER_PROG) AC_SUBST(ZIP_PROG) AC_SUBST(ZIP_PROG_OPTIONS) AC_SUBST(ZIP_PROG_VFSSEARCH) AC_SUBST(ZIP_INSTALL_OBJS) ]) # Local Variables: # mode: autoconf # End: |
Changes to unix/tk.spec.
1 2 3 4 5 6 | # This file is the basis for a binary Tk Linux RPM. %{!?directory:%define directory /usr/local} Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is the basis for a binary Tk Linux RPM. %{!?directory:%define directory /usr/local} Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. Version: 8.7a6 Release: 2 License: BSD Group: Development/Languages Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz URL: https://www.tcl-lang.org/ Buildroot: /var/tmp/%{name}%{version} Buildrequires: XFree86-devel tcl >= 8.6.0 |
︙ | ︙ |
Changes to unix/tkAppInit.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #undef BUILD_tk #undef STATIC_BUILD #include "tk.h" #include "tkPort.h" #ifdef TK_TEST #ifdef __cplusplus extern "C" { #endif | > > > > | > > > | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #undef BUILD_tk #undef STATIC_BUILD #include "tk.h" #include "tkPort.h" #if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 # define Tcl_LibraryInitProc Tcl_PackageInitProc # define Tcl_StaticLibrary Tcl_StaticPackage #endif #ifdef TK_TEST #ifdef __cplusplus extern "C" { #endif extern Tcl_LibraryInitProc Tktest_Init; #ifdef __cplusplus } #endif #endif /* TK_TEST */ /* * The following #if block allows you to change the AppInit function by using * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The * #if checks for that #define and uses Tcl_AppInit if it doesn't exist. */ #ifndef TK_LOCAL_APPINIT #define TK_LOCAL_APPINIT Tcl_AppInit #endif #ifndef MODULE_SCOPE # ifdef __cplusplus # define MODULE_SCOPE extern "C" # else # define MODULE_SCOPE extern # endif #endif MODULE_SCOPE int TK_LOCAL_APPINIT(Tcl_Interp *); MODULE_SCOPE int main(int, char **); /* * The following #if block allows you to change how Tcl finds the startup * script, prime the library or encoding paths, fiddle with the argv, etc., |
︙ | ︙ | |||
115 116 117 118 119 120 121 | if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } | | < | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticLibrary(interp, "Tk", Tk_Init, Tk_SafeInit); #if defined(USE_CUSTOM_EXIT_PROC) if (TkpWantsExitProc()) { Tcl_SetExitProc(TkpExitProc); } #endif #ifdef TK_TEST if (Tktest_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticLibrary(interp, "Tktest", Tktest_Init, 0); #endif /* TK_TEST */ /* * Call the init procedures for included packages. Each call should look * like this: * * if (Mod_Init(interp) == TCL_ERROR) { |
︙ | ︙ |
Changes to unix/tkConfig.h.in.
︙ | ︙ | |||
18 19 20 21 22 23 24 | /* Is 'DIR64' in <sys/types.h>? */ #undef HAVE_DIR64 /* Compiler support for module scope symbols */ #undef HAVE_HIDDEN | | < < < > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | /* Is 'DIR64' in <sys/types.h>? */ #undef HAVE_DIR64 /* Compiler support for module scope symbols */ #undef HAVE_HIDDEN /* Define to 1 if the system has the type `intptr_t'. */ #undef HAVE_INTPTR_T /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `Xft' library (-lXft). */ #undef HAVE_LIBXFT /* Define to 1 if you have the `lseek64' function. */ #undef HAVE_LSEEK64 /* Define to 1 if you have the `open64' function. */ #undef HAVE_OPEN64 /* Does struct password have a pw_gecos field? */ #undef HAVE_PW_GECOS /* Do we have <stdbool.h>? */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the <stdio.h> header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H |
︙ | ︙ | |||
75 76 77 78 79 80 81 | /* Define to 1 if you have the <sys/types.h> header file. */ #undef HAVE_SYS_TYPES_H /* Is off64_t in <sys/types.h>? */ #undef HAVE_TYPE_OFF64_T | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | /* Define to 1 if you have the <sys/types.h> header file. */ #undef HAVE_SYS_TYPES_H /* Is off64_t in <sys/types.h>? */ #undef HAVE_TYPE_OFF64_T /* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Is weak import available? */ #undef HAVE_WEAK_IMPORT |
︙ | ︙ | |||
129 130 131 132 133 134 135 | /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Is this a static build? */ #undef STATIC_BUILD | | > > | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Is this a static build? */ #undef STATIC_BUILD /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* What encoding should be used for embedded configuration info? */ #undef TCL_CFGVAL_ENCODING /* Is this a 64-bit build? */ #undef TCL_CFG_DO64BIT |
︙ | ︙ | |||
156 157 158 159 160 161 162 | /* What is the default extension for shared libraries? */ #undef TCL_SHLIB_EXT /* Do 'long' and 'long long' have the same size (64-bit)? */ #undef TCL_WIDE_INT_IS_LONG | < < < < < < > > > | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | /* What is the default extension for shared libraries? */ #undef TCL_SHLIB_EXT /* Do 'long' and 'long long' have the same size (64-bit)? */ #undef TCL_WIDE_INT_IS_LONG /* Is Tk built as a framework? */ #undef TK_FRAMEWORK /* Are TkAqua debug messages enabled? */ #undef TK_MAC_DEBUG /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Are we building with zipfs enabled? */ #undef ZIPFS_BUILD /* Are Darwin SUSv3 extensions available? */ #undef _DARWIN_C_SOURCE /* Add the _ISOC99_SOURCE flag when building */ #undef _ISOC99_SOURCE |
︙ | ︙ | |||
207 208 209 210 211 212 213 | /* Do we want to use the XOPEN network library? */ #undef _XOPEN_SOURCE /* Do we want to use the XOPEN network library? */ #undef _XOPEN_SOURCE_EXTENDED | | > < < < < < < | < < < < < < | | > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | /* Do we want to use the XOPEN network library? */ #undef _XOPEN_SOURCE /* Do we want to use the XOPEN network library? */ #undef _XOPEN_SOURCE_EXTENDED /* Define to 1 if type `char' is unsigned and your compiler does not predefine this macro. */ #ifndef __CHAR_UNSIGNED__ # undef __CHAR_UNSIGNED__ #endif /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if <sys/types.h> does not define. */ #undef mode_t /* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t /* Undef unused package specific autoheader defines so that we can * include both tclConfig.h and tkConfig.h at the same time: */ /* override */ #undef PACKAGE_NAME /* override */ #undef PACKAGE_TARNAME /* override */ #undef PACKAGE_VERSION /* override */ #undef PACKAGE_STRING #endif /* _TKCONFIG */ |
Changes to unix/tkUnix.c.
1 2 3 4 5 6 7 | /* * tkUnix.c -- * * This file contains procedures that are UNIX/X-specific, and will * probably have to be written differently for Windows or Macintosh * platforms. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkUnix.c -- * * This file contains procedures that are UNIX/X-specific, and will * probably have to be written differently for Windows or Macintosh * platforms. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #ifdef HAVE_XSS |
︙ | ︙ | |||
200 201 202 203 204 205 206 | * Side effects: * None. *---------------------------------------------------------------------- */ long Tk_GetUserInactiveTime( | > | > > > | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | * Side effects: * None. *---------------------------------------------------------------------- */ long Tk_GetUserInactiveTime( #ifdef HAVE_XSS Display *dpy) /* The display for which to query the inactive * time. */ #else TCL_UNUSED(Display *)) #endif /* HAVE_XSS */ { long inactiveTime = -1; #ifdef HAVE_XSS int eventBase, errorBase, major, minor; /* * Calling XScreenSaverQueryVersion seems to be needed to prevent a crash |
︙ | ︙ |
Changes to unix/tkUnix3d.c.
1 2 3 4 5 6 | /* * tkUnix3d.c -- * * This file contains the platform specific routines for drawing 3d * borders in the Motif style. * | | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* * tkUnix3d.c -- * * This file contains the platform specific routines for drawing 3d * borders in the Motif style. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tk3d.h" #if defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #else #include "tkUnixInt.h" #endif /* * This structure is used to keep track of the extra colors used by Unix 3D * borders. */ |
︙ | ︙ |
Changes to unix/tkUnixButton.c.
1 2 3 4 5 | /* * tkUnixButton.c -- * * This file implements the Unix specific portion of the button widgets. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkUnixButton.c -- * * This file implements the Unix specific portion of the button widgets. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkButton.h" |
︙ | ︙ |
Changes to unix/tkUnixColor.c.
1 2 3 4 5 6 | /* * tkUnixColor.c -- * * This file contains the platform specific color routines needed for X * support. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUnixColor.c -- * * This file contains the platform specific color routines needed for X * support. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" #include "tkColor.h" |
︙ | ︙ | |||
419 420 421 422 423 424 425 426 427 428 429 430 431 432 | * * Side effects: * None. * *---------------------------------------------------------------------- */ int TkpCmapStressed( Tk_Window tkwin, /* Window that identifies the display * containing the colormap. */ Colormap colormap) /* Colormap to check for stress. */ { TkStressedCmap *stressPtr; | > | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #undef TkpCmapStressed int TkpCmapStressed( Tk_Window tkwin, /* Window that identifies the display * containing the colormap. */ Colormap colormap) /* Colormap to check for stress. */ { TkStressedCmap *stressPtr; |
︙ | ︙ |
Changes to unix/tkUnixConfig.c.
1 2 3 4 5 6 | /* * tkUnixConfig.c -- * * This module implements the Unix system defaults for the configuration * package. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* * tkUnixConfig.c -- * * This module implements the Unix system defaults for the configuration * package. * * Copyright © 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" /* *---------------------------------------------------------------------- * * Tk_GetSystemDefault -- * * Given a dbName and className for a configuration option, return a * string representation of the option. * * Results: * Returns a Tk_Uid that is the string identifier that identifies this * option. Returns NULL if there are no system defaults that match this * pair. * * Side effects: * None, once the package is initialized. * *---------------------------------------------------------------------- */ Tcl_Obj * Tk_GetSystemDefault( Tk_Window tkwin, /* A window to use. */ const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { (void)tkwin; (void)dbName; (void)className; |
︙ | ︙ |
Changes to unix/tkUnixCursor.c.
1 2 3 4 5 | /* * tkUnixCursor.c -- * * This file contains X specific cursor manipulation routines. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkUnixCursor.c -- * * This file contains X specific cursor manipulation routines. * * Copyright © 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
176 177 178 179 180 181 182 | */ #ifndef CURSORFONT #define CURSORFONT "cursor" #endif static Cursor CreateCursorFromTableOrFile(Tcl_Interp *interp, | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | */ #ifndef CURSORFONT #define CURSORFONT "cursor" #endif static Cursor CreateCursorFromTableOrFile(Tcl_Interp *interp, Tk_Window tkwin, TkSizeT argc, const char **argv, const struct TkCursorName *tkCursorPtr); /* *---------------------------------------------------------------------- * * TkGetCursorByName -- * |
︙ | ︙ | |||
206 207 208 209 210 211 212 | Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry for * details on legal syntax. */ { TkUnixCursor *cursorPtr = NULL; Cursor cursor = None; | | | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry for * details on legal syntax. */ { TkUnixCursor *cursorPtr = NULL; Cursor cursor = None; TkSizeT argc; const char **argv = NULL; Display *display = Tk_Display(tkwin); int inTkTable = 0; const struct TkCursorName *tkCursorPtr = NULL; if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) { return NULL; |
︙ | ︙ | |||
377 378 379 380 381 382 383 | *---------------------------------------------------------------------- */ static Cursor CreateCursorFromTableOrFile( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | *---------------------------------------------------------------------- */ static Cursor CreateCursorFromTableOrFile( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ TkSizeT argc, const char **argv, /* Cursor spec parsed into elements. */ const struct TkCursorName *tkCursorPtr) /* Non-NULL when cursor is defined in Tk * table. */ { Cursor cursor = None; |
︙ | ︙ |
Changes to unix/tkUnixDefault.h.
︙ | ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #define DEF_BUTTON_BORDER_WIDTH "1" #define DEF_BUTTON_CURSOR "" #define DEF_BUTTON_COMPOUND "none" #define DEF_BUTTON_COMMAND "" #define DEF_BUTTON_DEFAULT "disabled" #define DEF_BUTTON_DISABLED_FG_COLOR DISABLED #define DEF_BUTTON_DISABLED_FG_MONO "" #define DEF_BUTTON_FG BLACK #define DEF_CHKRAD_FG DEF_BUTTON_FG #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT BLACK | > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #define DEF_BUTTON_BORDER_WIDTH "1" #define DEF_BUTTON_CURSOR "" #define DEF_BUTTON_COMPOUND "none" #define DEF_BUTTON_COMMAND "" #define DEF_BUTTON_DEFAULT "disabled" #define DEF_BUTTON_DISABLED_FG_COLOR DISABLED #define DEF_BUTTON_DISABLED_FG_MONO "" #define DEF_LABEL_FG BLACK #define DEF_BUTTON_FG BLACK #define DEF_CHKRAD_FG DEF_BUTTON_FG #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT BLACK |
︙ | ︙ | |||
84 85 86 87 88 89 90 | #define DEF_BUTTON_SELECT_MONO BLACK #define DEF_BUTTON_SELECT_IMAGE NULL #define DEF_BUTTON_STATE "normal" #define DEF_LABEL_TAKE_FOCUS "0" #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" | < | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #define DEF_BUTTON_SELECT_MONO BLACK #define DEF_BUTTON_SELECT_IMAGE NULL #define DEF_BUTTON_STATE "normal" #define DEF_LABEL_TAKE_FOCUS "0" #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" #define DEF_RADIOBUTTON_VARIABLE "selectedButton" #define DEF_CHECKBUTTON_VARIABLE "" /* |
︙ | ︙ | |||
264 265 266 267 268 269 270 | #define DEF_MENU_ENTRY_ON_VALUE "1" #define DEF_MENU_ENTRY_SELECT_IMAGE NULL #define DEF_MENU_ENTRY_STATE "normal" #define DEF_MENU_ENTRY_VALUE NULL #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL | < | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | #define DEF_MENU_ENTRY_ON_VALUE "1" #define DEF_MENU_ENTRY_SELECT_IMAGE NULL #define DEF_MENU_ENTRY_STATE "normal" #define DEF_MENU_ENTRY_VALUE NULL #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL /* * Defaults for menus overall: */ #define DEF_MENU_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_MENU_ACTIVE_BG_MONO BLACK |
︙ | ︙ | |||
329 330 331 332 333 334 335 | #define DEF_MENUBUTTON_PADX "4p" #define DEF_MENUBUTTON_PADY "3p" #define DEF_MENUBUTTON_RELIEF "flat" #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" | < | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | #define DEF_MENUBUTTON_PADX "4p" #define DEF_MENUBUTTON_PADY "3p" #define DEF_MENUBUTTON_RELIEF "flat" #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" /* * Defaults for messages: */ |
︙ | ︙ |
Changes to unix/tkUnixDialog.c.
1 2 3 4 5 | /* * tkUnixDialog.c -- * * Contains the Unix implementation of the common dialog boxes: * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkUnixDialog.c -- * * Contains the Unix implementation of the common dialog boxes: * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" |
︙ | ︙ | |||
162 163 164 165 166 167 168 | * This procedure implements the MessageBox window for the Unix * platform. See the user documentation for details on what it does. * * Results: * See user documentation. * * Side effects: | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | * This procedure implements the MessageBox window for the Unix * platform. See the user documentation for details on what it does. * * Results: * See user documentation. * * Side effects: * None. The MessageBox window will be destroyed before this procedure * returns. * *---------------------------------------------------------------------- */ int Tk_MessageBoxCmd( |
︙ | ︙ |
Changes to unix/tkUnixDraw.c.
1 2 3 4 5 | /* * tkUnixDraw.c -- * * This file contains X specific drawing routines. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkUnixDraw.c -- * * This file contains X specific drawing routines. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
171 172 173 174 175 176 177 | } return TK_DISCARD_EVENT; } /* *---------------------------------------------------------------------- * | | | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | } return TK_DISCARD_EVENT; } /* *---------------------------------------------------------------------- * * Tk_DrawHighlightBorder -- * * This function draws a rectangular ring around the outside of a widget * to indicate that it has received the input focus. * * On Unix, we just draw the simple inset ring. On other sytems, e.g. the * Mac, the focus ring is a little more complicated, so we need this * abstraction. * * Results: * None. * * Side effects: * A rectangle "width" pixels wide is drawn in "drawable", corresponding * to the outer area of "tkwin". * *---------------------------------------------------------------------- */ void Tk_DrawHighlightBorder( Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable) { (void)bgGC; |
︙ | ︙ |
Changes to unix/tkUnixEmbed.c.
1 2 3 4 5 6 7 8 | /* * tkUnixEmbed.c -- * * This file contains platform-specific functions for UNIX to provide * basic operations needed for application embedding (where one * application can use as its main window an internal window from some * other application). Also includes code to support busy windows. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkUnixEmbed.c -- * * This file contains platform-specific functions for UNIX to provide * basic operations needed for application embedding (where one * application can use as its main window an internal window from some * other application). Also includes code to support busy windows. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" #include "tkBusy.h" |
︙ | ︙ | |||
67 68 69 70 71 72 73 | static void EmbedStructureProc(ClientData clientData, XEvent *eventPtr); static void EmbedWindowDeleted(TkWindow *winPtr); /* *---------------------------------------------------------------------- * | | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | static void EmbedStructureProc(ClientData clientData, XEvent *eventPtr); static void EmbedWindowDeleted(TkWindow *winPtr); /* *---------------------------------------------------------------------- * * Tk_UseWindow -- * * This function causes a Tk window to use a given X window as its parent * window, rather than the root window for the screen. It is invoked by * an embedded application to specify the window in which it is embedded. * * Results: * The return value is normally TCL_OK. If an error occurs (such as * string not being a valid window spec), then the return value is * TCL_ERROR and an error message is left in the interp's result if * interp is non-NULL. * * Side effects: * Changes the colormap and other visual information to match that of the * parent window given by "string". * *---------------------------------------------------------------------- */ int Tk_UseWindow( Tcl_Interp *interp, /* If not NULL, used for error reporting if * string is bogus. */ Tk_Window tkwin, /* Tk window that does not yet have an * associated X window. */ const char *string) /* String identifying an X window to use for * tkwin; must be an integer value. */ { |
︙ | ︙ | |||
190 191 192 193 194 195 196 | winPtr->flags |= TK_EMBEDDED; return TCL_OK; } /* *---------------------------------------------------------------------- * | | | | > | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | winPtr->flags |= TK_EMBEDDED; return TCL_OK; } /* *---------------------------------------------------------------------- * * Tk_MakeWindow -- * * Create an actual window system window object based on the current * attributes of the specified TkWindow. * * Results: * Returns the handle to the new window, or None on failure. * * Side effects: * Creates a new X window. * *---------------------------------------------------------------------- */ Window Tk_MakeWindow( Tk_Window tkwin, /* Tk's information about the window that is * to be instantiated. */ Window parent) /* Window system token for the parent in which * the window is to be created. */ { Container *containerPtr; TkWindow *winPtr = (TkWindow *) tkwin; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->flags & TK_EMBEDDED) { /* * This window is embedded. Don't create the new window in the given * parent; instead, create it as a child of the root window of the |
︙ | ︙ | |||
246 247 248 249 250 251 252 | InputOutput, winPtr->visual, winPtr->dirtyAtts, &winPtr->atts); } /* *---------------------------------------------------------------------- * | | | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | InputOutput, winPtr->visual, winPtr->dirtyAtts, &winPtr->atts); } /* *---------------------------------------------------------------------- * * Tk_MakeContainer -- * * This function is called to indicate that a particular window will be a * container for an embedded application. This changes certain aspects of * the window's behavior, such as whether it will receive events anymore. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void Tk_MakeContainer( Tk_Window tkwin) /* Token for a window that is about to become * a container. */ { TkWindow *winPtr = (TkWindow *) tkwin; Container *containerPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
687 688 689 690 691 692 693 | (unsigned) winPtr->changes.height); } } /* *---------------------------------------------------------------------- * | | | | | | | | | | | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | (unsigned) winPtr->changes.height); } } /* *---------------------------------------------------------------------- * * Tk_GetOtherWindow -- * * If both the container and embedded window are in the same process, * this function will return either one, given the other. * * Results: * If tkwin is a container, the return value is the token for the * embedded window, and vice versa. If the "other" window isn't in this * process, NULL is returned. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tk_Window Tk_GetOtherWindow( Tk_Window tkwin) /* Tk's structure for a container or embedded * window. */ { Container *containerPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { if ((Tk_Window)containerPtr->embeddedPtr == tkwin) { return (Tk_Window)containerPtr->parentPtr; } else if ((Tk_Window)containerPtr->parentPtr == tkwin) { return (Tk_Window)containerPtr->embeddedPtr; } } return NULL; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
977 978 979 980 981 982 983 984 985 986 987 988 989 990 | * information about the embedded application and free the container's * record. */ prevPtr = NULL; containerPtr = tsdPtr->firstContainerPtr; while (1) { if (containerPtr->embeddedPtr == winPtr) { containerPtr->wrapper = None; containerPtr->embeddedPtr = NULL; break; } if (containerPtr->parentPtr == winPtr) { containerPtr->parentPtr = NULL; | > | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | * information about the embedded application and free the container's * record. */ prevPtr = NULL; containerPtr = tsdPtr->firstContainerPtr; while (1) { if (containerPtr == NULL) return; if (containerPtr->embeddedPtr == winPtr) { containerPtr->wrapper = None; containerPtr->embeddedPtr = NULL; break; } if (containerPtr->parentPtr == winPtr) { containerPtr->parentPtr = NULL; |
︙ | ︙ |
Changes to unix/tkUnixEvent.c.
1 2 3 4 5 6 | /* * tkUnixEvent.c -- * * This file implements an event source for X displays for the UNIX * version of Tk. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUnixEvent.c -- * * This file implements an event source for X displays for the UNIX * version of Tk. * * Copyright © 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" #include <signal.h> |
︙ | ︙ | |||
659 660 661 662 663 664 665 666 667 668 669 670 671 672 | * * Side effects: * Places new events on the Tk event queue. * *---------------------------------------------------------------------- */ void TkpSync( Display *display) /* Display to sync. */ { XSync(display, False); /* | > | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | * * Side effects: * Places new events on the Tk event queue. * *---------------------------------------------------------------------- */ #undef TkpSync void TkpSync( Display *display) /* Display to sync. */ { XSync(display, False); /* |
︙ | ︙ |
Changes to unix/tkUnixFocus.c.
1 2 3 4 5 6 | /* * tkUnixFocus.c -- * * This file contains platform specific functions that manage focus for * Tk. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUnixFocus.c -- * * This file contains platform specific functions that manage focus for * Tk. * * Copyright © 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" |
︙ | ︙ |
Changes to unix/tkUnixFont.c.
1 2 3 4 5 6 | /* * tkUnixFont.c -- * * Contains the Unix implementation of the platform-independent font * package interface. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUnixFont.c -- * * Contains the Unix implementation of the platform-independent font * package interface. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" #include "tkFont.h" |
︙ | ︙ | |||
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | static char ** ListFontOrAlias(Display *display, const char*faceName, int *numNamesPtr); static unsigned RankAttributes(FontAttributes *wantPtr, FontAttributes *gotPtr); static void ReleaseFont(UnixFont *fontPtr); static void ReleaseSubFont(Display *display, SubFont *subFontPtr); static int SeenName(const char *name, Tcl_DString *dsPtr); static int Ucs2beToUtfProc(void *clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); static int UtfToUcs2beProc(void *clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* *------------------------------------------------------------------------- * * FontPkgCleanup -- * * This function is called when an application is created. It initializes | > > | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | static char ** ListFontOrAlias(Display *display, const char*faceName, int *numNamesPtr); static unsigned RankAttributes(FontAttributes *wantPtr, FontAttributes *gotPtr); static void ReleaseFont(UnixFont *fontPtr); static void ReleaseSubFont(Display *display, SubFont *subFontPtr); static int SeenName(const char *name, Tcl_DString *dsPtr); #if TCL_MAJOR_VERSION < 9 static int Ucs2beToUtfProc(void *clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); static int UtfToUcs2beProc(void *clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); #endif /* *------------------------------------------------------------------------- * * FontPkgCleanup -- * * This function is called when an application is created. It initializes |
︙ | ︙ | |||
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | TkpFontPkgInit( TCL_UNUSED(TkMainInfo *)) /* The application being created. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; Tcl_Encoding ucs2; if (tsdPtr->controlFamily.encoding == NULL) { Tcl_EncodingType type = {"X11ControlChars", ControlUtfProc, ControlUtfProc, NULL, NULL, 0}; tsdPtr->controlFamily.refCount = 2; tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type); tsdPtr->controlFamily.isTwoByteFont = 0; dummy.familyPtr = &tsdPtr->controlFamily; dummy.fontMap = tsdPtr->controlFamily.fontMap; for (i = 0x00; i < 0x20; i++) { FontMapInsert(&dummy, i); FontMapInsert(&dummy, i + 0x80); } /* * UCS-2BE is unicode (UCS-2) in big-endian format. Define this if * if it doesn't exist yet. It is used in iso10646 fonts. */ ucs2 = Tcl_GetEncoding(NULL, "ucs-2be"); if (ucs2 == NULL) { Tcl_EncodingType ucs2type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2}; Tcl_CreateEncoding(&ucs2type); } else { Tcl_FreeEncoding(ucs2); } Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL); } } /* *------------------------------------------------------------------------- * | > > > > | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | TkpFontPkgInit( TCL_UNUSED(TkMainInfo *)) /* The application being created. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; #if TCL_MAJOR_VERSION < 9 Tcl_Encoding ucs2; #endif if (tsdPtr->controlFamily.encoding == NULL) { Tcl_EncodingType type = {"X11ControlChars", ControlUtfProc, ControlUtfProc, NULL, NULL, 0}; tsdPtr->controlFamily.refCount = 2; tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type); tsdPtr->controlFamily.isTwoByteFont = 0; dummy.familyPtr = &tsdPtr->controlFamily; dummy.fontMap = tsdPtr->controlFamily.fontMap; for (i = 0x00; i < 0x20; i++) { FontMapInsert(&dummy, i); FontMapInsert(&dummy, i + 0x80); } /* * UCS-2BE is unicode (UCS-2) in big-endian format. Define this if * if it doesn't exist yet. It is used in iso10646 fonts. */ #if TCL_MAJOR_VERSION < 9 ucs2 = Tcl_GetEncoding(NULL, "ucs-2be"); if (ucs2 == NULL) { Tcl_EncodingType ucs2type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2}; Tcl_CreateEncoding(&ucs2type); } else { Tcl_FreeEncoding(ucs2); } #endif Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL); } } /* *------------------------------------------------------------------------- * |
︙ | ︙ | |||
454 455 456 457 458 459 460 461 462 463 464 465 466 467 | * * Side effects: * None. * *------------------------------------------------------------------------- */ static int Ucs2beToUtfProc( TCL_UNUSED(void *), /* Not used. */ const char *src, /* Source string in Unicode. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ TCL_UNUSED(Tcl_EncodingState *),/* Place for conversion routine to store state | > | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | * * Side effects: * None. * *------------------------------------------------------------------------- */ #if TCL_MAJOR_VERSION < 9 static int Ucs2beToUtfProc( TCL_UNUSED(void *), /* Not used. */ const char *src, /* Source string in Unicode. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ TCL_UNUSED(Tcl_EncodingState *),/* Place for conversion routine to store state |
︙ | ︙ | |||
549 550 551 552 553 554 555 556 557 558 559 560 561 562 | * Returns TCL_OK if conversion was successful. * * Side effects: * None. * *------------------------------------------------------------------------- */ static int UtfToUcs2beProc( TCL_UNUSED(void *), /* TableEncodingData that specifies * encoding. */ const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ | > > > > > > > > | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | * Returns TCL_OK if conversion was successful. * * Side effects: * None. * *------------------------------------------------------------------------- */ #if defined(USE_TCL_STUBS) /* Since the UCS-2BE encoding is only used when Tk 8.7 is dynamically loaded in Tcl 8.6, * make sure that Tcl_UtfCharComplete is ALWAYS the pre-TIP #575 version, * even though Tk 8.7 is being compiled with -DTCL_NO_DEPRECATED! */ # undef Tcl_UtfCharComplete # define Tcl_UtfCharComplete ((int (*)(const char *, int))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[326])) #endif static int UtfToUcs2beProc( TCL_UNUSED(void *), /* TableEncodingData that specifies * encoding. */ const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ |
︙ | ︙ | |||
623 624 625 626 627 628 629 630 631 632 633 634 635 636 | *dst++ = (char)(ch & 0xFF); } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } /* *--------------------------------------------------------------------------- * * TkpGetNativeFont -- * * Map a platform-specific native font name to a TkFont. | > | 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | *dst++ = (char)(ch & 0xFF); } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } #endif /* *--------------------------------------------------------------------------- * * TkpGetNativeFont -- * * Map a platform-specific native font name to a TkFont. |
︙ | ︙ | |||
1044 1045 1046 1047 1048 1049 1050 | curX = 0; end = source + numBytes; for (p = source; p < end; ) { next = p + TkUtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; | | | | | | 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | curX = 0; end = source + numBytes; for (p = source; p < end; ) { next = p + TkUtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, source, p - source, TCL_ENCODING_NOCOMPLAIN, &runString); if (familyPtr->isTwoByteFont) { curX += XTextWidth16(lastSubFontPtr->fontStructPtr, (XChar2b *) Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) / 2); } else { curX += XTextWidth(lastSubFontPtr->fontStructPtr, Tcl_DStringValue(&runString), Tcl_DStringLength(&runString)); } Tcl_DStringFree(&runString); lastSubFontPtr = thisSubFontPtr; source = p; } p = next; } familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, source, p - source, TCL_ENCODING_NOCOMPLAIN, &runString); if (familyPtr->isTwoByteFont) { curX += XTextWidth16(lastSubFontPtr->fontStructPtr, (XChar2b *) Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> 1); } else { curX += XTextWidth(lastSubFontPtr->fontStructPtr, Tcl_DStringValue(&runString), |
︙ | ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | } if ((thisSubFontPtr != lastSubFontPtr) || (p == end) || (p-source > 200)) { if (p > source) { do_width = (needWidth || (p != end)) ? 1 : 0; familyPtr = lastSubFontPtr->familyPtr; | | | | 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | } if ((thisSubFontPtr != lastSubFontPtr) || (p == end) || (p-source > 200)) { if (p > source) { do_width = (needWidth || (p != end)) ? 1 : 0; familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, source, p - source, TCL_ENCODING_NOCOMPLAIN, &runString); if (familyPtr->isTwoByteFont) { XDrawString16(display, drawable, gc, x, y, (XChar2b *) Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) / 2); if (do_width) { x += XTextWidth16(lastSubFontPtr->fontStructPtr, (XChar2b *) Tcl_DStringValue(&runString), |
︙ | ︙ | |||
2759 2760 2761 2762 2763 2764 2765 | static XFontStruct * GetScreenFont( Display *display, /* Display for new XFontStruct. */ FontAttributes *wantPtr, /* Contains desired actual pixel-size if the * best font was scalable. */ char **nameList, /* Array of XLFDs. */ | | | | 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 | static XFontStruct * GetScreenFont( Display *display, /* Display for new XFontStruct. */ FontAttributes *wantPtr, /* Contains desired actual pixel-size if the * best font was scalable. */ char **nameList, /* Array of XLFDs. */ int bestIdx[], /* Indices into above array for XLFD of best * bitmapped and best scalable font. */ unsigned bestScore[]) /* Scores of best bitmapped and best scalable * font. XLFD corresponding to lowest score * will be constructed. */ { XFontStruct *fontStructPtr; if ((bestIdx[0] < 0) && (bestIdx[1] < 0)) { return NULL; |
︙ | ︙ |
Changes to unix/tkUnixInit.c.
1 2 3 4 5 | /* * tkUnixInit.c -- * * This file contains Unix-specific interpreter initialization functions. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkUnixInit.c -- * * This file contains Unix-specific interpreter initialization functions. * * Copyright © 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" |
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | int TkpInit( Tcl_Interp *interp) { TkCreateXEventSource(); GetLibraryPath(interp); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpGetAppName -- | > > > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | int TkpInit( Tcl_Interp *interp) { TkCreateXEventSource(); GetLibraryPath(interp); Tktray_Init(interp); (void)SysNotify_Init (interp); Icu_Init(interp); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpGetAppName -- |
︙ | ︙ |
Changes to unix/tkUnixInt.h.
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* * Prototypes for procedures that are referenced in files other than the ones * they're defined in. */ #include "tkIntPlatDecls.h" #endif /* _TKUNIXINT */ /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: | > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /* * Prototypes for procedures that are referenced in files other than the ones * they're defined in. */ #include "tkIntPlatDecls.h" MODULE_SCOPE int Tktray_Init (Tcl_Interp* interp); MODULE_SCOPE int SysNotify_Init (Tcl_Interp* interp); #endif /* _TKUNIXINT */ /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: |
︙ | ︙ |
Changes to unix/tkUnixKey.c.
1 2 3 4 5 6 | /* * tkUnixKey.c -- * * This file contains routines for dealing with international keyboard * input. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUnixKey.c -- * * This file contains routines for dealing with international keyboard * input. * * Copyright © 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ | |||
171 172 173 174 175 176 177 | len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(&buf), len, &kePtr->keysym, &status); } if ((status != XLookupChars) && (status != XLookupBoth)) { len = 0; } Tcl_DStringSetLength(&buf, len); | | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(&buf), len, &kePtr->keysym, &status); } if ((status != XLookupChars) && (status != XLookupBoth)) { len = 0; } Tcl_DStringSetLength(&buf, len); (void)Tcl_ExternalToUtfDStringEx(NULL, Tcl_DStringValue(&buf), len, TCL_ENCODING_NOCOMPLAIN, dsPtr); Tcl_DStringFree(&buf); #endif /* X_HAVE_UTF8_STRING */ } else #endif /* TK_USE_INPUT_METHODS */ { /* * Fall back to convert a keyboard event to a UTF-8 string using |
︙ | ︙ |
Changes to unix/tkUnixMenu.c.
1 2 3 4 5 | /* * tkUnixMenu.c -- * * This module implements the UNIX platform-specific features of menus. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkUnixMenu.c -- * * This module implements the UNIX platform-specific features of menus. * * Copyright © 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" #include "tkMenu.h" |
︙ | ︙ | |||
286 287 288 289 290 291 292 | * Side effects: * Recompute geometry of given window. * *---------------------------------------------------------------------- */ void | | | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | * Side effects: * Recompute geometry of given window. * *---------------------------------------------------------------------- */ void Tk_SetMainMenubar( TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(Tk_Window), TCL_UNUSED(const char *)) { /* * Nothing to do. */ |
︙ | ︙ | |||
847 848 849 850 851 852 853 | Drawable d, /* What we are drawing into */ GC gc, /* The gc to draw into */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int x, int y, TCL_UNUSED(int), int height) { | | | | | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | Drawable d, /* What we are drawing into */ GC gc, /* The gc to draw into */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int x, int y, TCL_UNUSED(int), int height) { if (mePtr->labelPtr != NULL) { int len; len = Tcl_GetCharLength(mePtr->labelPtr); if (mePtr->underline < len && mePtr->underline >= -len) { int activeBorderWidth, leftEdge, ch; const char *label, *start, *end; label = Tcl_GetString(mePtr->labelPtr); start = Tcl_UtfAtIndex(label, (mePtr->underline < 0) ? mePtr->underline + len : mePtr->underline); end = start + TkUtfToUniChar(start, &ch); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); leftEdge = x + mePtr->indicatorSpace + activeBorderWidth; if (menuPtr->menuType == MENUBAR) { leftEdge += 5; |
︙ | ︙ | |||
924 925 926 927 928 929 930 | * The menu is posted. * *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( | | < < < < < < < > > > > > > > > > > > > | 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | * The menu is posted. * *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( TCL_UNUSED(Tcl_Interp *), /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where the * specified entry will be posted */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; TkActivateMenuEntry(menuPtr, -1); TkRecomputeMenu(menuPtr); result = TkPostCommand(menuPtr); if (result != TCL_OK) { return result; } /* * The post commands could have deleted the menu, which means we are dead * and should go away. */ if (menuPtr->tkwin == NULL) { return TCL_OK; } /* * Adjust the menu y position so that the specified entry will be located * at the given coordinates. */ if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { y -= menuPtr->entries[index]->y; } /* * Adjust the position of the menu if necessary to keep it visible on the * screen. There are two special tricks to make this work right: * * 1. If a virtual root window manager is being used then the coordinates * are in the virtual root window of menuPtr's parent; since the menu |
︙ | ︙ |
Changes to unix/tkUnixMenubu.c.
1 2 3 4 5 6 | /* * tkUnixMenubu.c -- * * This file implements the Unix specific portion of the menubutton * widget. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUnixMenubu.c -- * * This file implements the Unix specific portion of the menubutton * widget. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkMenubutton.h" |
︙ | ︙ |
Changes to unix/tkUnixPort.h.
︙ | ︙ | |||
32 33 34 35 36 37 38 | #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <sys/stat.h> #ifndef _TCL # include <tcl.h> #endif | < < < < | | | < < | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <sys/stat.h> #ifndef _TCL # include <tcl.h> #endif #ifdef HAVE_SYS_TIME_H # include <sys/time.h> #endif #include <time.h> #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #include <unistd.h> #if defined(__GNUC__) && !defined(__cplusplus) # pragma GCC diagnostic ignored "-Wc++-compat" #endif #include <X11/Xlib.h> |
︙ | ︙ | |||
166 167 168 169 170 171 172 | /* * This macro stores a representation of the window handle in a string. * This should perhaps use the real size of an XID. */ #ifndef __CYGWIN__ #define TkpPrintWindowId(buf,w) \ | | < < < < < < | 160 161 162 163 164 165 166 167 168 169 170 | /* * This macro stores a representation of the window handle in a string. * This should perhaps use the real size of an XID. */ #ifndef __CYGWIN__ #define TkpPrintWindowId(buf,w) \ sprintf((buf), "0x%lx", (unsigned long) (w)) #endif #endif /* _UNIXPORT */ |
Changes to unix/tkUnixRFont.c.
1 2 3 4 5 | /* * tkUnixRFont.c -- * * Alternate implementation of tkUnixFont.c using Xft. * | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tkUnixRFont.c -- * * Alternate implementation of tkUnixFont.c using Xft. * * Copyright © 2002-2003 Keith Packard * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" #include "tkFont.h" #include <X11/Xft/Xft.h> #define MAX_CACHED_COLORS 16 typedef struct { XftFont *ftFont; XftFont *ft0Font; FcPattern *source; |
︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | * the information isn't retrievable from the GC. */ typedef struct { Region clipRegion; /* The clipping region, or None. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* *------------------------------------------------------------------------- * * TkpFontPkgInit -- * * This procedure is called when an application is created. It | > > > > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | * the information isn't retrievable from the GC. */ typedef struct { Region clipRegion; /* The clipping region, or None. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; TCL_DECLARE_MUTEX(xftMutex); #define LOCK Tcl_MutexLock(&xftMutex) #define UNLOCK Tcl_MutexUnlock(&xftMutex) /* *------------------------------------------------------------------------- * * TkpFontPkgInit -- * * This procedure is called when an application is created. It |
︙ | ︙ | |||
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | mat.xx = mat.yy = c; mat.xy = -(mat.yx = s); if (angle != 0.0) { FcPatternAddMatrix(pat, FC_MATRIX, &mat); } ftFont = XftFontOpenPattern(fontPtr->display, pat); if (!ftFont) { /* * The previous call to XftFontOpenPattern() should not fail, but * sometimes does anyway. Usual cause appears to be a * misconfigured fontconfig installation; see [Bug 1090382]. Try a * fallback: */ ftFont = XftFontOpen(fontPtr->display, fontPtr->screen, FC_FAMILY, FcTypeString, "sans", FC_SIZE, FcTypeDouble, 12.0, FC_MATRIX, FcTypeMatrix, &mat, NULL); } if (!ftFont) { /* * The previous call should definitely not fail. Impossible to * proceed at this point. */ Tcl_Panic("Cannot find a usable font"); } if (angle == 0.0) { fontPtr->faces[i].ft0Font = ftFont; } else { if (fontPtr->faces[i].ftFont) { XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont); } fontPtr->faces[i].ftFont = ftFont; fontPtr->faces[i].angle = angle; } } return (angle==0.0? fontPtr->faces[i].ft0Font : fontPtr->faces[i].ftFont); } | > > > > > > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | mat.xx = mat.yy = c; mat.xy = -(mat.yx = s); if (angle != 0.0) { FcPatternAddMatrix(pat, FC_MATRIX, &mat); } LOCK; ftFont = XftFontOpenPattern(fontPtr->display, pat); UNLOCK; if (!ftFont) { /* * The previous call to XftFontOpenPattern() should not fail, but * sometimes does anyway. Usual cause appears to be a * misconfigured fontconfig installation; see [Bug 1090382]. Try a * fallback: */ LOCK; ftFont = XftFontOpen(fontPtr->display, fontPtr->screen, FC_FAMILY, FcTypeString, "sans", FC_SIZE, FcTypeDouble, 12.0, FC_MATRIX, FcTypeMatrix, &mat, NULL); UNLOCK; } if (!ftFont) { /* * The previous call should definitely not fail. Impossible to * proceed at this point. */ Tcl_Panic("Cannot find a usable font"); } if (angle == 0.0) { fontPtr->faces[i].ft0Font = ftFont; } else { if (fontPtr->faces[i].ftFont) { LOCK; XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont); UNLOCK; } fontPtr->faces[i].ftFont = ftFont; fontPtr->faces[i].angle = angle; } } return (angle==0.0? fontPtr->faces[i].ft0Font : fontPtr->faces[i].ftFont); } |
︙ | ︙ | |||
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | Display *display = fontPtr->display; int i; Tk_ErrorHandler handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL); for (i = 0; i < fontPtr->nfaces; i++) { if (fontPtr->faces[i].ftFont) { XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont); } if (fontPtr->faces[i].ft0Font) { XftFontClose(fontPtr->display, fontPtr->faces[i].ft0Font); } if (fontPtr->faces[i].charset) { FcCharSetDestroy(fontPtr->faces[i].charset); } } if (fontPtr->faces) { ckfree(fontPtr->faces); | > > > > | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | Display *display = fontPtr->display; int i; Tk_ErrorHandler handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL); for (i = 0; i < fontPtr->nfaces; i++) { if (fontPtr->faces[i].ftFont) { LOCK; XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont); UNLOCK; } if (fontPtr->faces[i].ft0Font) { LOCK; XftFontClose(fontPtr->display, fontPtr->faces[i].ft0Font); UNLOCK; } if (fontPtr->faces[i].charset) { FcCharSetDestroy(fontPtr->faces[i].charset); } } if (fontPtr->faces) { ckfree(fontPtr->faces); |
︙ | ︙ | |||
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | #ifdef DEBUG_FONTSEL string[len++] = (char) c; #endif /* DEBUG_FONTSEL */ ftFont = GetFont(fontPtr, c, 0.0); if (!errorFlag) { XftTextExtents32(fontPtr->display, ftFont, &c, 1, &extents); } else { extents.xOff = 0; errorFlag = 0; } newX = curX + extents.xOff; newByte = curByte + clen; | > > | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | #ifdef DEBUG_FONTSEL string[len++] = (char) c; #endif /* DEBUG_FONTSEL */ ftFont = GetFont(fontPtr, c, 0.0); if (!errorFlag) { LOCK; XftTextExtents32(fontPtr->display, ftFont, &c, 1, &extents); UNLOCK; } else { extents.xOff = 0; errorFlag = 0; } newX = curX + extents.xOff; newByte = curByte + clen; |
︙ | ︙ | |||
968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | } source += clen; numBytes -= clen; ftFont = GetFont(fontPtr, c, 0.0); if (ftFont) { specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c); XftGlyphExtents(fontPtr->display, ftFont, &specs[nspec].glyph, 1, &metrics); /* * Draw glyph only when it fits entirely into 16 bit coords. */ if (x >= minCoord && y >= minCoord && x <= maxCoord - metrics.width && y <= maxCoord - metrics.height) { specs[nspec].font = ftFont; specs[nspec].x = x; specs[nspec].y = y; if (++nspec == NUM_SPEC) { XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); nspec = 0; } } x += metrics.xOff; y += metrics.yOff; } } if (nspec) { XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); } doUnderlineStrikeout: if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } if (fontPtr->font.fa.underline != 0) { | > > > > > > | 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | } source += clen; numBytes -= clen; ftFont = GetFont(fontPtr, c, 0.0); if (ftFont) { specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c); LOCK; XftGlyphExtents(fontPtr->display, ftFont, &specs[nspec].glyph, 1, &metrics); UNLOCK; /* * Draw glyph only when it fits entirely into 16 bit coords. */ if (x >= minCoord && y >= minCoord && x <= maxCoord - metrics.width && y <= maxCoord - metrics.height) { specs[nspec].font = ftFont; specs[nspec].x = x; specs[nspec].y = y; if (++nspec == NUM_SPEC) { LOCK; XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); UNLOCK; nspec = 0; } } x += metrics.xOff; y += metrics.yOff; } } if (nspec) { LOCK; XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); UNLOCK; } doUnderlineStrikeout: if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } if (fontPtr->font.fa.underline != 0) { |
︙ | ︙ | |||
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | /* * We pass multiple glyphs at once to enable the code to * perform better rendering of sub-pixel inter-glyph spacing. * If only the current Xft implementation could make use of * this information... but we'll be ready when it does! */ XftGlyphExtents(fontPtr->display, currentFtFont, glyphs, nglyph, &metrics); /* * Draw glyph only when it fits entirely into 16 bit coords. */ if (x >= minCoord && y >= minCoord && x <= maxCoord - metrics.width && y <= maxCoord - metrics.height) { | > > > | 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | /* * We pass multiple glyphs at once to enable the code to * perform better rendering of sub-pixel inter-glyph spacing. * If only the current Xft implementation could make use of * this information... but we'll be ready when it does! */ LOCK; XftGlyphExtents(fontPtr->display, currentFtFont, glyphs, nglyph, &metrics); UNLOCK; /* * Draw glyph only when it fits entirely into 16 bit coords. */ if (x >= minCoord && y >= minCoord && x <= maxCoord - metrics.width && y <= maxCoord - metrics.height) { |
︙ | ︙ | |||
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | * be divided until the maximal string will fit. (GC) * Given the resolution of current displays though, this should * not be a huge issue since NUM_SPEC is 1024 and thus able to * cover about 6000 pixels for a 6 pixel wide font (which is * a very small barely readable font) */ XftDrawGlyphs(fontPtr->ftDraw, xftcolor, currentFtFont, originX, originY, glyphs, nglyph); } } originX = ROUND16(x); originY = ROUND16(y); currentFtFont = ftFont; } glyphs[nglyph++] = XftCharIndex(fontPtr->display, ftFont, c); } if (nglyph) { XftGlyphExtents(fontPtr->display, currentFtFont, glyphs, nglyph, &metrics); /* * Draw glyph only when it fits entirely into 16 bit coords. */ if (x >= minCoord && y >= minCoord && x <= maxCoord - metrics.width && y <= maxCoord - metrics.height) { XftDrawGlyphs(fontPtr->ftDraw, xftcolor, currentFtFont, originX, originY, glyphs, nglyph); } } #else /* !XFT_HAS_FIXED_ROTATED_PLACEMENT */ int clen, nspec; XftGlyphFontSpec specs[NUM_SPEC]; XGlyphInfo metrics; double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); | > > > > > > | 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | * be divided until the maximal string will fit. (GC) * Given the resolution of current displays though, this should * not be a huge issue since NUM_SPEC is 1024 and thus able to * cover about 6000 pixels for a 6 pixel wide font (which is * a very small barely readable font) */ LOCK; XftDrawGlyphs(fontPtr->ftDraw, xftcolor, currentFtFont, originX, originY, glyphs, nglyph); UNLOCK; } } originX = ROUND16(x); originY = ROUND16(y); currentFtFont = ftFont; } glyphs[nglyph++] = XftCharIndex(fontPtr->display, ftFont, c); } if (nglyph) { LOCK; XftGlyphExtents(fontPtr->display, currentFtFont, glyphs, nglyph, &metrics); UNLOCK; /* * Draw glyph only when it fits entirely into 16 bit coords. */ if (x >= minCoord && y >= minCoord && x <= maxCoord - metrics.width && y <= maxCoord - metrics.height) { LOCK; XftDrawGlyphs(fontPtr->ftDraw, xftcolor, currentFtFont, originX, originY, glyphs, nglyph); UNLOCK; } } #else /* !XFT_HAS_FIXED_ROTATED_PLACEMENT */ int clen, nspec; XftGlyphFontSpec specs[NUM_SPEC]; XGlyphInfo metrics; double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); |
︙ | ︙ | |||
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | source += clen; numBytes -= clen; ftFont = GetFont(fontPtr, c, angle); ft0Font = GetFont(fontPtr, c, 0.0); if (ftFont && ft0Font) { specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c); XftGlyphExtents(fontPtr->display, ft0Font, &specs[nspec].glyph, 1, &metrics); /* * Draw glyph only when it fits entirely into 16 bit coords. */ if (x >= minCoord && y >= minCoord && x <= maxCoord - metrics.width && y <= maxCoord - metrics.height) { specs[nspec].font = ftFont; specs[nspec].x = ROUND16(x); specs[nspec].y = ROUND16(y); if (++nspec == NUM_SPEC) { XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); nspec = 0; } } x += metrics.xOff*cosA + metrics.yOff*sinA; y += metrics.yOff*cosA - metrics.xOff*sinA; } } if (nspec) { XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); } #endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */ doUnderlineStrikeout: if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } | > > > > > > | 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 | source += clen; numBytes -= clen; ftFont = GetFont(fontPtr, c, angle); ft0Font = GetFont(fontPtr, c, 0.0); if (ftFont && ft0Font) { specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c); LOCK; XftGlyphExtents(fontPtr->display, ft0Font, &specs[nspec].glyph, 1, &metrics); UNLOCK; /* * Draw glyph only when it fits entirely into 16 bit coords. */ if (x >= minCoord && y >= minCoord && x <= maxCoord - metrics.width && y <= maxCoord - metrics.height) { specs[nspec].font = ftFont; specs[nspec].x = ROUND16(x); specs[nspec].y = ROUND16(y); if (++nspec == NUM_SPEC) { LOCK; XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); UNLOCK; nspec = 0; } } x += metrics.xOff*cosA + metrics.yOff*sinA; y += metrics.yOff*cosA - metrics.xOff*sinA; } } if (nspec) { LOCK; XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); UNLOCK; } #endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */ doUnderlineStrikeout: if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } |
︙ | ︙ |
Changes to unix/tkUnixScale.c.
1 2 3 4 5 | /* * tkUnixScale.c -- * * This file implements the X specific portion of the scrollbar widget. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUnixScale.c -- * * This file implements the X specific portion of the scrollbar widget. * * Copyright © 1996 Sun Microsystems, Inc. * Copyright © 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScale.h" |
︙ | ︙ |
Changes to unix/tkUnixScrlbr.c.
1 2 3 4 5 6 | /* * tkUnixScrollbar.c -- * * This file implements the Unix specific portion of the scrollbar * widget. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkUnixScrollbar.c -- * * This file implements the Unix specific portion of the scrollbar * widget. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScrollbar.h" |
︙ | ︙ |
Changes to unix/tkUnixSelect.c.
1 2 3 4 5 | /* * tkUnixSelect.c -- * * This file contains X specific routines for manipulating selections. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkUnixSelect.c -- * * This file contains X specific routines for manipulating selections. * * Copyright © 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkSelect.h" |
︙ | ︙ | |||
616 617 618 619 620 621 622 | */ if (type == dispPtr->compoundTextAtom) { encoding = Tcl_GetEncoding(NULL, "iso2022"); } else { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } | | | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | */ if (type == dispPtr->compoundTextAtom) { encoding = Tcl_GetEncoding(NULL, "iso2022"); } else { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } (void)Tcl_ExternalToUtfDStringEx(encoding, propInfo, numItems, TCL_ENCODING_NOCOMPLAIN, &ds); if (encoding) { Tcl_FreeEncoding(encoding); } retrPtr->result = retrPtr->proc(retrPtr->clientData, interp, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); |
︙ | ︙ | |||
991 992 993 994 995 996 997 | */ if (type == XA_STRING) { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } else { encoding = Tcl_GetEncoding(NULL, "iso2022"); } | | | 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 | */ if (type == XA_STRING) { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } else { encoding = Tcl_GetEncoding(NULL, "iso2022"); } (void)Tcl_UtfToExternalDStringEx(encoding, (char *) buffer, -1, TCL_ENCODING_NOCOMPLAIN, &ds); XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, 8, PropModeReplace, (unsigned char *) Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); if (encoding) { Tcl_FreeEncoding(encoding); } |
︙ | ︙ |
Changes to unix/tkUnixSend.c.
1 2 3 4 5 6 | /* * tkUnixSend.c -- * * This file provides functions that implement the "send" command, * allowing commands to be passed from interpreter to interpreter. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkUnixSend.c -- * * This file provides functions that implement the "send" command, * allowing commands to be passed from interpreter to interpreter. * * Copyright © 1989-1994 The Regents of the University of California. * Copyright © 1994-1996 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" |
︙ | ︙ |
Added unix/tkUnixSysNotify.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | /* * tkUnixSysNotify.c -- * * tkUnixSysNotify.c implements a "sysnotify" Tcl command which * permits one to post system notifications based on the libnotify API. * * Copyright © 2020 Kevin Walzer/WordTech Communications LLC. * Copyright © 2020 Christian Werner for runtime linking * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkUnixInt.h" /* * Runtime linking of libnotify. */ typedef int (*fn_ln_init)(const char *); typedef void (*fn_ln_uninit)(void); typedef void * (*fn_ln_notification_new)(const char *, const char *, const char *, void *); typedef int (*fn_ln_notification_show)(void *, int *); static struct { int nopen; Tcl_LoadHandle lib; fn_ln_init init; fn_ln_uninit uninit; fn_ln_notification_new notification_new; fn_ln_notification_show notification_show; } ln_fns = { 0, NULL, NULL, NULL, NULL, NULL }; #define notify_init ln_fns.init #define notify_uninit ln_fns.uninit #define notify_notification_new ln_fns.notification_new #define notify_notification_show ln_fns.notification_show TCL_DECLARE_MUTEX(ln_mutex); /* * Forward declarations for procedures defined in this file. */ static void SysNotifyDeleteCmd(void *); static int SysNotifyCmd(void *, Tcl_Interp *, int, Tcl_Obj * const*); /* *---------------------------------------------------------------------- * * SysNotifyDeleteCmd -- * * Delete notification and clean up. * * Results: * Window destroyed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void SysNotifyDeleteCmd ( TCL_UNUSED(void *)) { Tcl_MutexLock(&ln_mutex); if (--ln_fns.nopen == 0) { if (notify_uninit) { notify_uninit(); } if (ln_fns.lib != NULL) { Tcl_FSUnloadFile(NULL, ln_fns.lib); } memset(&ln_fns, 0, sizeof(ln_fns)); } Tcl_MutexUnlock(&ln_mutex); } /* *---------------------------------------------------------------------- * * SysNotifyCreateCmd -- * * Create tray command and (unreal) window. * * Results: * Icon tray and hidden window created. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int SysNotifyCmd( TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { const char *title; const char *message; const char *icon; const char *appname = "Wish"; void *notif; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "title message"); return TCL_ERROR; } /* * Pass strings to notification, and use a sane platform-specific * icon in the alert. */ title = Tcl_GetString(objv[1]); message = Tcl_GetString(objv[2]); icon = "dialog-information"; /* Use the appname for libnotify initialization * See bug f63c37be3a for a discussion whether this should be * allowed at all on safe interpreters */ if (!Tcl_IsSafe(interp)) { appname = ((TkWindow *)Tk_MainWindow(interp))->nameUid; } /* * Call to notify_init should go here to prevent test suite failure. */ if (notify_init && notify_notification_new && notify_notification_show) { Tcl_Encoding enc; Tcl_DString dst, dsm; Tcl_DStringInit(&dst); Tcl_DStringInit(&dsm); enc = Tcl_GetEncoding(NULL, "utf-8"); (void)Tcl_UtfToExternalDStringEx(enc, title, -1, TCL_ENCODING_NOCOMPLAIN, &dst); (void)Tcl_UtfToExternalDStringEx(enc, message, -1, TCL_ENCODING_NOCOMPLAIN, &dsm); notify_init(appname); notif = notify_notification_new(Tcl_DStringValue(&dst), Tcl_DStringValue(&dsm), icon, NULL); notify_notification_show(notif, NULL); Tcl_DStringFree(&dsm); Tcl_DStringFree(&dst); Tcl_FreeEncoding(enc); } return TCL_OK; } /* *---------------------------------------------------------------------- * * SysNotify_Init -- * * Initialize the command. * * Results: * Command initialized. * * Side effects: * None. * *---------------------------------------------------------------------- */ int SysNotify_Init( Tcl_Interp *interp) { Tcl_MutexLock(&ln_mutex); if (ln_fns.nopen == 0) { int i = 0; Tcl_Obj *nameobj; static const char *lnlibs[] = { "libnotify.so.4", "libnotify.so.3", "libnotify.so.2", "libnotify.so.1", "libnotify.so", NULL }; while (lnlibs[i] != NULL) { Tcl_ResetResult(interp); nameobj = Tcl_NewStringObj(lnlibs[i], -1); Tcl_IncrRefCount(nameobj); if (Tcl_LoadFile(interp, nameobj, NULL, 0, NULL, &ln_fns.lib) == TCL_OK) { Tcl_DecrRefCount(nameobj); break; } Tcl_DecrRefCount(nameobj); ++i; } if (ln_fns.lib != NULL) { #define LN_SYM(name) \ ln_fns.name = (fn_ln_ ## name) \ Tcl_FindSymbol(NULL, ln_fns.lib, "notify_" #name) LN_SYM(init); LN_SYM(uninit); LN_SYM(notification_new); LN_SYM(notification_show); #undef LN_SYM } } ln_fns.nopen++; Tcl_MutexUnlock(&ln_mutex); Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", SysNotifyCmd, interp, SysNotifyDeleteCmd); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * coding: utf-8 * End: */ |
Added unix/tkUnixSysTray.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 | /* * tkUnixSysTray.c -- * * tkUnixSysTray.c implements a "systray" Tcl command which permits to * change the system tray/taskbar icon of a Tk toplevel window and * to post system notifications. * * Copyright © 2005 Anton Kovalenko. * Copyright © 2020 Kevin Walzer/WordTech Communications LLC. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkUnixInt.h" /* * Based extensively on the tktray extension package. Here we are removing * non-essential parts of tktray. */ #include <time.h> #include <string.h> #include <stdio.h> #include <X11/X.h> #include <X11/Xutil.h> #include <X11/Xatom.h> /* XEmbed definitions * See http://www.freedesktop.org/wiki/Standards_2fxembed_2dspec * */ #define XEMBED_MAPPED (1<<0) /* System tray opcodes * See http://www.freedesktop.org/wiki/Standards_2fsystemtray_2dspec * */ #define SYSTEM_TRAY_REQUEST_DOCK 0 #define SYSTEM_TRAY_BEGIN_MESSAGE 1 #define SYSTEM_TRAY_CANCEL_MESSAGE 2 /* Flags of widget configuration options */ #define ICON_CONF_IMAGE (1<<0) /* Image changed */ #define ICON_CONF_REDISPLAY (1<<1) /* Redisplay required */ #define ICON_CONF_XEMBED (1<<2) /* Remapping or unmapping required */ #define ICON_CONF_CLASS (1<<3) /* TODO WM_CLASS update required */ #define ICON_CONF_FIRST_TIME (1<<4) /* For IconConfigureMethod invoked by the constructor */ /* Widget states */ #define ICON_FLAG_REDRAW_PENDING (1<<0) #define ICON_FLAG_ARGB32 (1<<1) #define ICON_FLAG_DIRTY_EDGES (1<<2) #define TKU_NO_BAD_WINDOW_BEGIN(display) \ { Tk_ErrorHandler error__handler = \ Tk_CreateErrorHandler(display, BadWindow, -1, -1, NULL, NULL); #define TKU_NO_BAD_WINDOW_END Tk_DeleteErrorHandler(error__handler); } /*Declaration for utility functions.*/ static void TKU_WmWithdraw(Tk_Window winPtr, Tcl_Interp* interp); static Tk_Window TKU_GetWrapper(Tk_Window winPtr); void TKU_AddInput(Display* dpy, Window win, long add_to_mask); static Tk_Window TKU_Wrapper(Tk_Window w, Tcl_Interp* interp); static Window TKU_XID(Tk_Window w); /* Customized window withdraw */ static void TKU_WmWithdraw( Tk_Window winPtr, TCL_UNUSED(Tcl_Interp *)) { TkpWmSetState((TkWindow*)winPtr, WithdrawnState); } /* The wrapper should exist */ static Tk_Window TKU_GetWrapper( Tk_Window winPtr) { return (Tk_Window) TkpGetWrapperWindow((TkWindow*)winPtr); } /* Subscribe for extra X11 events (needed for MANAGER selection) */ void TKU_AddInput( Display* dpy, Window win, long add_to_mask) { XWindowAttributes xswa; TKU_NO_BAD_WINDOW_BEGIN(dpy) XGetWindowAttributes(dpy,win,&xswa); XSelectInput(dpy,win,xswa.your_event_mask|add_to_mask); TKU_NO_BAD_WINDOW_END } /* Get Tk Window wrapper (make it exist if ny) */ static Tk_Window TKU_Wrapper( Tk_Window w, Tcl_Interp* interp) { Tk_Window wrapper = TKU_GetWrapper(w); if (!wrapper) { Tk_MakeWindowExist(w); TKU_WmWithdraw(w, interp); Tk_MapWindow(w); wrapper = (Tk_Window) TKU_GetWrapper(w); } return wrapper; } /* Return X window id for Tk window (make it exist if ny) */ static Window TKU_XID( Tk_Window w) { Window xid = Tk_WindowId(w); if (xid == None) { Tk_MakeWindowExist(w); xid = Tk_WindowId(w); } return xid; } /* Data structure representing dock widget */ typedef struct { /* standard for widget */ Tk_Window tkwin, drawingWin; Window wrapper; Window myManager; Window trayManager; Tk_OptionTable options; Tcl_Interp *interp; Tcl_Command widgetCmd; Tk_Image image; /* image to be drawn */ /* Only one of imageVisualInstance and photo is needed for argb32 * operations. Unless imageString changes, imageVisualInstance is * always valid for the same drawingWin instance, but photo is * invalidated by any "whole image" type change. */ Tk_Image imageVisualInstance; /* image instance for use with argb32 */ Tk_PhotoHandle photo; /* !null if it's really a photo */ /* Offscreen pixmap is created for a given imageWidth, * imageHeight, drawingWin, and invalidated (and freed) on image * resize or drawingWin destruction. * Contents of this pixmap is synced on demand; when image changes * but is not resized, pixmap is marked as out-of-sync. Next time * when redisplay is needed, pixmap is updated before drawing * operation. */ Pixmap offscreenPixmap; /* There is no need to recreate GC ever; it remains valid once * created */ GC offscreenGC; /* XImage for drawing ARGB32 photo on offscreenPixmap. Should be * freed and nullified each time when a pixmap is freed. Needed * (and created) when redrawing an image being a photo on ARGB32 * offscreen pixmap. */ XImage *offscreenImage; /* for photo (argb32) drawing code */ Visual *bestVisual; /* Visual, when it's specified by tray * manager AND is guessed to be * ARGB32 */ Colormap bestColormap; /* Colormap for bestVisual */ Atom aMANAGER; Atom a_NET_SYSTEM_TRAY_Sn; Atom a_XEMBED_INFO; Atom a_NET_SYSTEM_TRAY_MESSAGE_DATA; Atom a_NET_SYSTEM_TRAY_OPCODE; Atom a_NET_SYSTEM_TRAY_ORIENTATION; Atom a_NET_SYSTEM_TRAY_VISUAL; int flags; /* ICON_FLAG_ - see defines above */ int msgid; /* Last balloon message ID */ int useShapeExt; int x,y,width,height; int imageWidth, imageHeight; int requestedWidth, requestedHeight; int visible; /* whether XEMBED_MAPPED should be set */ int docked; /* whether an icon should be docked */ char *imageString, /* option: -image as string */ *classString; /* option: -class as string */ } DockIcon; /* * Forward declarations for procedures defined in this file. */ static int TrayIconCreateCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int TrayIconObjectCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int TrayIconConfigureMethod(DockIcon *icon, Tcl_Interp* interp, int objc, Tcl_Obj *const objv[], int addflags); static int PostBalloon(DockIcon* icon, const char * utf8msg, long timeout); static void CancelBalloon(DockIcon* icon, int msgid); static int QueryTrayOrientation(DockIcon* icon); static void TrayIconDeleteProc(ClientData cd ); static Atom DockSelectionAtomFor(Tk_Window tkwin); static void DockToManager(DockIcon *icon); static void CreateTrayIconWindow(DockIcon *icon); static void TrayIconRequestSize(DockIcon* icon, int w, int h); static void TrayIconForceImageChange(DockIcon* icon); static void TrayIconUpdate(DockIcon* icon, int mask); static void EventuallyRedrawIcon(DockIcon* icon); static void DisplayIcon(ClientData cd); static void RetargetEvent(DockIcon *icon, XEvent *ev); static void TrayIconEvent(ClientData cd, XEvent* ev); static void UserIconEvent(ClientData cd, XEvent* ev); static void TrayIconWrapperEvent(ClientData cd, XEvent* ev); static int IconGenericHandler(ClientData cd, XEvent *ev); int Tktray_Init (Tcl_Interp* interp ); /* *---------------------------------------------------------------------- * * TrayIconObjectCmd -- * * Manage attributes of tray icon. * * Results: * Various values of the tray icon are set and retrieved. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int TrayIconObjectCmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { DockIcon *icon = (DockIcon*)cd; int bbox[4] = {0,0,0,0}; Tcl_Obj * bboxObj; int wcmd; int i; XWindowAttributes xwa; Window bogus; int msgid; enum {XWC_CONFIGURE = 0, XWC_CGET, XWC_BALLOON, XWC_CANCEL, XWC_BBOX, XWC_DOCKED, XWC_ORIENTATION}; const char *st_wcmd[] = {"configure", "cget", "balloon", "cancel", "bbox", "docked", "orientation", NULL}; long timeout = 0; Tcl_Obj* optionValue; if (objc<2) { Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], st_wcmd, "subcommand", TCL_EXACT, &wcmd) != TCL_OK) { return TCL_ERROR; } switch (wcmd) { case XWC_CONFIGURE: return TrayIconConfigureMethod(icon,interp,objc-2,objv+2,0); case XWC_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp,2,objv,"option"); return TCL_ERROR; } optionValue = Tk_GetOptionValue(interp,(char*)icon, icon->options,objv[2],icon->tkwin); if (optionValue) { Tcl_SetObjResult(interp,optionValue); return TCL_OK; } else { return TCL_ERROR; } case XWC_BALLOON: if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "message ?timeout?"); return TCL_ERROR; } if (objc == 4) { if (Tcl_GetLongFromObj(interp,objv[3],&timeout) != TCL_OK) return TCL_ERROR; } msgid = PostBalloon(icon,Tcl_GetString(objv[2]), timeout); Tcl_SetObjResult(interp,Tcl_NewIntObj(msgid)); return TCL_OK; case XWC_CANCEL: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "messageId"); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp,objv[2],&msgid) != TCL_OK) { return TCL_ERROR; } if (msgid) CancelBalloon(icon,msgid); return TCL_OK; case XWC_BBOX: if (icon->drawingWin) { XGetWindowAttributes(Tk_Display(icon->drawingWin), TKU_XID(icon->drawingWin), &xwa); XTranslateCoordinates(Tk_Display(icon->drawingWin), TKU_XID(icon->drawingWin), xwa.root, 0,0, &icon->x, &icon->y, &bogus); bbox[0] = icon->x; bbox[1] = icon->y; bbox[2] = bbox[0] + icon->width - 1; bbox[3] = bbox[1] + icon->height - 1; } bboxObj = Tcl_NewObj(); for (i = 0; i < 4; ++i) { Tcl_ListObjAppendElement(interp, bboxObj, Tcl_NewIntObj(bbox[i])); } Tcl_SetObjResult(interp, bboxObj); return TCL_OK; case XWC_DOCKED: Tcl_SetObjResult(interp, Tcl_NewBooleanObj(icon->myManager != None)); return TCL_OK; case XWC_ORIENTATION: if (icon->myManager == None || icon->wrapper == None) { Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); } else { switch(QueryTrayOrientation(icon)) { case 0: Tcl_SetObjResult(interp, Tcl_NewStringObj("horizontal", -1)); break; case 1: Tcl_SetObjResult(interp, Tcl_NewStringObj("vertical", -1)); break; default: Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown", -1)); break; } } return TCL_OK; } return TCL_OK; } /* *---------------------------------------------------------------------- * * QueryTrayOrientation -- * * Obtain the orientation of the tray icon. * * Results: * Orientation is returned. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int QueryTrayOrientation( DockIcon* icon) { Atom retType = None; int retFormat = 32; unsigned long retNitems, retBytesAfter; unsigned char *retProp = NULL; int result = -1; if (icon->wrapper != None && icon->myManager != None) { XGetWindowProperty(Tk_Display(icon->tkwin), icon->myManager, icon->a_NET_SYSTEM_TRAY_ORIENTATION, /* offset */ 0, /* length */ 1, /* delete */ False, /* type */ XA_CARDINAL, &retType, &retFormat, &retNitems, &retBytesAfter, &retProp); if (retType == XA_CARDINAL && retFormat == 32 && retNitems == 1) { result = (int) *(long*)retProp; } if (retProp) { XFree(retProp); } } return result; } /* *---------------------------------------------------------------------- * * DockSelectionAtomFor -- * * Obtain the dock selection atom. * * Results: * Selection returned. * * Side effects: * None. * *---------------------------------------------------------------------- */ static Atom DockSelectionAtomFor( Tk_Window tkwin) { char buf[256]; /* no snprintf in C89 */ sprintf(buf,"_NET_SYSTEM_TRAY_S%d",Tk_ScreenNumber(tkwin)); return Tk_InternAtom(tkwin,buf); } /* *---------------------------------------------------------------------- * * XembedSetState -- * * Set the xembed state. * * Results: * Updates the xembed state. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void XembedSetState( DockIcon *icon, long xembedState) { long info[] = { 0, 0 }; info[1] = xembedState; if (icon->drawingWin) { XChangeProperty(Tk_Display(icon->drawingWin), icon->wrapper, icon->a_XEMBED_INFO, icon->a_XEMBED_INFO, 32, PropModeReplace, (unsigned char*)info, 2); } } /* *---------------------------------------------------------------------- * * XembedRequestDock -- * * Obtain the docking window. * * Results: * The dock window is requested. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void XembedRequestDock( DockIcon *icon) { Tk_Window tkwin = icon->drawingWin; XEvent ev; Display *dpy = Tk_Display(tkwin); memset(&ev, 0, sizeof(ev)); ev.xclient.type = ClientMessage; ev.xclient.window = icon->myManager; ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_OPCODE; ev.xclient.format = 32; ev.xclient.data.l[0] = 0; ev.xclient.data.l[1] = SYSTEM_TRAY_REQUEST_DOCK; ev.xclient.data.l[2] = icon->wrapper; ev.xclient.data.l[3] = 0; ev.xclient.data.l[4] = 0; XSendEvent(dpy, icon->myManager, True, StructureNotifyMask|SubstructureNotifyMask, &ev); } /* *---------------------------------------------------------------------- * * CheckArgbVisual -- * * Find out if a visual is recommended and if it looks like argb32. * * Results: * Render the visual as needed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void CheckArgbVisual( DockIcon *icon) { /* Find out if a visual is recommended and if it looks like argb32. * For such visuals we should: * Recreate a window if it's created but the depth is wrong; * Don't use ParentRelative but blank background. * For photo images, draw into a window by XPutImage. */ Atom retType = None; int retFormat = 32; unsigned long retNitems, retBytesAfter; unsigned char *retProp = NULL; Visual *match = NULL; int depth = 0; Colormap cmap = None; TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin)) XGetWindowProperty(Tk_Display(icon->tkwin), icon->trayManager, icon->a_NET_SYSTEM_TRAY_VISUAL, /* offset */ 0, /* length */ 1, /* delete */ False, /* type */ XA_VISUALID, &retType, &retFormat, &retNitems, &retBytesAfter, &retProp); TKU_NO_BAD_WINDOW_END if (retType == XA_VISUALID && retNitems == 1 && retFormat == 32) { char numeric[256]; sprintf(numeric,"%ld",*(long*)retProp); XFree(retProp); match = Tk_GetVisual(icon->interp, icon->tkwin, numeric, &depth, &cmap); } if (match&& depth == 32 && match->red_mask == 0xFF0000UL && match->green_mask == 0x00FF00UL && match->blue_mask == 0x0000FFUL) { icon->bestVisual = match; icon->bestColormap = cmap; } else { icon->bestVisual = NULL; icon->bestColormap = None; } } /* *---------------------------------------------------------------------- * * CreateTrayIconWindow -- * * Create and configure the window for the icon tray. * * Results: * The window is created and displayed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void CreateTrayIconWindow( DockIcon *icon) { Tcl_InterpState saved; Tk_Window tkwin; Tk_Window wrapper; XSetWindowAttributes attr; saved = Tcl_SaveInterpState(icon->interp, TCL_OK); /* Use the same name (tail) as the widget name, to enable * name-based icon management for supporting trays, as promised by * the docs. */ tkwin = icon->drawingWin = Tk_CreateWindow(icon->interp, icon->tkwin, Tk_Name(icon->tkwin), ""); if (tkwin) { Tk_SetClass(icon->drawingWin,icon->classString); Tk_CreateEventHandler(icon->drawingWin,ExposureMask|StructureNotifyMask| ButtonPressMask|ButtonReleaseMask| EnterWindowMask|LeaveWindowMask|PointerMotionMask, TrayIconEvent,(ClientData)icon); if(icon->bestVisual) { Tk_SetWindowVisual(icon->drawingWin,icon->bestVisual, 32,icon->bestColormap); icon->flags |= ICON_FLAG_ARGB32; Tk_SetWindowBackground(tkwin, 0); } else { Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative); icon->flags &= ~ICON_FLAG_ARGB32; } Tk_MakeWindowExist(tkwin); TKU_WmWithdraw(tkwin,icon->interp); wrapper = TKU_Wrapper(tkwin,icon->interp); attr.override_redirect = True; Tk_ChangeWindowAttributes(wrapper,CWOverrideRedirect,&attr); Tk_CreateEventHandler(wrapper,StructureNotifyMask,TrayIconWrapperEvent,(ClientData)icon); if (!icon->bestVisual) { Tk_SetWindowBackgroundPixmap(wrapper, ParentRelative); } else { Tk_SetWindowBackground(tkwin, 0); } icon->wrapper = TKU_XID(wrapper); TrayIconForceImageChange(icon); } else { Tcl_BackgroundError(icon->interp); } Tcl_RestoreInterpState(icon->interp, saved); } /* *---------------------------------------------------------------------- * * DockToManager -- * * Helper function to manage icon in display. * * Results: * Icon is created and displayed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void DockToManager( DockIcon *icon) { icon->myManager = icon->trayManager; Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconCreate"), NULL); XembedSetState(icon, icon->visible ? XEMBED_MAPPED : 0); XembedRequestDock(icon); } static const Tk_OptionSpec IconOptionSpec[] = { {TK_OPTION_STRING,"-image","image","Image", NULL, TCL_INDEX_NONE, offsetof(DockIcon, imageString), TK_OPTION_NULL_OK, NULL, ICON_CONF_IMAGE | ICON_CONF_REDISPLAY}, {TK_OPTION_STRING,"-class","class","Class", "TrayIcon", TCL_INDEX_NONE, offsetof(DockIcon, classString), 0, NULL, ICON_CONF_CLASS}, {TK_OPTION_BOOLEAN,"-docked","docked","Docked", "1", TCL_INDEX_NONE, offsetof(DockIcon, docked), 0, NULL, ICON_CONF_XEMBED | ICON_CONF_REDISPLAY}, {TK_OPTION_BOOLEAN,"-shape","shape","Shape", "0", TCL_INDEX_NONE, offsetof(DockIcon, useShapeExt), 0, NULL, ICON_CONF_IMAGE | ICON_CONF_REDISPLAY}, {TK_OPTION_BOOLEAN,"-visible","visible","Visible", "1", TCL_INDEX_NONE, offsetof(DockIcon, visible), 0, NULL, ICON_CONF_XEMBED | ICON_CONF_REDISPLAY}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* *---------------------------------------------------------------------- * * TrayIconRequestSize -- * * Set icon size. * * Results: * Icon size is obtained/set. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void TrayIconRequestSize( DockIcon* icon, int w, int h) { if (icon->drawingWin) { if (icon->requestedWidth != w || icon->requestedHeight != h) { Tk_SetMinimumRequestSize(icon->drawingWin,w,h); Tk_GeometryRequest(icon->drawingWin,w,h); Tk_SetGrid(icon->drawingWin,1,1,w,h); icon->requestedWidth = w; icon->requestedHeight = h; } } else { /* Sign that no size is requested yet */ icon->requestedWidth = 0; icon->requestedHeight = 0; } } /* *---------------------------------------------------------------------- * * TrayIconImageChanged -- * * Fires when icon state changes. * * Results: * Icon changes are rendered. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void TrayIconImageChanged( ClientData cd, int x, int y, int w, int h, int imgw, int imgh) { DockIcon *icon = (DockIcon*) cd; if (imgw != icon->imageWidth || imgh != icon->imageHeight) { if (icon->offscreenImage) { XDestroyImage(icon->offscreenImage); icon->offscreenImage = NULL; } if (icon->offscreenPixmap) { /* its size is bad */ Tk_FreePixmap(Tk_Display(icon->tkwin), icon->offscreenPixmap); icon->offscreenPixmap = None; } /* if some image dimension decreases, * empty areas around the image should be cleared */ if (imgw < icon->imageWidth || imgh < icon->imageHeight) { icon->flags |= ICON_FLAG_DIRTY_EDGES; } } icon->imageWidth = imgw; icon->imageHeight = imgh; if (imgw == w && imgh == h && x == 0 && y == 0) { icon->photo = NULL; /* invalidate */ } TrayIconRequestSize(icon,imgw,imgh); EventuallyRedrawIcon(icon); } /* *---------------------------------------------------------------------- * * IgnoreImageChange -- * * Currently no-op. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void IgnoreImageChange( TCL_UNUSED(void *), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int)) { } /* *---------------------------------------------------------------------- * * ForceImageChange -- * * Push icon changes through. * * Results: * Icon image is updated. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void TrayIconForceImageChange( DockIcon* icon) { if (icon->image) { int w,h; Tk_SizeOfImage(icon->image,&w,&h); TrayIconImageChanged((ClientData)icon,0,0,w,h,w,h); } } /* *---------------------------------------------------------------------- * * EventuallyRedrawIcon -- * * Update image icon. * * Results: * Icon image is updated. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void EventuallyRedrawIcon( DockIcon* icon) { if (icon->drawingWin && icon->myManager) { /* don't redraw invisible icon */ if (!(icon->flags & ICON_FLAG_REDRAW_PENDING)) { /* don't schedule multiple redraw ops */ icon->flags |= ICON_FLAG_REDRAW_PENDING; Tcl_DoWhenIdle(DisplayIcon,(ClientData)icon); } } } /* *---------------------------------------------------------------------- * * DisplayIcon -- * * Main function for displaying icon. * * Results: * Icon image is displayed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void DisplayIcon( ClientData cd) { DockIcon *icon = (DockIcon*)cd; int w = icon->imageWidth, h = icon->imageHeight; int imgx, imgy, outx, outy, outw, outh; imgx = (icon->width >= w) ? 0 : -(icon->width - w)/2; imgy = (icon->height >= h) ? 0 : -(icon->height - h)/2; outx = (icon->width >= w) ? (icon->width - w)/2 : 0; outy = (icon->height >= h) ? (icon->height - h)/2 : 0; outw = (icon->width >= w) ? w : icon->width; outh = (icon->height >= h) ? h : icon->height; icon->flags &= (~ICON_FLAG_REDRAW_PENDING); if (icon->drawingWin && icon->docked) { if (icon->flags & ICON_FLAG_ARGB32) { /* ARGB32 redraw: never use a ParentRelative method, and no need to clear window except FIXME when its size changed. Draw on the offscreen pixmap instead, then copy to the window. */ if (icon->offscreenPixmap == None) { icon->offscreenPixmap = Tk_GetPixmap(Tk_Display(icon->drawingWin), Tk_WindowId(icon->drawingWin), w, h, 32); } if (!icon->photo) { icon->photo = Tk_FindPhoto(icon->interp, icon->imageString); } if (!icon->photo && !icon->imageVisualInstance) { Tcl_InterpState saved = Tcl_SaveInterpState(icon->interp, TCL_OK); icon->imageVisualInstance = Tk_GetImage(icon->interp,icon->drawingWin, icon->imageString, IgnoreImageChange,(ClientData)NULL); Tcl_RestoreInterpState(icon->interp,saved); } if (icon->photo && !icon->offscreenImage) { icon->offscreenImage = XGetImage(Tk_Display(icon->drawingWin), icon->offscreenPixmap, 0, 0, w, h, AllPlanes, ZPixmap); } if (icon->offscreenGC == None) { XGCValues gcv; gcv.function = GXcopy; gcv.plane_mask = AllPlanes; gcv.foreground = 0; gcv.background = 0; icon->offscreenGC = Tk_GetGC(icon->drawingWin, GCFunction|GCPlaneMask|GCForeground|GCBackground, &gcv); } if (icon->flags & ICON_FLAG_DIRTY_EDGES) { XClearWindow(Tk_Display(icon->drawingWin), TKU_XID(icon->drawingWin)); icon->flags &= ~ICON_FLAG_DIRTY_EDGES; } if (icon->photo) { Tk_PhotoImageBlock pib; int cx,cy; XImage *xim = icon->offscreenImage; /* redraw photo using raw data */ Tk_PhotoGetImage(icon->photo,&pib); for (cy = 0; cy < h; ++cy) { for (cx = 0; cx < w; ++cx) { XPutPixel(xim,cx,cy, (*(pib.pixelPtr + pib.pixelSize*cx + pib.pitch*cy + pib.offset[0])<<16) | (*(pib.pixelPtr + pib.pixelSize*cx + pib.pitch*cy + pib.offset[1])<<8) | (*(pib.pixelPtr + pib.pixelSize*cx + pib.pitch*cy + pib.offset[2])) | (pib.offset[3] ? (*(pib.pixelPtr + pib.pixelSize*cx + pib.pitch*cy + pib.offset[3])<<24) : 0)); } } XPutImage(Tk_Display(icon->drawingWin), icon->offscreenPixmap, icon->offscreenGC, icon->offscreenImage, 0,0,0,0,w,h); } else { XFillRectangle(Tk_Display(icon->drawingWin), icon->offscreenPixmap, icon->offscreenGC, 0,0,w,h); if (icon->imageVisualInstance) { Tk_RedrawImage(icon->imageVisualInstance, 0,0,w,h, icon->offscreenPixmap, 0,0); } } XCopyArea(Tk_Display(icon->drawingWin), icon->offscreenPixmap, TKU_XID(icon->drawingWin), icon->offscreenGC, imgx,imgy,outw,outh,outx,outy); } else { /* Non-argb redraw: clear window and draw an image over it. For photos it gives a correct alpha blending with a parent window background, even if it's a fancy pixmap (proved to work with lxpanel fancy backgrounds). */ XClearWindow(Tk_Display(icon->drawingWin), TKU_XID(icon->drawingWin)); if (icon->image && icon->visible) { Tk_RedrawImage(icon->image,imgx,imgy,outw,outh, TKU_XID(icon->drawingWin), outx, outy); } } } } /* *---------------------------------------------------------------------- * * RetargetEvent -- * * Redirect X events to widgets. * * Results: * Icon image is displayed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void RetargetEvent( DockIcon *icon, XEvent *ev) { int send = 0; Window* saveWin1 = NULL, *saveWin2 = NULL; if (!icon->visible) return; switch (ev->type) { case MotionNotify: send = 1; saveWin1 = &ev->xmotion.subwindow; saveWin2 = &ev->xmotion.window; break; case LeaveNotify: case EnterNotify: send = 1; saveWin1 = &ev->xcrossing.subwindow; saveWin2 = &ev->xcrossing.window; break; case ButtonPress: case ButtonRelease: send = 1; saveWin1 = &ev->xbutton.subwindow; saveWin2 = &ev->xbutton.window; break; case MappingNotify: send = 1; saveWin1 = &ev->xmapping.window; } if (saveWin1) { Tk_MakeWindowExist(icon->tkwin); *saveWin1 = Tk_WindowId(icon->tkwin); if (saveWin2) *saveWin2 = *saveWin1; } if (send) { ev->xany.send_event = 0x147321ac; Tk_HandleEvent(ev); } } /* *---------------------------------------------------------------------- * * TrayIconWrapperEvent -- * * Ensure automapping in root window is done in withdrawn state. * * Results: * Icon image is displayed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void TrayIconWrapperEvent( ClientData cd, XEvent* ev) { /* Some embedders, like Docker, add icon windows to save set * (XAddToSaveSet), so when they crash the icon is reparented to root. * We have to make sure that automatic mapping in root is done in * withdrawn state (no way to prevent it entirely) */ DockIcon *icon = (DockIcon*)cd; XWindowAttributes attr; if (icon->drawingWin) { switch(ev->type) { case ReparentNotify: /* With virtual roots and screen roots etc, the only way to check for reparent-to-root is to ask for this root first */ XGetWindowAttributes(ev->xreparent.display, ev->xreparent.window, &attr); if (attr.root == ev->xreparent.parent) { /* upon reparent to root, */ if (icon->drawingWin) { /* we were sent away to root */ TKU_WmWithdraw(icon->drawingWin,icon->interp); if (icon->myManager) Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconDestroy"), NULL); icon->myManager = None; } } /* Reparenting into some other embedder is theoretically possible, * and everything would just work in this case. */ break; } } } /* *---------------------------------------------------------------------- * * TrayIconEvent -- * * Handle X events. * * Results: * Events are handled and processed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void TrayIconEvent( ClientData cd, XEvent* ev) { DockIcon *icon = (DockIcon*)cd; switch (ev->type) { case Expose: if (!ev->xexpose.count) EventuallyRedrawIcon(icon); break; case DestroyNotify: /* If anonymous window is destroyed first, then either * something went wrong with a tray (if -visible) or we just * reconfigured to invisibility: nothing to be done in both * cases. * If unreal window is destroyed first, freeing the data structures * is the only thing to do. */ if (icon->myManager) { Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconDestroy"), NULL); } Tcl_CancelIdleCall(DisplayIcon,(ClientData)icon); icon->flags &= ~ICON_FLAG_REDRAW_PENDING; icon->drawingWin = NULL; icon->requestedWidth = 0; /* trigger re-request on recreation */ icon->requestedHeight = 0; icon->wrapper = None; icon->myManager = None; break; case ConfigureNotify: Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconConfigure"), NULL); if (icon->width != ev->xconfigure.width || icon->height != ev->xconfigure.height) { icon->width = ev->xconfigure.width; icon->height = ev->xconfigure.height; icon->flags |= ICON_FLAG_DIRTY_EDGES; EventuallyRedrawIcon(icon); } RetargetEvent(icon,ev); break; case MotionNotify: /* fall through */ case ButtonPress: /* fall through */ case ButtonRelease: /* fall through */ case EnterNotify: /* fall through */ case LeaveNotify: RetargetEvent(icon,ev); break; } } /* *---------------------------------------------------------------------- * * UserIconEvent -- * * Handle user events. * * Results: * Events are handled and processed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void UserIconEvent( ClientData cd, XEvent* ev) { DockIcon *icon = (DockIcon*)cd; switch (ev->type) { case DestroyNotify: Tk_DeleteGenericHandler(IconGenericHandler, (ClientData)icon); if(icon->drawingWin) { icon->visible = 0; Tcl_CancelIdleCall(DisplayIcon,(ClientData)icon); icon->flags &= ~ICON_FLAG_REDRAW_PENDING; Tk_DestroyWindow(icon->drawingWin); } if(icon->imageVisualInstance) { Tk_FreeImage(icon->imageVisualInstance); icon->image = NULL; } if(icon->offscreenImage) { XDestroyImage(icon->offscreenImage); icon->offscreenImage = NULL; } if(icon->offscreenGC) { Tk_FreeGC(Tk_Display(icon->tkwin),icon->offscreenGC); icon->offscreenGC = NULL; } if(icon->offscreenPixmap) { Tk_FreePixmap(Tk_Display(icon->tkwin),icon->offscreenPixmap); } if(icon->image) { Tk_FreeImage(icon->image); icon->image = NULL; } if(icon->widgetCmd) Tcl_DeleteCommandFromToken(icon->interp,icon->widgetCmd); Tk_FreeConfigOptions((char*)icon, icon->options, icon->tkwin); break; } } /* *---------------------------------------------------------------------- * * PostBalloon -- * * Display tooltip/balloon window over tray icon. * * Results: * Window is displayed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int PostBalloon( DockIcon *icon, const char *utf8msg, long timeout) { Tk_Window tkwin = icon -> tkwin; Display* dpy = Tk_Display(tkwin); int length = strlen(utf8msg); XEvent ev; if (!(icon->drawingWin) || (icon->myManager == None)) return 0; /* overflow protection */ if (icon->msgid < 0) icon->msgid = 0; memset(&ev, 0, sizeof(ev)); ev.xclient.type = ClientMessage; ev.xclient.window = icon->wrapper; ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_OPCODE; ev.xclient.format = 32; ev.xclient.data.l[0] = CurrentTime; ev.xclient.data.l[1] = SYSTEM_TRAY_BEGIN_MESSAGE; ev.xclient.data.l[2] = timeout; ev.xclient.data.l[3] = length; ev.xclient.data.l[4] = ++icon->msgid; TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin)) XSendEvent(dpy, icon->myManager , True, StructureNotifyMask|SubstructureNotifyMask, &ev); XSync(dpy, False); /* Sending message elements */ while (length>0) { ev.type = ClientMessage; ev.xclient.window = icon->wrapper; ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_MESSAGE_DATA; ev.xclient.format = 8; memset(ev.xclient.data.b,0,20); strncpy(ev.xclient.data.b,utf8msg,length<20?length:20); XSendEvent(dpy, icon->myManager, True, StructureNotifyMask|SubstructureNotifyMask, &ev); XSync(dpy,False); utf8msg += 20; length -= 20; } TKU_NO_BAD_WINDOW_END; return icon->msgid; } /* *---------------------------------------------------------------------- * * CancelBalloon -- * * Remove balloon from display over tray icon. * * Results: * Window is destroyed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void CancelBalloon( DockIcon *icon, int msgid) { Tk_Window tkwin = icon -> tkwin; Display* dpy = Tk_Display(tkwin); XEvent ev; if (!(icon->drawingWin) || (icon->myManager == None)) return; /* overflow protection */ if (icon->msgid < 0) icon->msgid = 0; memset(&ev, 0, sizeof(ev)); ev.type = ClientMessage; ev.xclient.window = icon->wrapper; ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_OPCODE; ev.xclient.format = 32; ev.xclient.data.l[0] = CurrentTime; ev.xclient.data.l[1] = SYSTEM_TRAY_CANCEL_MESSAGE; ev.xclient.data.l[2] =msgid; TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin)) XSendEvent(dpy, icon->myManager , True, StructureNotifyMask|SubstructureNotifyMask, &ev); TKU_NO_BAD_WINDOW_END } /* *---------------------------------------------------------------------- * * IconGenericHandler -- * * Process non-tk events. * * Results: * Events are processed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int IconGenericHandler( ClientData cd, XEvent *ev) { DockIcon *icon = (DockIcon*)cd; if ((ev->type == ClientMessage) && (ev->xclient.message_type == icon->aMANAGER) && ((Atom)ev->xclient.data.l[1] == icon->a_NET_SYSTEM_TRAY_Sn)) { icon->trayManager = (Window)ev->xclient.data.l[2]; XSelectInput(ev->xclient.display,icon->trayManager,StructureNotifyMask); if (icon->myManager == None) TrayIconUpdate(icon, ICON_CONF_XEMBED); return 1; } if (ev->type == DestroyNotify) { if (ev->xdestroywindow.window == icon->trayManager) { icon->trayManager = None; } if (ev->xdestroywindow.window == icon->myManager) { icon->myManager = None; icon->wrapper = None; if (icon->drawingWin) { Tk_DestroyWindow(icon->drawingWin); icon->drawingWin = NULL; } } } return 0; } /* *---------------------------------------------------------------------- * * TrayIconUpdate -- * * Get in touch with new options that are certainly valid. * * Results: * Options updated. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void TrayIconUpdate( DockIcon *icon, int mask) { /* why should someone need this option? * anyway, let's handle it if we provide it. */ if (mask & ICON_CONF_CLASS) { if (icon->drawingWin) Tk_SetClass(icon->drawingWin,Tk_GetUid(icon->classString)); } /* * First, ensure right icon visibility. * If should be visible and not yet managed, * we have to get the tray or wait for it. * If should be invisible and managed, * real-window is simply destroyed. * If should be invisible and not managed, * generic handler should be abandoned. */ if (mask & ICON_CONF_XEMBED) { if (icon->myManager == None && icon->trayManager != None && icon->docked) { CheckArgbVisual(icon); if (icon->drawingWin && ((icon->bestVisual && !(icon->flags & ICON_FLAG_ARGB32)) || (!icon->bestVisual && (icon->flags & ICON_FLAG_ARGB32)))) { icon->myManager = None; icon->wrapper = None; icon->requestedWidth = icon->requestedHeight = 0; Tk_DestroyWindow(icon->drawingWin); icon->drawingWin = NULL; } if (!icon->drawingWin) { CreateTrayIconWindow(icon); } if (icon->drawingWin) { DockToManager(icon); } } if (icon->myManager != None && icon->drawingWin != NULL && !icon->docked) { Tk_DestroyWindow(icon->drawingWin); icon->drawingWin = NULL; icon->myManager = None; icon->wrapper = None; } if (icon->drawingWin) { XembedSetState(icon, icon->visible ? XEMBED_MAPPED : 0); } } if (mask & ICON_CONF_IMAGE) { TrayIconForceImageChange(icon); } if (mask & ICON_CONF_REDISPLAY) { EventuallyRedrawIcon(icon); } } /* *---------------------------------------------------------------------- * * TrayIconConfigureMethod -- * * Returns TCL_ERROR if some option is invalid, * or else retrieve resource references and free old resources. * * Results: * Widget configured. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int TrayIconConfigureMethod( DockIcon *icon, Tcl_Interp* interp, int objc, Tcl_Obj *const objv[], int addflags) { Tk_SavedOptions saved; Tk_Image newImage = NULL; int mask = 0; if (objc <= 1 && !(addflags & ICON_CONF_FIRST_TIME)) { Tcl_Obj* info = Tk_GetOptionInfo(interp, (char*)icon, icon->options, objc? objv[0] : NULL, icon->tkwin); if (info) { Tcl_SetObjResult(interp,info); return TCL_OK; } else { return TCL_ERROR; /* msg by Tk_GetOptionInfo */ } } if (Tk_SetOptions(interp,(char*)icon,icon->options,objc,objv, icon->tkwin,&saved,&mask) != TCL_OK) { return TCL_ERROR; /* msg by Tk_SetOptions */ } mask |= addflags; /* now check option validity */ if (mask & ICON_CONF_IMAGE) { if (icon->imageString) { newImage = Tk_GetImage(interp, icon->tkwin, icon->imageString, TrayIconImageChanged, (ClientData)icon); if (!newImage) { Tk_RestoreSavedOptions(&saved); return TCL_ERROR; /* msg by Tk_GetImage */ } } if (icon->image) { Tk_FreeImage(icon->image); icon->image = NULL; } if (icon->imageVisualInstance) { Tk_FreeImage(icon->imageVisualInstance); icon->imageVisualInstance = NULL; } icon->image = newImage; /* may be null, as intended */ icon->photo = NULL; /* invalidate photo reference */ } Tk_FreeSavedOptions(&saved); /* Now as we are reconfigured... */ TrayIconUpdate(icon,mask); return TCL_OK; } /* *---------------------------------------------------------------------- * * TrayIconDeleteProc -- * * Delete tray window and clean up. * * Results: * Window destroyed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void TrayIconDeleteProc( ClientData cd ) { DockIcon *icon = (DockIcon *)cd; Tk_DestroyWindow(icon->tkwin); } /* *---------------------------------------------------------------------- * * TrayIconCreateCmd -- * * Create tray command and (unreal) window. * * Results: * Icon tray and hidden window created. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int TrayIconCreateCmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tk_Window mainWindow = (Tk_Window)cd; DockIcon *icon; icon = (DockIcon*)attemptckalloc(sizeof(DockIcon)); if (!icon) { Tcl_SetObjResult(interp, Tcl_NewStringObj("running out of memory", -1)); goto handleErrors; } memset(icon,0,sizeof(*icon)); if (objc < 2||(objc%2)) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?option value ...?"); goto handleErrors; } /* It's not a toplevel window by now. It really doesn't matter, * because it's not really shown. */ icon->tkwin = Tk_CreateWindowFromPath(interp, mainWindow, Tcl_GetString(objv[1]),""); if (icon->tkwin == NULL) { goto handleErrors; } /* Subscribe to StructureNotify */ TKU_AddInput(Tk_Display(icon->tkwin), RootWindowOfScreen(Tk_Screen(icon->tkwin)),StructureNotifyMask); TKU_AddInput(Tk_Display(icon->tkwin), RootWindow(Tk_Display(icon->tkwin),0),StructureNotifyMask); /* Spec says "screen 0" not "default", but... */ TKU_AddInput(Tk_Display(icon->tkwin), DefaultRootWindow(Tk_Display(icon->tkwin)),StructureNotifyMask); /* Early tracking of DestroyNotify is essential */ Tk_CreateEventHandler(icon->tkwin,StructureNotifyMask, UserIconEvent,(ClientData)icon); /* Now try setting options */ icon->options = Tk_CreateOptionTable(interp,IconOptionSpec); /* Class name is used for retrieving defaults, so... */ Tk_SetClass(icon->tkwin, Tk_GetUid("TrayIcon")); if (Tk_InitOptions(interp,(char*)icon,icon->options,icon->tkwin) != TCL_OK) { goto handleErrors; } icon->a_NET_SYSTEM_TRAY_Sn = DockSelectionAtomFor(icon->tkwin); icon->a_NET_SYSTEM_TRAY_OPCODE = Tk_InternAtom(icon->tkwin,"_NET_SYSTEM_TRAY_OPCODE"); icon->a_NET_SYSTEM_TRAY_MESSAGE_DATA = Tk_InternAtom(icon->tkwin,"_NET_SYSTEM_TRAY_MESSAGE_DATA"); icon->a_NET_SYSTEM_TRAY_ORIENTATION = Tk_InternAtom(icon->tkwin,"_NET_SYSTEM_TRAY_ORIENTATION"); icon->a_NET_SYSTEM_TRAY_VISUAL = Tk_InternAtom(icon->tkwin,"_NET_SYSTEM_TRAY_VISUAL"); icon->a_XEMBED_INFO = Tk_InternAtom(icon->tkwin,"_XEMBED_INFO"); icon->aMANAGER = Tk_InternAtom(icon->tkwin,"MANAGER"); icon->interp = interp; icon->trayManager = XGetSelectionOwner(Tk_Display(icon->tkwin), icon->a_NET_SYSTEM_TRAY_Sn); if (icon->trayManager) { XSelectInput(Tk_Display(icon->tkwin),icon->trayManager, StructureNotifyMask); } Tk_CreateGenericHandler(IconGenericHandler, (ClientData)icon); if (objc>3) { if (TrayIconConfigureMethod(icon, interp, objc-2, objv+2, ICON_CONF_XEMBED|ICON_CONF_IMAGE|ICON_CONF_FIRST_TIME) != TCL_OK) { goto handleErrors; } } icon->widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[1]), TrayIconObjectCmd, (ClientData)icon, TrayIconDeleteProc); /* Sometimes a command just can't be created... */ if (!icon->widgetCmd) { goto handleErrors; } Tcl_SetObjResult(interp,objv[1]); return TCL_OK; handleErrors: /* Rolling back */ if (icon) { if (icon->options) { Tk_DeleteOptionTable(icon->options); icon->options = NULL; } if (icon->tkwin) { /* Resources will be freed by DestroyNotify handler */ Tk_DestroyWindow(icon->tkwin); } ckfree((char*)icon); } return TCL_ERROR; } /* *---------------------------------------------------------------------- * * Tktray_Init -- * * Initialize the command. * * Results: * Command initialized. * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tktray_Init( Tcl_Interp *interp) { Tcl_CreateObjCommand(interp, "::tk::systray::_systray", TrayIconCreateCmd, Tk_MainWindow(interp), NULL); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to unix/tkUnixWm.c.
1 2 3 4 5 6 7 8 | /* * tkUnixWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window * manager. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkUnixWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window * manager. * * Copyright © 1991-1994 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" |
︙ | ︙ | |||
46 47 48 49 50 51 52 | double alpha; /* Transparency; 0.0=transparent, 1.0=opaque */ int topmost; /* Flag: true=>stay-on-top */ int zoomed; /* Flag: true=>maximized */ int fullscreen; /* Flag: true=>fullscreen */ } WmAttributes; typedef enum { | | | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | double alpha; /* Transparency; 0.0=transparent, 1.0=opaque */ int topmost; /* Flag: true=>stay-on-top */ int zoomed; /* Flag: true=>maximized */ int fullscreen; /* Flag: true=>fullscreen */ } WmAttributes; typedef enum { WMATT_ALPHA, WMATT_FULLSCREEN, WMATT_TOPMOST, WMATT_TYPE, WMATT_ZOOMED, _WMATT_LAST_ATTRIBUTE } WmAttribute; static const char *const WmAttributeNames[] = { "-alpha", "-fullscreen", "-topmost", "-type", "-zoomed", NULL }; /* * A data structure of the following type holds window-manager-related * information for each top-level window in an application. */ |
︙ | ︙ | |||
409 410 411 412 413 414 415 416 417 418 419 420 421 422 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); | > > > | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbadgeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); |
︙ | ︙ | |||
464 465 466 467 468 469 470 471 472 473 474 475 476 477 | Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); | > > > | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTouchCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); |
︙ | ︙ | |||
706 707 708 709 710 711 712 | wmPtr->flags |= WM_UPDATE_SIZE_HINTS; UpdateHints(winPtr); UpdateWmProtocols(wmPtr); if (wmPtr->cmdArgv != NULL) { UpdateCommand(winPtr); } if (wmPtr->clientMachine != NULL) { | | | 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | wmPtr->flags |= WM_UPDATE_SIZE_HINTS; UpdateHints(winPtr); UpdateWmProtocols(wmPtr); if (wmPtr->cmdArgv != NULL) { UpdateCommand(winPtr); } if (wmPtr->clientMachine != NULL) { (void)Tcl_UtfToExternalDStringEx(NULL, wmPtr->clientMachine, -1, TCL_ENCODING_NOCOMPLAIN, &ds); if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1, &textProp) != 0) { unsigned long pid = (unsigned long) getpid(); XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window, &textProp); XFree((char *) textProp.value); |
︙ | ︙ | |||
978 979 980 981 982 983 984 | return; } if (winPtr->classUid != NULL) { XClassHint *classPtr; Tcl_DString name, ds; | | | | 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 | return; } if (winPtr->classUid != NULL) { XClassHint *classPtr; Tcl_DString name, ds; (void)Tcl_UtfToExternalDStringEx(NULL, winPtr->nameUid, -1, TCL_ENCODING_NOCOMPLAIN, &name); (void)Tcl_UtfToExternalDStringEx(NULL, winPtr->classUid, -1, TCL_ENCODING_NOCOMPLAIN, &ds); classPtr = XAllocClassHint(); classPtr->res_name = Tcl_DStringValue(&name); classPtr->res_class = Tcl_DStringValue(&ds); XSetClassHint(winPtr->display, winPtr->wmInfoPtr->wrapperPtr->window, classPtr); XFree((char *) classPtr); Tcl_DStringFree(&name); |
︙ | ︙ | |||
1012 1013 1014 1015 1016 1017 1018 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", | | | | | | 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", "frame", "geometry", "grid", "group", "iconbadge", "iconbitmap", "iconify", "iconmask", "iconname", "iconphoto", "iconposition", "iconwindow", "manage", "maxsize", "minsize", "overrideredirect", "positionfrom", "protocol", "resizable", "sizefrom", "stackorder", "state", "title", "touch", "transient", "withdraw", NULL }; enum options { WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS, WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FORGET, WMOPT_FRAME, WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBADGE, WMOPT_ICONBITMAP, WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME, WMOPT_ICONPHOTO, WMOPT_ICONPOSITION, WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TOUCH, WMOPT_TRANSIENT, WMOPT_WITHDRAW }; int index; const char *argv1; TkWindow *winPtr; Tk_Window targetWin; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objc < 2) { |
︙ | ︙ | |||
1078 1079 1080 1081 1082 1083 1084 | goto wrongNumArgs; } if (TkGetWindowFromObj(interp, tkwin, objv[2], &targetWin) != TCL_OK) { return TCL_ERROR; } winPtr = (TkWindow *) targetWin; | | | | 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | goto wrongNumArgs; } if (TkGetWindowFromObj(interp, tkwin, objv[2], &targetWin) != TCL_OK) { return TCL_ERROR; } winPtr = (TkWindow *) targetWin; if (!Tk_IsTopLevel(winPtr) && (index != WMOPT_MANAGE) && (index != WMOPT_TOUCH) && (index != WMOPT_FORGET)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't a top-level window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TOPLEVEL", winPtr->pathName, NULL); return TCL_ERROR; } |
︙ | ︙ | |||
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | return WmFrameCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GEOMETRY: return WmGeometryCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GRID: return WmGridCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GROUP: return WmGroupCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBITMAP: return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONIFY: return WmIconifyCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONMASK: return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONNAME: | > > | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | return WmFrameCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GEOMETRY: return WmGeometryCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GRID: return WmGridCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GROUP: return WmGroupCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBADGE: return WmIconbadgeCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBITMAP: return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONIFY: return WmIconifyCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONMASK: return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONNAME: |
︙ | ︙ | |||
1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | return WmSizefromCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STACKORDER: return WmStackorderCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STATE: return WmStateCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TITLE: return WmTitleCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TRANSIENT: return WmTransientCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_WITHDRAW: return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv); } /* This should not happen */ | > > | 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 | return WmSizefromCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STACKORDER: return WmStackorderCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STATE: return WmStateCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TITLE: return WmTitleCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TOUCH: return WmTouchCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TRANSIENT: return WmTransientCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_WITHDRAW: return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv); } /* This should not happen */ |
︙ | ︙ | |||
1485 1486 1487 1488 1489 1490 1491 | } wmPtr->clientMachine = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->clientMachine, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; Tcl_DString ds; | | | 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | } wmPtr->clientMachine = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->clientMachine, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; Tcl_DString ds; (void)Tcl_UtfToExternalDStringEx(NULL, wmPtr->clientMachine, -1, TCL_ENCODING_NOCOMPLAIN, &ds); if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1, &textProp) != 0) { unsigned long pid = (unsigned long) getpid(); XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window, &textProp); XFree((char *) textProp.value); |
︙ | ︙ | |||
2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 | wmPtr->hints.flags |= WindowGroupHint; wmPtr->leaderName = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->leaderName, argv3); } UpdateHints(winPtr); return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconbitmapCmd -- * * This function is invoked to process the "wm iconbitmap" Tcl command. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 | wmPtr->hints.flags |= WindowGroupHint; wmPtr->leaderName = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->leaderName, argv3); } UpdateHints(winPtr); return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconbadgeCmd -- * * This function is invoked to process the "wm iconbadge" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconbadgeCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *tkWin, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { (void) tkWin; char cmd[4096]; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window badge"); return TCL_ERROR; } sprintf(cmd, "::tk::icons::IconBadge {%s} {%s}", Tcl_GetString(objv[2]), Tcl_GetString(objv[3])); if (Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_DIRECT) != TCL_OK) { return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconbitmapCmd -- * * This function is invoked to process the "wm iconbitmap" Tcl command. |
︙ | ︙ | |||
3071 3072 3073 3074 3075 3076 3077 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } | | | 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } cmd = Tcl_GetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { protPtr = (ProtocolHandler *)ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; protPtr->interp = interp; memcpy(protPtr->command, cmd, cmdLength + 1); |
︙ | ︙ | |||
3364 3365 3366 3367 3368 3369 3370 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { | | | | 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "iconic", "normal", "withdrawn", NULL }; enum options { OPT_ICONIC, OPT_NORMAL, OPT_WITHDRAWN }; int index; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); return TCL_ERROR; } if (objc == 4) { |
︙ | ︙ | |||
3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmTransientCmd -- * * This function is invoked to process the "wm transient" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmTouchCmd -- * * This function is invoked to process the "wm touch" Tcl command. See * the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmTouchCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { (void)winPtr; (void)interp; (void)objc; (void)objv; /* TODO: to be implemented yet */ return TCL_ERROR; } /* *---------------------------------------------------------------------- * * WmTransientCmd -- * * This function is invoked to process the "wm transient" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. |
︙ | ︙ | |||
3592 3593 3594 3595 3596 3597 3598 | "can't make \"%s\" a container: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; | | | 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 | "can't make \"%s\" a container: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; w = (TkWindow *)w->wmInfoPtr->containerPtr) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't set \"%s\" as container: would cause management loop", Tk_PathName(containerPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
4705 4706 4707 4708 4709 4710 4711 | * of 4/24/91) where they don't interpret coordinates according to * ICCCM. Moving a window to its current location may cause it to shift * position on the screen. */ if ((winPtr->flags & (TK_EMBEDDED|TK_BOTH_HALVES)) == (TK_EMBEDDED|TK_BOTH_HALVES)) { | | | | 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 | * of 4/24/91) where they don't interpret coordinates according to * ICCCM. Moving a window to its current location may cause it to shift * position on the screen. */ if ((winPtr->flags & (TK_EMBEDDED|TK_BOTH_HALVES)) == (TK_EMBEDDED|TK_BOTH_HALVES)) { Tk_Window childPtr = Tk_GetOtherWindow((Tk_Window)winPtr); /* * This window is embedded and the container is also in this process, * so we don't need to do anything special about the geometry, except * to make sure that the desired size is known by the container. Also, * zero out any position information, since embedded windows are not * allowed to move. */ wmPtr->x = wmPtr->y = 0; wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y); height += wmPtr->menuHeight; if (childPtr != NULL) { Tk_GeometryRequest(childPtr, width, height); } return; } serial = NextRequest(winPtr->display); height += wmPtr->menuHeight; if (wmPtr->flags & WM_MOVE_PENDING) { if ((x + wmPtr->xInParent == winPtr->changes.x) && |
︙ | ︙ | |||
4928 4929 4930 4931 4932 4933 4934 | Tcl_DString ds; /* * Set window title: */ string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid; | | | | 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 | Tcl_DString ds; /* * Set window title: */ string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid; (void)Tcl_UtfToExternalDStringEx(NULL, string, -1, TCL_ENCODING_NOCOMPLAIN, &ds); XStoreName(winPtr->display, wmPtr->wrapperPtr->window, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_NAME", XA_UTF8_STRING, 8, string, strlen(string)); /* * Set icon name: */ if (wmPtr->iconName != NULL) { (void)Tcl_UtfToExternalDStringEx(NULL, wmPtr->iconName, -1, TCL_ENCODING_NOCOMPLAIN, &ds); XSetIconName(winPtr->display, wmPtr->wrapperPtr->window, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_ICON_NAME", XA_UTF8_STRING, 8, wmPtr->iconName, strlen(wmPtr->iconName)); } |
︙ | ︙ | |||
5458 5459 5460 5461 5462 5463 5464 | if (objc > 0) { atoms = (Atom *)ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { Tcl_DString ds, dsName; TkSizeT len; | | | | 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 | if (objc > 0) { atoms = (Atom *)ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { Tcl_DString ds, dsName; TkSizeT len; char *name = Tcl_GetStringFromObj(objv[n], &len); Tcl_UtfToUpper(name); (void)Tcl_UtfToExternalDStringEx(NULL, name, len, TCL_ENCODING_NOCOMPLAIN, &dsName); Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "_NET_WM_WINDOW_TYPE_", 20); Tcl_DStringAppend(&ds, Tcl_DStringValue(&dsName), Tcl_DStringLength(&dsName)); Tcl_DStringFree(&dsName); atoms[n] = Tk_InternAtom(tkwin, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); |
︙ | ︙ | |||
5525 5526 5527 5528 5529 5530 5531 | if (GetWindowProperty(wrapperPtr, typeAtom, maxLength, XA_ATOM, &actualType, &actualFormat, &count, &bytesAfter, &propertyValue)){ atoms = (Atom *) propertyValue; for (n = 0; n < count; ++n) { const char *name = Tk_GetAtomName(tkwin, atoms[n]); if (strncmp("_NET_WM_WINDOW_TYPE_", name, 20) == 0) { | | | 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 | if (GetWindowProperty(wrapperPtr, typeAtom, maxLength, XA_ATOM, &actualType, &actualFormat, &count, &bytesAfter, &propertyValue)){ atoms = (Atom *) propertyValue; for (n = 0; n < count; ++n) { const char *name = Tk_GetAtomName(tkwin, atoms[n]); if (strncmp("_NET_WM_WINDOW_TYPE_", name, 20) == 0) { (void)Tcl_ExternalToUtfDStringEx(NULL, name+20, -1, TCL_ENCODING_NOCOMPLAIN, &ds); Tcl_UtfToLower(Tcl_DStringValue(&ds)); Tcl_ListObjAppendElement(interp, typePtr, Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); Tcl_DStringFree(&ds); } } |
︙ | ︙ | |||
5725 5726 5727 5728 5729 5730 5731 | */ y -= winPtr->wmInfoPtr->menuHeight; winPtr = winPtr->wmInfoPtr->winPtr; continue; } if (winPtr->flags & TK_TOP_LEVEL) { | | | | 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 | */ y -= winPtr->wmInfoPtr->menuHeight; winPtr = winPtr->wmInfoPtr->winPtr; continue; } if (winPtr->flags & TK_TOP_LEVEL) { Tk_Window otherPtr; if (!(winPtr->flags & TK_EMBEDDED)) { break; } otherPtr = Tk_GetOtherWindow((Tk_Window)winPtr); if (otherPtr == NULL) { /* * The container window is not in the same application. Query * the X server. */ Window root, dummyChild; |
︙ | ︙ | |||
5755 5756 5757 5758 5759 5760 5761 | break; } else { /* * The container window is in the same application. Let's * query its coordinates. */ | | | 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 | break; } else { /* * The container window is in the same application. Let's * query its coordinates. */ winPtr = (TkWindow *)otherPtr; continue; } } winPtr = winPtr->parentPtr; if (winPtr == NULL) { break; } |
︙ | ︙ | |||
5889 5890 5891 5892 5893 5894 5895 | return NULL; } } if (wmPtr->wrapperPtr != NULL) { if (child == wmPtr->wrapperPtr->window) { goto gotToplevel; } else if (wmPtr->winPtr->flags & TK_EMBEDDED && | | | 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 | return NULL; } } if (wmPtr->wrapperPtr != NULL) { if (child == wmPtr->wrapperPtr->window) { goto gotToplevel; } else if (wmPtr->winPtr->flags & TK_EMBEDDED && Tk_GetOtherWindow((Tk_Window)wmPtr->winPtr) == NULL) { /* * This toplevel is embedded in a window belonging to * a different application. */ int rx, ry; |
︙ | ︙ | |||
5989 5990 5991 5992 5993 5994 5995 | && (nextPtr->flags & TK_BOTH_HALVES)) { /* * The window containing the point is a container, and the * embedded application is in this same process. Switch over to * the toplevel for the embedded application and start processing * that toplevel from scratch. */ | | | 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 | && (nextPtr->flags & TK_BOTH_HALVES)) { /* * The window containing the point is a container, and the * embedded application is in this same process. Switch over to * the toplevel for the embedded application and start processing * that toplevel from scratch. */ winPtr = (TkWindow *)Tk_GetOtherWindow((Tk_Window)nextPtr); if (winPtr == NULL) { return (Tk_Window) nextPtr; } wmPtr = winPtr->wmInfoPtr; childX = x; childY = y; goto gotToplevel; |
︙ | ︙ | |||
6995 6996 6997 6998 6999 7000 7001 | winPtr = wmPtr->winPtr; if (winPtr->window == None) { Tk_MakeWindowExist((Tk_Window) winPtr); } /* * The code below is copied from CreateTopLevelWindow, Tk_MakeWindowExist, | | | 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 | winPtr = wmPtr->winPtr; if (winPtr->window == None) { Tk_MakeWindowExist((Tk_Window) winPtr); } /* * The code below is copied from CreateTopLevelWindow, Tk_MakeWindowExist, * and Tk_MakeWindow. The idea is to create an "official" Tk window (so * that we can get events on it), but to hide the window outside the * official Tk hierarchy so that it isn't visible to the application. See * the comments for the other functions if you have questions about this * code. */ wmPtr->wrapperPtr = wrapperPtr = TkAllocWindow(winPtr->dispPtr, |
︙ | ︙ | |||
7335 7336 7337 7338 7339 7340 7341 | * entire DString is done. */ cmdArgv = (char **)ckalloc(sizeof(char *) * wmPtr->cmdArgc); offsets = (int *)ckalloc(sizeof(int) * wmPtr->cmdArgc); Tcl_DStringInit(&cmds); for (i = 0; i < wmPtr->cmdArgc; i++) { | | | 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 | * entire DString is done. */ cmdArgv = (char **)ckalloc(sizeof(char *) * wmPtr->cmdArgc); offsets = (int *)ckalloc(sizeof(int) * wmPtr->cmdArgc); Tcl_DStringInit(&cmds); for (i = 0; i < wmPtr->cmdArgc; i++) { (void)Tcl_UtfToExternalDStringEx(NULL, wmPtr->cmdArgv[i], -1, TCL_ENCODING_NOCOMPLAIN, &ds); offsets[i] = Tcl_DStringLength(&cmds); Tcl_DStringAppend(&cmds, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)+1); Tcl_DStringFree(&ds); } cmdArgv[0] = Tcl_DStringValue(&cmds); for (i = 1; i < wmPtr->cmdArgc; i++) { |
︙ | ︙ |
Changes to unix/tkUnixXId.c.
1 2 3 | /* * tkUnixXId.c -- * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | /* * tkUnixXId.c -- * * Copyright © 1993 The Regents of the University of California. * Copyright © 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" |
︙ | ︙ |
Changes to win/Makefile.in.
︙ | ︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 | TCL_GENERIC_NATIVE = $(shell $(CYGPATH) '$(TCL_GENERIC_DIR)') TCL_PLATFORM_NATIVE = $(shell $(CYGPATH) '$(TCL_PLATFORM_DIR)') TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)') DLLSUFFIX = @DLLSUFFIX@ LIBSUFFIX = @LIBSUFFIX@ EXESUFFIX = @EXESUFFIX@ 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} | > > > > > > > > > | | | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | TCL_GENERIC_NATIVE = $(shell $(CYGPATH) '$(TCL_GENERIC_DIR)') TCL_PLATFORM_NATIVE = $(shell $(CYGPATH) '$(TCL_PLATFORM_DIR)') TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)') DLLSUFFIX = @DLLSUFFIX@ LIBSUFFIX = @LIBSUFFIX@ EXESUFFIX = @EXESUFFIX@ TCLVER = @TCL_MAJOR_VERSION@@TCL_MINOR_VERSION@ VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@ DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@ TK_ZIP_FILE = @TK_ZIP_FILE@ TK_VFS_PATH = libtk.vfs/tk_library TK_VFS_ROOT = libtk.vfs TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ TK_LIB_FILE = @TK_LIB_FILE@ TK_DLL_FILE = @TK_DLL_FILE@ TK_DLL_FILE_TCL8 = @TK_DLL_FILE_TCL8@ TK_DLL_FILE_TCL9 = @TK_DLL_FILE_TCL9@ TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX} 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${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 # dependencies. |
︙ | ︙ | |||
161 162 163 164 165 166 167 | LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ # 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) | | | < < | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ # 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=1 -D__USE_MINGW_ANSI_STDIO=0 # Special compiler flags to use when building man2tcl on Windows. MAN2TCLFLAGS = @MAN2TCLFLAGS@ AR = @AR@ RANLIB = @RANLIB@ CC = @CC@ RC = @RC@ RES = @RES@ TK_RES = @TK_RES@ AC_FLAGS = @EXTRA_CFLAGS@ @DEFS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ @LDFLAGS_DEFAULT@ LDFLAGS_CONSOLE = @LDFLAGS_CONSOLE@ LDFLAGS_WINDOW = @LDFLAGS_WINDOW@ OBJEXT = @OBJEXT@ STLIB_LD = @STLIB_LD@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_SUFFIX = @SHLIB_SUFFIX@ LIBS = $(TCL_STUB_LIB_FILE) @LIBS@ @LIBS_GUI@ RMDIR = rm -rf MKDIR = mkdir -p SHELL = @SHELL@ RM = rm -f COPY = cp LN = ln # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # TCL_EXE is the name of a tclsh executable that is available *BEFORE* # running make for the first time. Certain build targets (make genstubs) # need it to be available on the PATH. This executable should *NOT* be # required just to do a normal build although it can be required to run # make dist. TCL_EXE = @TCLSH_PROG@ WINE = @WINE@ ### # Tip 430 - ZipFS Modifications ### TK_ZIP_FILE = @TK_ZIP_FILE@ TK_VFS_PATH = libtk.vfs/tk_library TK_VFS_ROOT = libtk.vfs HOST_CC = @CC_FOR_BUILD@ HOST_EXEEXT = @EXEEXT_FOR_BUILD@ HOST_OBJEXT = @OBJEXT_FOR_BUILD@ ZIPFS_BUILD = @ZIPFS_BUILD@ NATIVE_ZIP = @ZIP_PROG@ ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@ ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@ SHARED_BUILD = @SHARED_BUILD@ INSTALL_MSGS = @INSTALL_MSGS@ INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ # Minizip MINIZIP_OBJS = \ adler32.$(HOST_OBJEXT) \ compress.$(HOST_OBJEXT) \ crc32.$(HOST_OBJEXT) \ deflate.$(HOST_OBJEXT) \ infback.$(HOST_OBJEXT) \ inffast.$(HOST_OBJEXT) \ inflate.$(HOST_OBJEXT) \ inftrees.$(HOST_OBJEXT) \ ioapi.$(HOST_OBJEXT) \ iowin32.$(HOST_OBJEXT) \ trees.$(HOST_OBJEXT) \ uncompr.$(HOST_OBJEXT) \ zip.$(HOST_OBJEXT) \ zutil.$(HOST_OBJEXT) \ minizip.$(HOST_OBJEXT) ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@ CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ -I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \ -I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \ -I"${TCL_GENERIC_NATIVE}" -I"${TCL_PLATFORM_NATIVE}" \ ${AC_FLAGS} $(NO_DEPRECATED_FLAGS) -DTCL_UTF_MAX=3 -DUSE_TCL_STUBS CC_OBJNAME = @CC_OBJNAME@ CC_EXENAME = @CC_EXENAME@ # Tk used to let the configure script choose which program to use # for installing, but there are just too many different versions of # "install" around; better to use the install-sh script that comes |
︙ | ︙ | |||
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | tkWinColor.$(OBJEXT) \ tkWinConfig.$(OBJEXT) \ tkWinCursor.$(OBJEXT) \ tkWinDialog.$(OBJEXT) \ tkWinDraw.$(OBJEXT) \ tkWinEmbed.$(OBJEXT) \ tkWinFont.$(OBJEXT) \ tkWinImage.$(OBJEXT) \ tkWinInit.$(OBJEXT) \ tkWinKey.$(OBJEXT) \ tkWinMenu.$(OBJEXT) \ tkWinPixmap.$(OBJEXT) \ tkWinPointer.$(OBJEXT) \ tkWinRegion.$(OBJEXT) \ tkWinScrlbr.$(OBJEXT) \ tkWinSend.$(OBJEXT) \ tkWinSendCom.$(OBJEXT) \ tkWinWindow.$(OBJEXT) \ tkWinWm.$(OBJEXT) \ tkWinX.$(OBJEXT) \ stubs.$(OBJEXT) \ tk3d.$(OBJEXT) \ tkArgv.$(OBJEXT) \ tkAtom.$(OBJEXT) \ | > > > | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | tkWinColor.$(OBJEXT) \ tkWinConfig.$(OBJEXT) \ tkWinCursor.$(OBJEXT) \ tkWinDialog.$(OBJEXT) \ tkWinDraw.$(OBJEXT) \ tkWinEmbed.$(OBJEXT) \ tkWinFont.$(OBJEXT) \ tkWinGDI.$(OBJEXT) \ tkWinIco.$(OBJEXT) \ tkWinImage.$(OBJEXT) \ tkWinInit.$(OBJEXT) \ tkWinKey.$(OBJEXT) \ tkWinMenu.$(OBJEXT) \ tkWinPixmap.$(OBJEXT) \ tkWinPointer.$(OBJEXT) \ tkWinRegion.$(OBJEXT) \ tkWinScrlbr.$(OBJEXT) \ tkWinSend.$(OBJEXT) \ tkWinSendCom.$(OBJEXT) \ tkWinSysTray.$(OBJEXT) \ tkWinWindow.$(OBJEXT) \ tkWinWm.$(OBJEXT) \ tkWinX.$(OBJEXT) \ stubs.$(OBJEXT) \ tk3d.$(OBJEXT) \ tkArgv.$(OBJEXT) \ tkAtom.$(OBJEXT) \ |
︙ | ︙ | |||
306 307 308 309 310 311 312 313 314 315 316 317 318 319 | tkFont.$(OBJEXT) \ tkFrame.$(OBJEXT) \ tkGC.$(OBJEXT) \ tkGeometry.$(OBJEXT) \ tkGet.$(OBJEXT) \ tkGrab.$(OBJEXT) \ tkGrid.$(OBJEXT) \ tkImage.$(OBJEXT) \ tkImgBmap.$(OBJEXT) \ tkImgListFormat.$(OBJEXT) \ tkImgGIF.$(OBJEXT) \ tkImgPNG.$(OBJEXT) \ tkImgPPM.$(OBJEXT) \ tkImgSVGnano.$(OBJEXT) \ | > | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | tkFont.$(OBJEXT) \ tkFrame.$(OBJEXT) \ tkGC.$(OBJEXT) \ tkGeometry.$(OBJEXT) \ tkGet.$(OBJEXT) \ tkGrab.$(OBJEXT) \ tkGrid.$(OBJEXT) \ tkIcu.$(OBJEXT) \ tkImage.$(OBJEXT) \ tkImgBmap.$(OBJEXT) \ tkImgListFormat.$(OBJEXT) \ tkImgGIF.$(OBJEXT) \ tkImgPNG.$(OBJEXT) \ tkImgPPM.$(OBJEXT) \ tkImgSVGnano.$(OBJEXT) \ |
︙ | ︙ | |||
481 482 483 484 485 486 487 | echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \ $(COPY) $$i "$(BIN_INSTALL_DIR)"; \ fi; \ done @echo "Creating package index $(PKG_INDEX)"; @$(RM) $(PKG_INDEX); @(\ | | > > > | > > | > > > > | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \ $(COPY) $$i "$(BIN_INSTALL_DIR)"; \ fi; \ done @echo "Creating package index $(PKG_INDEX)"; @$(RM) $(PKG_INDEX); @(\ echo "if {![package vsatisfies [package provide Tcl] 8.6-]} return";\ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtcl9tk$(VERSION).dll]]]";\ echo " } else {";\ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]]]";\ echo " }";\ echo "} else {";\ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE_TCL9)]]]";\ echo " } else {";\ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE_TCL8)]]]";\ echo " }";\ echo "}";\ echo "package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list package require -exact tk $(VERSION)$(PATCH_LEVEL)]";\ ) > $(PKG_INDEX); @for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \ do \ if [ -f $$i ]; then \ echo "Installing $$i to $(LIB_INSTALL_DIR)/"; \ $(COPY) $$i "$(LIB_INSTALL_DIR)"; \ fi; \ |
︙ | ︙ | |||
605 606 607 608 609 610 611 | @for i in "$(GENERIC_DIR)/tkInt.h" "$(GENERIC_DIR)/tkIntDecls.h" \ "$(GENERIC_DIR)/tkIntPlatDecls.h" "$(GENERIC_DIR)/tkPort.h" \ "$(WIN_DIR)/tkWinPort.h" "$(WIN_DIR)/tkWinInt.h" "$(WIN_DIR)/tkWin.h"; \ do \ $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \ done; | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | @for i in "$(GENERIC_DIR)/tkInt.h" "$(GENERIC_DIR)/tkIntDecls.h" \ "$(GENERIC_DIR)/tkIntPlatDecls.h" "$(GENERIC_DIR)/tkPort.h" \ "$(WIN_DIR)/tkWinPort.h" "$(WIN_DIR)/tkWinInt.h" "$(WIN_DIR)/tkWin.h"; \ do \ $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \ done; $(WISH): $(WISH_OBJS) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES) ${TK_ZIP_FILE} $(CC) $(CFLAGS) $(WISH_OBJS) $(TK_LIB_FILE) \ $(TK_STUB_LIB_FILE) $(TCL_LIB_FILE) $(LIBS) \ wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW) @VC_MANIFEST_EMBED_EXE@ @if test "${ZIPFS_BUILD}" = "2" ; then \ cat ${TK_ZIP_FILE} >> ${WISH}; \ ${NATIVE_ZIP} -A ${WISH} \ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \ fi tktest: $(TKTEST) $(TKTEST): testMain.$(OBJEXT) $(TEST_DLL_FILE) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES) $(CC) $(CFLAGS) testMain.$(OBJEXT) $(TEST_LIB_FILE) $(TK_LIB_FILE) \ $(TK_STUB_LIB_FILE) $(TCL_LIB_FILE) $(LIBS) \ wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW) @VC_MANIFEST_EMBED_EXE@ ${TEST_DLL_FILE}: ${TKTEST_OBJS} ${TK_STUB_LIB_FILE} @MAKE_DLL@ ${TKTEST_OBJS} $(TK_STUB_LIB_FILE) $(SHLIB_LD_LIBS) $(TOP_DIR)/manifest.uuid: printf "git-" >$(TOP_DIR)/manifest.uuid (cd $(TOP_DIR); git rev-parse HEAD >>$(TOP_DIR)/manifest.uuid || printf "unknown" >$(TOP_DIR)/manifest.uuid) tkUuid.h: $(TOP_DIR)/manifest.uuid echo "#define TK_VERSION_UUID \\" >$@ cat $(TOP_DIR)/manifest.uuid >>$@ echo "" >>$@ # Msys make requires this next rule for some reason. $(TCL_SRC_DIR)/win/cat.c: cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME) $(CAT32): cat32.${OBJEXT} $(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE) tkzipfile: ${TK_ZIP_FILE} ${TK_ZIP_FILE}: ${ZIP_INSTALL_OBJS} @$(RMDIR) ${TK_VFS_ROOT} @mkdir -p ${TK_VFS_PATH} @echo "creating ${TK_VFS_PATH} (prepare compression)" @( \ $(COPY) -a $(TOP_DIR)/library/* ${TK_VFS_PATH}; \ ) @$(RMDIR) $(TK_VFS_PATH)/demos -@if test "${ZIPFS_BUILD}" = "2" ; then \ cp ${TCL_BIN_DIR}/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE} || cp ${TCL_BIN_DIR}/../bin/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE}; \ (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \ (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \ cd ${TK_VFS_ROOT} && $$zip -J ../${TK_ZIP_FILE}) \ fi (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \ (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \ cd ${TK_VFS_ROOT} && \ $$zip ${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} >/dev/null && \ echo "${TK_ZIP_FILE} successful created with $$zip" && \ cd ..) # The following targets are configured by autoconf to generate either # a shared library or static library ${TK_STUB_LIB_FILE}: ${STUB_OBJS} @$(RM) ${TK_STUB_LIB_FILE} @MAKE_STUB_LIB@ ${STUB_OBJS} @POST_MAKE_LIB@ ${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES) ${TK_ZIP_FILE} @$(RM) ${TK_DLL_FILE} @MAKE_DLL@ ${TK_OBJS} $(TK_RES) $(SHLIB_LD_LIBS) @VC_MANIFEST_EMBED_DLL@ @if test "${ZIPFS_BUILD}" = "1" ; then \ cat ${TK_ZIP_FILE} >> ${TK_DLL_FILE}; \ ${NATIVE_ZIP} -A ${TK_DLL_FILE} \ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \ fi ${TK_LIB_FILE}: ${TK_OBJS} @$(RM) ${TK_LIB_FILE} @MAKE_LIB@ ${TK_OBJS} @POST_MAKE_LIB@ # Special case object file targets |
︙ | ︙ | |||
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | tkWinTest.$(OBJEXT): tkWinTest.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) tkSquare.$(OBJEXT): tkSquare.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) tkMain2.$(OBJEXT): tkMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME) tkUnixMenubu.$(OBJEXT): ${UNIX_DIR}/tkUnixMenubu.c $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME) tkUnixScale.$(OBJEXT): ${UNIX_DIR}/tkUnixScale.c $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME) # Extra dependency info tkConsole.$(OBJEXT): configure Makefile tkMain.$(OBJEXT): configure Makefile tkMain2.$(OBJEXT): configure Makefile | > > > > > > > > > > > > > > > < | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | tkWinTest.$(OBJEXT): tkWinTest.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) tkSquare.$(OBJEXT): tkSquare.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) tkStubLib.$(OBJEXT): tkStubLib.c $(CC) -c $(CC_SWITCHES) @CFLAGS_NOLTO@ @DEPARG@ $(CC_OBJNAME) ttkStubLib.$(OBJEXT): ${TTK_DIR}/ttkStubLib.c $(CC) -c $(CC_SWITCHES) @CFLAGS_NOLTO@ @DEPARG@ $(CC_OBJNAME) tkMain2.$(OBJEXT): tkMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME) tkUnixMenubu.$(OBJEXT): ${UNIX_DIR}/tkUnixMenubu.c $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME) tkUnixScale.$(OBJEXT): ${UNIX_DIR}/tkUnixScale.c $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME) tkPkgConfig.$(OBJEXT): $(GENERIC_DIR)/tkPkgConfig.c $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk \ -DCFG_RUNTIME_DLLFILE="\"$(TK_DLL_FILE)\"" \ @DEPARG@ $(CC_OBJNAME) tkWindow.$(OBJEXT): ${GENERIC_DIR}/tkWindow.c configure Makefile tkUuid.h $(CC) -c $(CC_SWITCHES) -I. -DBUILD_tk @DEPARG@ $(CC_OBJNAME) # Extra dependency info tkConsole.$(OBJEXT): configure Makefile tkMain.$(OBJEXT): configure Makefile tkMain2.$(OBJEXT): configure Makefile # Add the object extension to the implicit rules. By default .obj is not # automatically added. .SUFFIXES: .${OBJEXT} .SUFFIXES: .$(RES) .SUFFIXES: .rc |
︙ | ︙ | |||
707 708 709 710 711 712 713 | cleanhelp: $(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl.exe clean: cleanhelp $(RM) *.lib *.a *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out $(RM) $(WISH) $(TKTEST) $(CAT32) | | > | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | cleanhelp: $(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl.exe clean: cleanhelp $(RM) *.lib *.a *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out $(RM) $(WISH) $(TKTEST) $(CAT32) $(RM) *.pch *.ilk *.pdb *.zip $(RMDIR) *.vfs distclean: clean $(RM) Makefile config.status config.cache config.log tkConfig.sh \ wish.exe.manifest Makefile: $(SRC_DIR)/Makefile.in ./config.status |
︙ | ︙ |
Changes to win/configure.
1 2 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. | | | > > | > | > > > > > > > > < < < < < < < < | | < | | < < < < < < | < < < < < < < | > > | < < > | | > > > > > > > > > | > > > > | < < < < < < < > | > > > | | < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for tk 8.7. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also |
︙ | ︙ | |||
148 149 150 151 152 153 154 | *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. | | | | > > | | > | > > | > | | > | > | > > > | | > | > > > > > > | | > | < > | > | | > | | | | | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell [email protected] about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi |
︙ | ︙ | |||
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( | > > > > > > > > > | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q |
︙ | ︙ | |||
366 367 368 369 370 371 372 | } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. | | > | | > | > > > > > > > > | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else |
︙ | ︙ | |||
435 436 437 438 439 440 441 | as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || | | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q |
︙ | ︙ | |||
479 480 481 482 483 484 485 | N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || | | > > > > > > > > > > > | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null |
︙ | ︙ | |||
571 572 573 574 575 576 577 | LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. | | | | | | | | | | | < < < < < < < < < < < < < < > > > > > > > > > > | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tk' PACKAGE_TARNAME='tk' PACKAGE_VERSION='8.7' PACKAGE_STRING='tk 8.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="../generic/tk.h" # Factoring default headers for most tests. ac_includes_default="\ #include <stddef.h> #ifdef HAVE_STDIO_H # include <stdio.h> #endif #ifdef HAVE_STDLIB_H # include <stdlib.h> #endif #ifdef HAVE_STRING_H # include <string.h> #endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #ifdef HAVE_STDINT_H # include <stdint.h> #endif #ifdef HAVE_STRINGS_H # include <strings.h> #endif #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif" ac_header_c_list= ac_subst_vars='LTLIBOBJS LIBOBJS RES RC_DEFINES RC_DEFINE RC_INCLUDE RC_TYPE |
︙ | ︙ | |||
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | TCL_MINOR_VERSION TCL_MAJOR_VERSION TK_BIN_DIR TK_SRC_DIR TK_BUILD_STUB_LIB_SPEC TK_STUB_LIB_FLAG TK_STUB_LIB_FILE TK_DLL_FILE TK_LIB_FILE TK_PATCH_LEVEL TK_MINOR_VERSION TK_MAJOR_VERSION TK_VERSION MACHINE TK_WIN_VERSION TCLSH_PROG BUILD_TCLSH VC_MANIFEST_EMBED_EXE VC_MANIFEST_EMBED_DLL LDFLAGS_DEFAULT CFLAGS_DEFAULT MAN2TCLFLAGS CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG DL_LIBS WINE CYGPATH TCL_DEFS TCL_STUB_LIB_SPEC TCL_STUB_LIB_FLAG TCL_STUB_LIB_FILE TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE | > > > > > > > > > > > > > > > > < < < < | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | TCL_MINOR_VERSION TCL_MAJOR_VERSION TK_BIN_DIR TK_SRC_DIR TK_BUILD_STUB_LIB_SPEC TK_STUB_LIB_FLAG TK_STUB_LIB_FILE TK_DLL_FILE_TCL9 TK_DLL_FILE_TCL8 TK_DLL_FILE TK_LIB_FILE TK_PATCH_LEVEL TK_MINOR_VERSION TK_MAJOR_VERSION TK_VERSION MACHINE TK_WIN_VERSION INSTALL_MSGS INSTALL_LIBRARIES TK_ZIP_FILE ZIPFS_BUILD ZIP_INSTALL_OBJS ZIP_PROG_VFSSEARCH ZIP_PROG_OPTIONS ZIP_PROG EXEEXT_FOR_BUILD CC_FOR_BUILD TCLSH_PROG BUILD_TCLSH VC_MANIFEST_EMBED_EXE VC_MANIFEST_EMBED_DLL EGREP GREP CPP LDFLAGS_DEFAULT CFLAGS_DEFAULT MAN2TCLFLAGS CFLAGS_NOLTO CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG DL_LIBS WINE CYGPATH TCL_DEFS TCL_STUB_LIB_SPEC TCL_STUB_LIB_FLAG TCL_STUB_LIB_FILE TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_VERSION SHARED_BUILD SET_MAKE RC RANLIB AR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC |
︙ | ︙ | |||
734 735 736 737 738 739 740 741 742 743 744 745 746 747 | pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir | > | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir |
︙ | ︙ | |||
762 763 764 765 766 767 768 769 770 771 772 773 774 775 | ac_user_opts=' enable_option_checking enable_shared with_tcl enable_64bit enable_symbols enable_embedded_manifest ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS | > | 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | ac_user_opts=' enable_option_checking enable_shared with_tcl enable_64bit enable_symbols enable_embedded_manifest enable_zipfs ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS |
︙ | ︙ | |||
810 811 812 813 814 815 816 817 818 | sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' | > | | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' |
︙ | ︙ | |||
839 840 841 842 843 844 845 | case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac | < < | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) |
︙ | ︙ | |||
881 882 883 884 885 886 887 | | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | | | | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac |
︙ | ︙ | |||
907 908 909 910 911 912 913 | -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | | | | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 | -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac |
︙ | ︙ | |||
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; | > > > > > > > > > | 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; |
︙ | ︙ | |||
1111 1112 1113 1114 1115 1116 1117 | -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | | | | | | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac |
︙ | ︙ | |||
1173 1174 1175 1176 1177 1178 1179 | as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. | | | | | | 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; |
︙ | ︙ | |||
1255 1256 1257 1258 1259 1260 1261 | ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || | | | 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 | ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q |
︙ | ︙ | |||
1312 1313 1314 1315 1316 1317 1318 | # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF | | | 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures tk 8.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. |
︙ | ︙ | |||
1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] | > | | > > > | 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/tk] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of tk 8.7:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared build and link with shared libraries (default: on) --enable-64bit enable 64bit support (where applicable) --enable-symbols build with debugging symbols (default: off) --enable-embedded-manifest embed manifest if possible (default: yes) --enable-zipfs build with Zipfs support (default: on) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) |
︙ | ︙ | |||
1420 1421 1422 1423 1424 1425 1426 | { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) | | | | 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 | { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix |
︙ | ︙ | |||
1450 1451 1452 1453 1454 1455 1456 | ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } | | > | | | | | | | | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | | | < < < < < < < > | < < < < < > | < < < < < < | < < < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < | | < < < < < < < < < < < < < < < < < < < < < > | < < | < | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF tk configure 8.7 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by tk $as_me 8.7, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## |
︙ | ︙ | |||
1755 1756 1757 1758 1759 1760 1761 | _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS | > | > > > | | 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 | _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF |
︙ | ︙ | |||
1791 1792 1793 1794 1795 1796 1797 | do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) | | | 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 | do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. |
︙ | ︙ | |||
1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 | # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo | > > | | | | 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 | # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac |
︙ | ︙ | |||
1866 1867 1868 1869 1870 1871 1872 | sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo | | | | | | | | | | | < | < < | < < | < < | < < | < < | < < < < | < < < < | < | < > | | > > > > > | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | > | > | | 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 | sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include <stddef.h> #include <stdarg.h> struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include <stdbool.h> extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # The following define is needed when building with Cygwin since newer # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 TK_PATCH_LEVEL="a6" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then |
︙ | ︙ | |||
2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 | #------------------------------------------------------------------------ # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 | > > > > > > > > > | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | > | | | > | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | > | | | | | | > | | | | | | | | | > | | | | > | | | | > > | | | | > | | | | > | | | > | | | > | | | | | | > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | > | < | | < < < | | | < > | > > > > | | | > | | > | | | > | | | | | > | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < | < < < < | < < < < < | | < < < < < | | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | < < < < < < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | | | | > | | | | | | | | | > | < < < < < < < < | | | | | | 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 | #------------------------------------------------------------------------ # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> int main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 printf %s "checking for inline... " >&6; } if test ${ac_cv_c_inline+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo (void) {return 0; } $ac_kw foo_t foo (void) {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RC"; then ac_cv_prog_RC="$RC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RC="${ac_tool_prefix}windres" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RC=$ac_cv_prog_RC if test -n "$RC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 printf "%s\n" "$RC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RC"; then ac_ct_RC=$RC # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RC"; then ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RC="windres" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RC=$ac_cv_prog_ac_ct_RC if test -n "$ac_ct_RC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 printf "%s\n" "$ac_ct_RC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RC" = x; then RC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RC=$ac_ct_RC fi else RC="$ac_cv_prog_RC" fi #-------------------------------------------------------------------- # Checks to see if the make program sets the $MAKE variable. #-------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 printf %s "checking how to build libraries... " >&6; } # Check whether --enable-shared was given. if test ${enable_shared+y} then : enableval=$enable_shared; tcl_ok=$enableval else $as_nop tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: shared" >&5 printf "%s\n" "shared" >&6; } SHARED_BUILD=1 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static" >&5 printf "%s\n" "static" >&6; } SHARED_BUILD=0 printf "%s\n" "#define STATIC_BUILD 1" >>confdefs.h fi #-------------------------------------------------------------------- # Locate and source the tclConfig.sh file. |
︙ | ︙ | |||
3690 3691 3692 3693 3694 3695 3696 | # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl was given. | | > | | | > | | | | | 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 | # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl was given. if test ${with_tcl+y} then : withval=$with_tcl; with_tclconfig="${withval}" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 printf %s "checking for Tcl configuration... " >&6; } if test ${ac_cv_c_tclconfig+y} then : printf %s "(cached) " >&6 else $as_nop # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case "${with_tclconfig}" in */tclConfig.sh ) if test -f "${with_tclconfig}"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5 printf "%s\n" "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;} with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`" fi ;; esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`" else as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5 |
︙ | ︙ | |||
3782 3783 3784 3785 3786 3787 3788 | if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" as_fn_error $? "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" "$LINENO" 5 else no_tcl= TCL_BIN_DIR="${ac_cv_c_tclconfig}" | | | | | | | | | | 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 | if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" as_fn_error $? "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" "$LINENO" 5 else no_tcl= TCL_BIN_DIR="${ac_cv_c_tclconfig}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 printf "%s\n" "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 printf %s "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; } if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: loading" >&5 printf "%s\n" "loading" >&6; } . "${TCL_BIN_DIR}/tclConfig.sh" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 printf "%s\n" "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi # # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC |
︙ | ︙ | |||
3834 3835 3836 3837 3838 3839 3840 |
| < < < < < < < < < < < < < < < < < < | | | > | | | | | | | > | | > | > > > | | | | | | | | | > | | > | > > > | | | | | | | | | | > | | | | > | | | | > > > > > > > | 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 | if test "${TCL_MAJOR_VERSION}" -lt 9 ; then if test "${TCL_MAJOR_VERSION}" != "${TK_MAJOR_VERSION}"; then as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better." "$LINENO" 5 fi if test "${TCL_MINOR_VERSION}" -lt 6; then as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better." "$LINENO" 5 fi fi #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called # after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- # Step 0: Enable 64 bit support? { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5 printf %s "checking if 64bit support is requested... " >&6; } # Check whether --enable-64bit was given. if test ${enable_64bit+y} then : enableval=$enable_64bit; do64bit=$enableval else $as_nop do64bit=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5 printf "%s\n" "$do64bit" >&6; } # Set some defaults (may get changed below) EXTRA_CFLAGS="" printf "%s\n" "#define MODULE_SCOPE extern" >>confdefs.h # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CYGPATH+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CYGPATH"; then ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CYGPATH="cygpath -m" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" fi fi CYGPATH=$ac_cv_prog_CYGPATH if test -n "$CYGPATH"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5 printf "%s\n" "$CYGPATH" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi # Extract the first word of "wine", so it can be a program name with args. set dummy wine; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_WINE+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$WINE"; then ac_cv_prog_WINE="$WINE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_WINE="wine" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi WINE=$ac_cv_prog_WINE if test -n "$WINE"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $WINE" >&5 printf "%s\n" "$WINE" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi SHLIB_SUFFIX=".dll" # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|arm64|ia64. MACHINE="X86" if test "$GCC" = "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cross-compile version of gcc" >&5 printf %s "checking for cross-compile version of gcc... " >&6; } if test ${ac_cv_cross+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _WIN32 #error cross-compiler #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_cross=no else $as_nop ac_cv_cross=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cross" >&5 printf "%s\n" "$ac_cv_cross" >&6; } if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; arm64|aarch64) CC="aarch64-w64-mingw32-${CC}" LD="aarch64-w64-mingw32-ld" AR="aarch64-w64-mingw32-ar" RANLIB="aarch64-w64-mingw32-ranlib" RC="aarch64-w64-mingw32-windres" ;; *) CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" RC="i686-w64-mingw32-windres" ;; |
︙ | ︙ | |||
4041 4042 4043 4044 4045 4046 4047 | if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then conftest=/tmp/conftest.rc echo "STRINGTABLE BEGIN" > $conftest echo "101 \"name\"" >> $conftest echo "END" >> $conftest | | | | | | | | | | | > | | | | > | | | | > > > | | | > | | | | | > | | | | | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 | if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then conftest=/tmp/conftest.rc echo "STRINGTABLE BEGIN" > $conftest echo "101 \"name\"" >> $conftest echo "END" >> $conftest { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Windows native path bug in windres" >&5 printf %s "checking for Windows native path bug in windres... " >&6; } cyg_conftest=`$CYGPATH $conftest` if { ac_try='$RC -o conftest.res.o $cyg_conftest' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } CYGPATH=echo fi conftest= cyg_conftest= fi if test "$CYGPATH" = "echo"; then DEPARG='"$<"' else DEPARG='"$(shell $(CYGPATH) $<)"' fi # set various compiler flags depending on whether we are using gcc or cl if test "${GCC}" = "yes" ; then extra_cflags="-pipe" extra_ldflags="-pipe -static-libgcc" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mingw32 version of gcc" >&5 printf %s "checking for mingw32 version of gcc... " >&6; } if test ${ac_cv_win32+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _WIN32 #error win32 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_win32=no else $as_nop ac_cv_win32=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_win32" >&5 printf "%s\n" "$ac_cv_win32" >&6; } if test "$ac_cv_win32" != "yes"; then as_fn_error $? "${CC} cannot produce win32 executables." "$LINENO" 5 fi if test "$do64bit" != "arm64"; then extra_cflags="$extra_cflags -DHAVE_CPUID=1" fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -municode linker flag" >&5 printf %s "checking for working -municode linker flag... " >&6; } if test ${ac_cv_municode+y} then : printf %s "(cached) " >&6 else $as_nop # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <windows.h> int APIENTRY wWinMain(HINSTANCE a, HINSTANCE b, LPWSTR c, int d) {return 0;} int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_municode=yes else $as_nop ac_cv_municode=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_municode" >&5 printf "%s\n" "$ac_cv_municode" >&6; } CFLAGS=$hold_cflags if test "$ac_cv_municode" = "yes" ; then extra_ldflags="$extra_ldflags -municode" else extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS" fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -fno-lto" >&5 printf %s "checking for working -fno-lto... " >&6; } if test ${ac_cv_nolto+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_nolto=yes else $as_nop ac_cv_nolto=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_nolto" >&5 printf "%s\n" "$ac_cv_nolto" >&6; } CFLAGS=$hold_cflags if test "$ac_cv_nolto" = "yes" ; then CFLAGS_NOLTO="-fno-lto" else CFLAGS_NOLTO="" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -finput-charset" >&5 printf %s "checking if the compiler understands -finput-charset... " >&6; } if test ${tcl_cv_cc_input_charset+y} then : printf %s "(cached) " >&6 else $as_nop hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_cc_input_charset=yes else $as_nop tcl_cv_cc_input_charset=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_input_charset" >&5 printf "%s\n" "$tcl_cv_cc_input_charset" >&6; } if test $tcl_cv_cc_input_charset = yes; then extra_cflags="$extra_cflags -finput-charset=UTF-8" fi fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--enable-auto-image-base" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working --enable-auto-image-base" >&5 printf %s "checking for working --enable-auto-image-base... " >&6; } if test ${ac_cv_enable_auto_image_base+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_enable_auto_image_base=yes else $as_nop ac_cv_enable_auto_image_base=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_auto_image_base" >&5 printf "%s\n" "$ac_cv_enable_auto_image_base" >&6; } CFLAGS=$hold_cflags if test "$ac_cv_enable_auto_image_base" == "yes" ; then extra_ldflags="$extra_ldflags -Wl,--enable-auto-image-base" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking compiler flags" >&5 printf %s "checking compiler flags... " >&6; } if test "${GCC}" = "yes" ; then SHLIB_LD="" SHLIB_LD_LIBS='${LIBS}' LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32" # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32 -lwinspool" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= RC_INCLUDE=--include RC_DEFINE=--define RES=res.o MAKE_LIB="\${STLIB_LD} \$@" MAKE_STUB_LIB="\${STLIB_LD} \$@" POST_MAKE_LIB="\${RANLIB} \$@" MAKE_EXE="\${CC} -o \$@" LIBPREFIX="lib" if test "${SHARED_BUILD}" = "0" ; then # static { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5 printf "%s\n" "using static flags" >&6; } runtime= LIBRARIES="\${STATIC_LIBRARIES}" EXESUFFIX="s.exe" else # dynamic { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5 printf "%s\n" "using shared flags" >&6; } # ad-hoc check to see if CC supports -shared. if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then as_fn_error $? "${CC} does not support the -shared option. You will need to upgrade to a newer version of the toolchain." "$LINENO" 5 fi runtime= # Add SHLIB_LD_LIBS to the Make rule, not here. EXESUFFIX=".exe" LIBRARIES="\${SHARED_LIBRARIES}" fi # 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%.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="" SHLIB_SUFFIX=.dll EXTRA_CFLAGS="${extra_cflags}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= case "${CC}" in *++) CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" ;; *) CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers" ;; esac # Specify the CC output file names based on the target name CC_OBJNAME="-o \$@" CC_EXENAME="-o \$@" |
︙ | ︙ | |||
4289 4290 4291 4292 4293 4294 4295 | #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}" LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build | | | > > > > > | | | | > | | | | | | | | | | | 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 | #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}" LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 printf "%s\n" " Using 64-bit $MACHINE mode" >&6; } ;; arm64|aarch64) MACHINE="ARM64" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using ARM64 $MACHINE mode" >&5 printf "%s\n" " Using ARM64 $MACHINE mode" >&6; } ;; ia64) MACHINE="IA64" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using IA64 $MACHINE mode" >&5 printf "%s\n" " Using IA64 $MACHINE mode" >&6; } ;; *) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _WIN64 #error 32-bit #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_win_64bit=yes else $as_nop tcl_win_64bit=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "$tcl_win_64bit" = "yes" ; then do64bit=amd64 MACHINE="AMD64" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 printf "%s\n" " Using 64-bit $MACHINE mode" >&6; } fi ;; esac else if test "${SHARED_BUILD}" = "0" ; then # static { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5 printf "%s\n" "using static flags" >&6; } runtime=-MT LIBRARIES="\${STATIC_LIBRARIES}" EXESUFFIX="s.exe" else # dynamic { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5 printf "%s\n" "using shared flags" >&6; } runtime=-MD # Add SHLIB_LD_LIBS to the Make rule, not here. LIBRARIES="\${SHARED_LIBRARIES}" EXESUFFIX=".exe" case "x`echo \${VisualStudioVersion}`" in x1[4-9]*) lflags="${lflags} -nodefaultlib:libucrt.lib" |
︙ | ︙ | |||
4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 | LIBFLAGSUFFIX="" if test "$do64bit" != "no" ; then case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build ;; ia64) MACHINE="IA64" ;; esac | > > > | | < | | | 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 | LIBFLAGSUFFIX="" if test "$do64bit" != "no" ; then case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build ;; arm64|aarch64) MACHINE="ARM64" ;; ia64) MACHINE="IA64" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 printf "%s\n" " Using 64-bit $MACHINE mode" >&6; } fi LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib" case "x`echo \${VisualStudioVersion}`" in x1[4-9]*) LIBS="$LIBS ucrt.lib" ;; *) ;; esac if test "$do64bit" != "no" ; then RC="rc" CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo -MACHINE:${MACHINE}" LINKBIN="link" # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 LIBS="$LIBS bufferoverflowU.lib" else RC="rc" # -Od - no optimization # -WX - warnings as errors CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo" LINKBIN="link" fi LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib winspool.lib" SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" SHLIB_LD_LIBS='${LIBS}' # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" RC_OUT=-fo RC_TYPE=-r |
︙ | ︙ | |||
4444 4445 4446 4447 4448 4449 4450 | else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi if test "$do64bit" != "no" ; then | | | | | > | | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | | | | | > | | | | > | | | | | | | | > | | | | > | | | | | | | > | < | | | > | | | | > | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > | | > | < | | | > | | | | > | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | < | > | < | | | > | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | | > | | | | | | | | | | | > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | > > > > > > > > > > > > > > > | | | | | 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 | else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi if test "$do64bit" != "no" ; then printf "%s\n" "#define TCL_CFG_DO64BIT 1" >>confdefs.h fi if test "${GCC}" = "yes" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5 printf %s "checking for SEH support in compiler... " >&6; } if test ${tcl_cv_seh+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : tcl_cv_seh=no else $as_nop # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN int main(int argc, char** argv) { int a, b = 0; __try { a = 666 / b; } __except (EXCEPTION_EXECUTE_HANDLER) { return 0; } return 1; } _ACEOF if ac_fn_c_try_run "$LINENO" then : tcl_cv_seh=yes else $as_nop tcl_cv_seh=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_seh" >&5 printf "%s\n" "$tcl_cv_seh" >&6; } if test "$tcl_cv_seh" = "no" ; then printf "%s\n" "#define HAVE_NO_SEH 1" >>confdefs.h fi # # Check to see if the excpt.h include file provided contains the # definition for EXCEPTION_DISPOSITION; if not, which is the case # with Cygwin's version as of 2002-04-10, define it to be int, # sufficient for getting the current code to work. # { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EXCEPTION_DISPOSITION support in include files" >&5 printf %s "checking for EXCEPTION_DISPOSITION support in include files... " >&6; } if test ${tcl_cv_eh_disposition+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> # undef WIN32_LEAN_AND_MEAN int main (void) { EXCEPTION_DISPOSITION x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_eh_disposition=yes else $as_nop tcl_cv_eh_disposition=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_eh_disposition" >&5 printf "%s\n" "$tcl_cv_eh_disposition" >&6; } if test "$tcl_cv_eh_disposition" = "no" ; then printf "%s\n" "#define EXCEPTION_DISPOSITION int" >>confdefs.h fi # Check to see if winnt.h defines CHAR, SHORT, and LONG # even if VOID has already been #defined. The win32api # used by mingw and cygwin is known to do this. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for winnt.h that ignores VOID define" >&5 printf %s "checking for winnt.h that ignores VOID define... " >&6; } if test ${tcl_cv_winnt_ignore_void+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define VOID void #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN int main (void) { CHAR c; SHORT s; LONG l; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_winnt_ignore_void=yes else $as_nop tcl_cv_winnt_ignore_void=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5 printf "%s\n" "$tcl_cv_winnt_ignore_void" >&6; } if test "$tcl_cv_winnt_ignore_void" = "yes" ; then printf "%s\n" "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default" if test "x$ac_cv_header_stdbool_h" = xyes then : printf "%s\n" "#define HAVE_STDBOOL_H 1" >>confdefs.h fi # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 printf %s "checking for cast to union support... " >&6; } if test ${tcl_cv_cast_to_union+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { union foo { int i; double d; }; union foo f = (union foo) (int) 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_cast_to_union=yes else $as_nop tcl_cv_cast_to_union=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 printf "%s\n" "$tcl_cv_cast_to_union" >&6; } if test "$tcl_cv_cast_to_union" = "yes"; then printf "%s\n" "#define HAVE_CAST_TO_UNION 1" >>confdefs.h fi fi # DL_LIBS is empty, but then we match the Unix version ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" " #include <stdint.h> " if test "x$ac_cv_type_intptr_t" = xyes then : printf "%s\n" "#define HAVE_INTPTR_T 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" " #include <stdint.h> " if test "x$ac_cv_type_uintptr_t" = xyes then : printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h fi #-------------------------------------------------------------------- # man2tcl needs this so that it can use errno.h #-------------------------------------------------------------------- ac_fn_c_check_header_compile "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" if test "x$ac_cv_header_errno_h" = xyes then : else $as_nop MAN2TCLFLAGS="-DNO_ERRNO_H" fi #------------------------------------------- # Check for _strtoi64 #------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking availability of _strtoi64" >&5 printf %s "checking availability of _strtoi64... " >&6; } if test ${tcl_cv_strtoi64+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main (void) { _strtoi64(0,0,0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : tcl_cv_strtoi64=yes else $as_nop tcl_cv_strtoi64=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtoi64" >&5 printf "%s\n" "$tcl_cv_strtoi64" >&6; } if test $tcl_cv_strtoi64 = no; then printf "%s\n" "#define NO_STRTOI64 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default" if test "x$ac_cv_type_intptr_t" = xyes then : printf "%s\n" "#define HAVE_INTPTR_T 1" >>confdefs.h else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pointer-size signed integer type" >&5 printf %s "checking for pointer-size signed integer type... " >&6; } if test ${tcl_cv_intptr_t+y} then : printf %s "(cached) " >&6 else $as_nop for tcl_cv_intptr_t in "int" "long" "__int64" none; do if test "$tcl_cv_intptr_t" != none; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_ok=yes else $as_nop tcl_ok=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$tcl_ok" = yes && break; fi done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_intptr_t" >&5 printf "%s\n" "$tcl_cv_intptr_t" >&6; } if test "$tcl_cv_intptr_t" != none; then printf "%s\n" "#define intptr_t $tcl_cv_intptr_t" >>confdefs.h fi fi ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" if test "x$ac_cv_type_uintptr_t" = xyes then : printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pointer-size unsigned integer type" >&5 printf %s "checking for pointer-size unsigned integer type... " >&6; } if test ${tcl_cv_uintptr_t+y} then : printf %s "(cached) " >&6 else $as_nop for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned __int64" \ none; do if test "$tcl_cv_uintptr_t" != none; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_ok=yes else $as_nop tcl_ok=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$tcl_ok" = yes && break; fi done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_uintptr_t" >&5 printf "%s\n" "$tcl_cv_uintptr_t" >&6; } if test "$tcl_cv_uintptr_t" != none; then printf "%s\n" "#define uintptr_t $tcl_cv_uintptr_t" >>confdefs.h fi fi #-------------------------------------------------------------------- # Windows XP theme engine header for Ttk #-------------------------------------------------------------------- ac_fn_c_check_header_compile "$LINENO" "uxtheme.h" "ac_cv_header_uxtheme_h" "#include <windows.h> " if test "x$ac_cv_header_uxtheme_h" = xyes then : printf "%s\n" "#define HAVE_UXTHEME_H 1" >>confdefs.h else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: xpnative theme will be unavailable" >&5 printf "%s\n" "$as_me: xpnative theme will be unavailable" >&6;} fi ac_fn_c_check_header_compile "$LINENO" "vssym32.h" "ac_cv_header_vssym32_h" "#include <windows.h> #include <uxtheme.h> " if test "x$ac_cv_header_vssym32_h" = xyes then : printf "%s\n" "#define HAVE_VSSYM32_H 1" >>confdefs.h fi #-------------------------------------------------------------------- # Set the default compiler switches based on the --enable-symbols # option. This macro depends on C flags, and should be called # after SC_CONFIG_CFLAGS macro is called. #-------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5 printf %s "checking for build with symbols... " >&6; } # Check whether --enable-symbols was given. if test ${enable_symbols+y} then : enableval=$enable_symbols; tcl_ok=$enableval else $as_nop tcl_ok=no fi # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' printf "%s\n" "#define NDEBUG 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h else CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' if test "$tcl_ok" = "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5 printf "%s\n" "yes (standard debugging)" >&6; } fi fi if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then printf "%s\n" "#define TCL_MEM_DEBUG 1" >>confdefs.h fi if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then printf "%s\n" "#define TCL_COMPILE_DEBUG 1" >>confdefs.h printf "%s\n" "#define TCL_COMPILE_STATS 1" >>confdefs.h fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem compile debugging" >&5 printf "%s\n" "enabled symbols mem compile debugging" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5 printf "%s\n" "enabled $tcl_ok debugging" >&6; } fi fi #-------------------------------------------------------------------- # Embed the manifest if we can determine how #-------------------------------------------------------------------- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CC needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to embed manifest" >&5 printf %s "checking whether to embed manifest... " >&6; } # Check whether --enable-embedded-manifest was given. if test ${enable_embedded_manifest+y} then : enableval=$enable_embedded_manifest; embed_ok=$enableval else $as_nop embed_ok=yes fi VC_MANIFEST_EMBED_DLL= VC_MANIFEST_EMBED_EXE= result=no if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \ -a "$GCC" != "yes" ; then # Add the magic to embed the manifest into the dll/exe cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined(_MSC_VER) && _MSC_VER >= 1400 print("manifest needed") #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "manifest needed" >/dev/null 2>&1 then : # Could do a CHECK_PROG for mt, but should always be with MSVC8+ # Could add 'if test -f' check, but manifest should be created # in this compiler case # Add in a manifest argument that may be specified # XXX Needs improvement so that the test for existence accounts # XXX for a provided (known) manifest VC_MANIFEST_EMBED_DLL="if test -f \[email protected] ; then mt.exe -nologo -manifest \[email protected] wish.exe.manifest -outputresource:\$@\;2 ; fi" VC_MANIFEST_EMBED_EXE="if test -f \[email protected] ; then mt.exe -nologo -manifest \[email protected] wish.exe.manifest -outputresource:\$@\;1 ; fi" result=yes if test "xwish.exe.manifest" != x ; then result="yes (wish.exe.manifest)" fi fi rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $result" >&5 printf "%s\n" "$result" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5 printf %s "checking for tclsh in Tcl build directory... " >&6; } BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}\${EXESUFFIX} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5 printf "%s\n" "$BUILD_TCLSH" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 printf %s "checking for tclsh... " >&6; } if test ${ac_cv_path_tclsh+y} then : printf %s "(cached) " >&6 else $as_nop search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/tclsh[8-9]*.exe 2> /dev/null` \ `ls -r $dir/tclsh* 2> /dev/null` ; do if test x"$ac_cv_path_tclsh" = x ; then if test -f "$j" ; then ac_cv_path_tclsh=$j break fi fi done done fi if test -f "$ac_cv_path_tclsh" ; then TCLSH_PROG="$ac_cv_path_tclsh" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5 printf "%s\n" "$TCLSH_PROG" >&6; } else # It is not an error if an installed version of Tcl can't be located. TCLSH_PROG="" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5 printf "%s\n" "No tclsh found on PATH" >&6; } fi #-------------------------------------------------------------------- # Zipfs support - Tip 430 #-------------------------------------------------------------------- # Check whether --enable-zipfs was given. if test ${enable_zipfs+y} then : enableval=$enable_zipfs; tcl_ok=$enableval else $as_nop tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then # # Find a native compiler # # Put a plausible default for CC_FOR_BUILD in Makefile. if test -z "$CC_FOR_BUILD"; then if test "x$cross_compiling" = "xno"; then CC_FOR_BUILD='$(CC)' else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 printf %s "checking for gcc... " >&6; } if test ${ac_cv_path_cc+y} then : printf %s "(cached) " >&6 else $as_nop search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/gcc 2> /dev/null` \ `ls -r $dir/gcc 2> /dev/null` ; do if test x"$ac_cv_path_cc" = x ; then if test -f "$j" ; then ac_cv_path_cc=$j break fi fi done done fi fi fi # Also set EXEEXT_FOR_BUILD. if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' OBJEXT_FOR_BUILD='$(OBJEXT)' else OBJEXT_FOR_BUILD='.no' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 printf %s "checking for build system executable suffix... " >&6; } if test ${bfd_cv_build_exeext+y} then : printf %s "(cached) " >&6 else $as_nop rm -f conftest* echo 'int main () { return 0; }' > conftest.c bfd_cv_build_exeext= ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; esac done rm -f conftest* test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5 printf "%s\n" "$bfd_cv_build_exeext" >&6; } EXEEXT_FOR_BUILD="" test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} fi # # Find a native zip implementation # ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" ZIP_INSTALL_OBJS="" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 printf %s "checking for zip... " >&6; } if test ${ac_cv_path_zip+y} then : printf %s "(cached) " >&6 else $as_nop search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/zip 2> /dev/null` \ `ls -r $dir/zip 2> /dev/null` ; do if test x"$ac_cv_path_zip" = x ; then if test -f "$j" ; then ac_cv_path_zip=$j break fi fi done done fi if test -f "$ac_cv_path_zip" ; then ZIP_PROG="$ac_cv_path_zip" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 printf "%s\n" "$ZIP_PROG" >&6; } ZIP_PROG_OPTIONS="-rq" ZIP_PROG_VFSSEARCH="*" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5 printf "%s\n" "Found INFO Zip in environment" >&6; } # Use standard arguments for zip else # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="-o -r" ZIP_PROG_VFSSEARCH="*" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 printf "%s\n" "No zip found on PATH building minizip" >&6; } fi ZIPFS_BUILD=1 TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip else ZIPFS_BUILD=0 TCL_ZIP_FILE= fi # Do checking message here to not mess up interleaved configure output { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 printf %s "checking for building with zipfs... " >&6; } if test "${ZIPFS_BUILD}" = 1; then if test "${SHARED_BUILD}" = 0; then ZIPFS_BUILD=2; printf "%s\n" "#define ZIPFS_BUILD 2" >>confdefs.h INSTALL_LIBRARIES=install-libraries-zipfs-static { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else printf "%s\n" "#define ZIPFS_BUILD 1" >>confdefs.h \ INSTALL_LIBRARIES=install-libraries-zipfs-shared { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } INSTALL_LIBRARIES=install-libraries INSTALL_MSGS=install-msgs fi #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ TK_SHARED_BUILD=${SHARED_BUILD} #-------------------------------------------------------------------- # Perform final evaluations of variables with possible substitutions. #-------------------------------------------------------------------- TK_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; $CYGPATH $(pwd)`\"" eval "TK_DLL_FILE_TCL8=tk$VER${DLLSUFFIX}" eval "TK_DLL_FILE_TCL9=tcl9tk$VER${DLLSUFFIX}" if test ${TCL_MAJOR_VERSION} = 8 ; then eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}" else eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a" fi else eval "TK_DLL_FILE=tcl9tk$VER${DLLSUFFIX}" if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${LIBSUFFIX}" else eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${DLLSUFFIX}.a" fi 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 TK_LIB_FLAG="-l" if test "${TCL_MAJOR_VERSION}" -gt 8 ; then TK_LIB_FLAG="${TK_LIB_FLAG}tcl9" fi eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}${VER}${LIBFLAGSUFFIX}\"" TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" eval "TK_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TK_LIB_FLAG}\"" eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\"" eval "TK_BUILD_STUB_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TK_STUB_LIB_FLAG}\"" TK_STUB_LIB_SPEC="-L${libdir} ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_PATH="${libdir}/${TK_STUB_LIB_FILE}" eval "TK_BUILD_STUB_LIB_PATH=\"`$CYGPATH $(pwd)`/${TK_STUB_LIB_FILE}\"" eval "DLLSUFFIX=${DLLSUFFIX}" eval "LIBPREFIX=${LIBPREFIX}" eval "LIBSUFFIX=${LIBSUFFIX}" eval "EXESUFFIX=${EXESUFFIX}" CFG_TK_SHARED_LIB_SUFFIX=${TK_SHARED_LIB_SUFFIX} |
︙ | ︙ | |||
4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 | *a*) TK_RELEASE_LEVEL=0 ;; *b*) TK_RELEASE_LEVEL=1 ;; *) TK_RELEASE_LEVEL=2 ;; esac TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`" # X86|AMD64|IA64 for manifest | > > | 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 | *a*) TK_RELEASE_LEVEL=0 ;; *b*) TK_RELEASE_LEVEL=1 ;; *) TK_RELEASE_LEVEL=2 ;; esac TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`" # X86|AMD64|IA64 for manifest |
︙ | ︙ | |||
5058 5059 5060 5061 5062 5063 5064 | # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( | | | | 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 | # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac |
︙ | ︙ | |||
5089 5090 5091 5092 5093 5094 5095 | esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear | | | | | | | 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 | esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' |
︙ | ︙ | |||
5165 5166 5167 5168 5169 5170 5171 | ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' | | | | | 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 | ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. |
︙ | ︙ | |||
5205 5206 5207 5208 5209 5210 5211 | cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh | > | > | > > > > > > > > < < < < < < < < | | < | | < < < < < < | < < < < < < < | > > | < < > | | > > > > > > > > > | > > > > | < < < < < < < > | > > > | | < < < < < < < < < < < < < < < < < < < < | | > | 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 | cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { |
︙ | ︙ | |||
5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 | # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. | > | > | | > | | 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 | # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith |
︙ | ︙ | |||
5426 5427 5428 5429 5430 5431 5432 | as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || | | | 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 | as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q |
︙ | ︙ | |||
5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 | # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null | > > > > > > > > > > | 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 | # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null |
︙ | ︙ | |||
5502 5503 5504 5505 5506 5507 5508 | case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( | | | | 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 | case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q |
︙ | ︙ | |||
5573 5574 5575 5576 5577 5578 5579 | test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" | | | | 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 | test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by tk $as_me 8.7, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ |
︙ | ︙ | |||
5623 5624 5625 5626 5627 5628 5629 5630 | Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | > > | | | | | 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 | Configuration files: $config_files Report bugs to the package provider." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ tk config.status 8.7 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF |
︙ | ︙ | |||
5667 5668 5669 5670 5671 5672 5673 | esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) | | | | | | 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 | esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; |
︙ | ︙ | |||
5709 5710 5711 5712 5713 5714 5715 | fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift | | | | 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 | fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 |
︙ | ︙ | |||
5750 5751 5752 5753 5754 5755 5756 | # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then | | | 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 | # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: |
︙ | ︙ | |||
5978 5979 5980 5981 5982 5983 5984 | test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac | | | | | | | | 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 | test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q |
︙ | ︙ | |||
6037 6038 6039 6040 6041 6042 6043 | s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) | | | | 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 | s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix |
︙ | ︙ | |||
6092 6093 6094 6095 6096 6097 6098 | /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) | | | | 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 | /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g |
︙ | ︙ | |||
6135 6136 6137 6138 6139 6140 6141 | eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && | | | | 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 | eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ |
︙ | ︙ | |||
6184 6185 6186 6187 6188 6189 6190 | $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then | | | > | 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 | $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi |
Changes to win/configure.ac.
1 2 3 4 5 | #! /bin/bash -norc # This file is an input file used by the GNU "autoconf" program to # generate the file "configure", which is run during Tk installation # to configure the system for the local environment. | > | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #! /bin/bash -norc # This file is an input file used by the GNU "autoconf" program to # generate the file "configure", which is run during Tk installation # to configure the system for the local environment. AC_INIT([tk],[8.7]) AC_CONFIG_SRCDIR([../generic/tk.h]) AC_PREREQ([2.69]) # The following define is needed when building with Cygwin since newer # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 TK_PATCH_LEVEL="a6" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then |
︙ | ︙ | |||
38 39 40 41 42 43 44 | # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi AC_PROG_CC AC_C_INLINE | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi AC_PROG_CC AC_C_INLINE AC_CHECK_INCLUDES_DEFAULT AC_CHECK_TOOL(AR, ar) AC_CHECK_TOOL(RANLIB, ranlib) AC_CHECK_TOOL(RC, windres) #-------------------------------------------------------------------- # Checks to see if the make program sets the $MAKE variable. |
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called # after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- SC_CONFIG_CFLAGS #-------------------------------------------------------------------- # man2tcl needs this so that it can use errno.h #-------------------------------------------------------------------- AC_CHECK_HEADER(errno.h, , MAN2TCLFLAGS="-DNO_ERRNO_H") AC_SUBST(MAN2TCLFLAGS) #------------------------------------------- # Check for _strtoi64 #------------------------------------------- AC_CACHE_CHECK([availability of _strtoi64], tcl_cv_strtoi64, [ | > > > > | | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called # after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- SC_CONFIG_CFLAGS AC_CHECK_TYPES([intptr_t, uintptr_t],,,[[ #include <stdint.h> ]]) #-------------------------------------------------------------------- # man2tcl needs this so that it can use errno.h #-------------------------------------------------------------------- AC_CHECK_HEADER(errno.h, , MAN2TCLFLAGS="-DNO_ERRNO_H") AC_SUBST(MAN2TCLFLAGS) #------------------------------------------- # Check for _strtoi64 #------------------------------------------- AC_CACHE_CHECK([availability of _strtoi64], tcl_cv_strtoi64, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], [[_strtoi64(0,0,0)]])],[tcl_cv_strtoi64=yes],[tcl_cv_strtoi64=no])]) if test $tcl_cv_strtoi64 = no; then AC_DEFINE(NO_STRTOI64, 1, [Is _strtoi64 function available?]) fi AC_CHECK_TYPE([intptr_t], [ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [ AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [ for tcl_cv_intptr_t in "int" "long" "__int64" none; do if test "$tcl_cv_intptr_t" != none; then AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])], [tcl_ok=yes], [tcl_ok=no]) test "$tcl_ok" = yes && break; fi done]) if test "$tcl_cv_intptr_t" != none; then AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer type wide enough to hold a pointer.]) fi ]) AC_CHECK_TYPE([uintptr_t], [ AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [ AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned __int64" \ none; do if test "$tcl_cv_uintptr_t" != none; then AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])], [tcl_ok=yes], [tcl_ok=no]) test "$tcl_ok" = yes && break; fi done]) if test "$tcl_cv_uintptr_t" != none; then AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer type wide enough to hold a pointer.]) fi ]) #-------------------------------------------------------------------- # Windows XP theme engine header for Ttk #-------------------------------------------------------------------- AC_CHECK_HEADER([uxtheme.h], [AC_DEFINE(HAVE_UXTHEME_H)], [AC_MSG_NOTICE([xpnative theme will be unavailable])], |
︙ | ︙ | |||
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | # Embed the manifest if we can determine how #-------------------------------------------------------------------- SC_EMBED_MANIFEST(wish.exe.manifest) SC_BUILD_TCLSH SC_PROG_TCLSH #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ TK_SHARED_BUILD=${SHARED_BUILD} #-------------------------------------------------------------------- # Perform final evaluations of variables with possible substitutions. #-------------------------------------------------------------------- TK_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | > > > > > > > > > > > > > > > | | | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | # Embed the manifest if we can determine how #-------------------------------------------------------------------- SC_EMBED_MANIFEST(wish.exe.manifest) SC_BUILD_TCLSH SC_PROG_TCLSH #-------------------------------------------------------------------- # Zipfs support - Tip 430 #-------------------------------------------------------------------- AC_ARG_ENABLE(zipfs, AS_HELP_STRING([--enable-zipfs], [build with Zipfs support (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) if test "$tcl_ok" = "yes" ; then # # Find a native compiler # AX_CC_FOR_BUILD # # Find a native zip implementation # SC_ZIPFS_SUPPORT ZIPFS_BUILD=1 TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip else ZIPFS_BUILD=0 TCL_ZIP_FILE= fi # Do checking message here to not mess up interleaved configure output AC_MSG_CHECKING([for building with zipfs]) if test "${ZIPFS_BUILD}" = 1; then if test "${SHARED_BUILD}" = 0; then ZIPFS_BUILD=2; AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) INSTALL_LIBRARIES=install-libraries-zipfs-static AC_MSG_RESULT([yes]) else AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ INSTALL_LIBRARIES=install-libraries-zipfs-shared AC_MSG_RESULT([yes]) fi else AC_MSG_RESULT([no]) INSTALL_LIBRARIES=install-libraries INSTALL_MSGS=install-msgs fi AC_SUBST(ZIPFS_BUILD) AC_SUBST(TK_ZIP_FILE) AC_SUBST(INSTALL_LIBRARIES) AC_SUBST(INSTALL_MSGS) #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ TK_SHARED_BUILD=${SHARED_BUILD} #-------------------------------------------------------------------- # Perform final evaluations of variables with possible substitutions. #-------------------------------------------------------------------- TK_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; $CYGPATH $(pwd)`\"" eval "TK_DLL_FILE_TCL8=tk$VER${DLLSUFFIX}" eval "TK_DLL_FILE_TCL9=tcl9tk$VER${DLLSUFFIX}" if test ${TCL_MAJOR_VERSION} = 8 ; then eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}" else eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a" fi else eval "TK_DLL_FILE=tcl9tk$VER${DLLSUFFIX}" if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${LIBSUFFIX}" else eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${DLLSUFFIX}.a" fi 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 TK_LIB_FLAG="-l" if test "${TCL_MAJOR_VERSION}" -gt 8 ; then TK_LIB_FLAG="${TK_LIB_FLAG}tcl9" fi eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}${VER}${LIBFLAGSUFFIX}\"" TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" eval "TK_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TK_LIB_FLAG}\"" eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\"" eval "TK_BUILD_STUB_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TK_STUB_LIB_FLAG}\"" TK_STUB_LIB_SPEC="-L${libdir} ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_PATH="${libdir}/${TK_STUB_LIB_FILE}" eval "TK_BUILD_STUB_LIB_PATH=\"`$CYGPATH $(pwd)`/${TK_STUB_LIB_FILE}\"" eval "DLLSUFFIX=${DLLSUFFIX}" eval "LIBPREFIX=${LIBPREFIX}" eval "LIBSUFFIX=${LIBSUFFIX}" eval "EXESUFFIX=${EXESUFFIX}" CFG_TK_SHARED_LIB_SUFFIX=${TK_SHARED_LIB_SUFFIX} |
︙ | ︙ | |||
214 215 216 217 218 219 220 221 222 223 224 225 226 227 | AC_SUBST(TK_VERSION) AC_SUBST(TK_MAJOR_VERSION) AC_SUBST(TK_MINOR_VERSION) AC_SUBST(TK_PATCH_LEVEL) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_DLL_FILE) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) AC_SUBST(TK_BUILD_STUB_LIB_SPEC) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_BIN_DIR) AC_SUBST(TCL_VERSION) | > > | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | AC_SUBST(TK_VERSION) AC_SUBST(TK_MAJOR_VERSION) AC_SUBST(TK_MINOR_VERSION) AC_SUBST(TK_PATCH_LEVEL) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_DLL_FILE) AC_SUBST(TK_DLL_FILE_TCL8) AC_SUBST(TK_DLL_FILE_TCL9) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) AC_SUBST(TK_BUILD_STUB_LIB_SPEC) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_BIN_DIR) AC_SUBST(TCL_VERSION) |
︙ | ︙ | |||
287 288 289 290 291 292 293 | AC_SUBST(RC_OUT) AC_SUBST(RC_TYPE) AC_SUBST(RC_INCLUDE) AC_SUBST(RC_DEFINE) AC_SUBST(RC_DEFINES) AC_SUBST(RES) | | > | | 390 391 392 393 394 395 396 397 398 399 400 401 402 | AC_SUBST(RC_OUT) AC_SUBST(RC_TYPE) AC_SUBST(RC_INCLUDE) AC_SUBST(RC_DEFINE) AC_SUBST(RC_DEFINES) AC_SUBST(RES) AC_CONFIG_FILES([Makefile tkConfig.sh wish.exe.manifest]) AC_OUTPUT dnl Local Variables: dnl mode: autoconf dnl End: |
Added win/gitmanifest.in.
> | 1 | git- |
Changes to win/makefile.vc.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # General usage: # nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]] # # For MACRODEF, see TIP 477 (https://core.tcl-lang.org/tips/doc/trunk/tip/477.md) # or examine Sections 6-8 in rules.vc. This makefile has the following # values for the OPTS macro in addition to the ones described there. # noxp = If you do not have the uxtheme.h header then you # cannot include support for XP themeing. # square = Include the demo square widget. # # Possible values for TARGET are: # release -- Builds the core, the shell and the dlls. (default) # dlls -- Just builds the windows extensions. | > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # General usage: # nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]] # # For MACRODEF, see TIP 477 (https://core.tcl-lang.org/tips/doc/trunk/tip/477.md) # or examine Sections 6-8 in rules.vc. This makefile has the following # values for the OPTS macro in addition to the ones described there. # noembed = Embeds Tcl scripts into the wish executable. Currently only # applicable for static builds. Non-static builds currently # never embed. # noxp = If you do not have the uxtheme.h header then you # cannot include support for XP themeing. # square = Include the demo square widget. # # Possible values for TARGET are: # release -- Builds the core, the shell and the dlls. (default) # dlls -- Just builds the windows extensions. |
︙ | ︙ | |||
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | RCFILE = tk.rc USE_WIDECHAR_API = 0 # The rules.vc file does much of the hard work in terms of defining # the build configuration, macros, output directories etc. !include "rules-ext.vc" # TCLINSTALL is set to 1 by rules.vc to indicate we are building against # an installed Tcl and 0 if building against Tcl source. Tk needs the latter. !if $(TCLINSTALL) !message *** Warning: Tk requires the source distribution of Tcl to build from, !message *** at this time, sorry. Please set the TCLDIR macro to point to the !message *** Tcl sources. !endif # Extra makefile options processing for non-standard OPTS values ... !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] HAVE_UXTHEME_H = 1 TTK_SQUARE_WIDGET = 0 !else !if [nmakehlp -f $(OPTS) "noxp"] !message *** Exclude support for XP theme HAVE_UXTHEME_H = 0 !else HAVE_UXTHEME_H = 1 !endif !if [nmakehlp -f "$(OPTS)" "square"] !message *** Include ttk square demo widget TTK_SQUARE_WIDGET = 1 !else TTK_SQUARE_WIDGET = 0 !endif !endif TK_NO_DEPRECATED = 0 !if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"] !if [nmakehlp -f $(CHECKS) "nodep"] TK_NO_DEPRECATED = 1 !endif !endif WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe" TKTEST = "$(OUT_DIR)\$(PROJECT)test.exe" CAT32 = "$(OUT_DIR)\cat32.exe" WISHOBJS = \ $(TMP_DIR)\winMain.obj \ | > > > > > > > > > > > > > > > > > > | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | RCFILE = tk.rc USE_WIDECHAR_API = 0 # The rules.vc file does much of the hard work in terms of defining # the build configuration, macros, output directories etc. !include "rules-ext.vc" !if ($(TCL_MAJOR_VERSION) > 8) || ($(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) > 6) USING_PRE87_TCL = 0 !else USING_PRE87_TCL = 1 !endif # TCLINSTALL is set to 1 by rules.vc to indicate we are building against # an installed Tcl and 0 if building against Tcl source. Tk needs the latter. !if $(TCLINSTALL) !message *** Warning: Tk requires the source distribution of Tcl to build from, !message *** at this time, sorry. Please set the TCLDIR macro to point to the !message *** Tcl sources. !endif # Extra makefile options processing for non-standard OPTS values ... !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] HAVE_UXTHEME_H = 1 TTK_SQUARE_WIDGET = 0 TK_EMBED_SCRIPTS = $(STATIC_BUILD) !else !if [nmakehlp -f $(OPTS) "noxp"] !message *** Exclude support for XP theme HAVE_UXTHEME_H = 0 !else HAVE_UXTHEME_H = 1 !endif !if [nmakehlp -f "$(OPTS)" "square"] !message *** Include ttk square demo widget TTK_SQUARE_WIDGET = 1 !else TTK_SQUARE_WIDGET = 0 !endif !if [nmakehlp -f $(OPTS) "noembed"] !message *** Option noembed specified. Tk script library will not be appended to the binary. TK_EMBED_SCRIPTS = 0 !else !message *** Tk script library will be appended to the binary. TK_EMBED_SCRIPTS = $(STATIC_BUILD) !endif !endif !if $(USING_PRE87_TCL) TK_EMBED_SCRIPTS = 0 !endif TK_NO_DEPRECATED = 0 !if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"] !if [nmakehlp -f $(CHECKS) "nodep"] TK_NO_DEPRECATED = 1 !endif !endif WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe" TKTEST = "$(OUT_DIR)\$(PROJECT)test.exe" CAT32 = "$(OUT_DIR)\cat32.exe" WISHOBJS = \ $(TMP_DIR)\winMain.obj \ !if $(STATIC_BUILD) && !$(STATIC_BUILD) $(TCLDDELIB) \ $(TCLREGLIB) \ !endif $(TMP_DIR)\wish.res TKTESTOBJS = \ $(TMP_DIR)\testMain.obj \ |
︙ | ︙ | |||
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | $(TMP_DIR)\tkWinColor.obj \ $(TMP_DIR)\tkWinConfig.obj \ $(TMP_DIR)\tkWinCursor.obj \ $(TMP_DIR)\tkWinDialog.obj \ $(TMP_DIR)\tkWinDraw.obj \ $(TMP_DIR)\tkWinEmbed.obj \ $(TMP_DIR)\tkWinFont.obj \ $(TMP_DIR)\tkWinImage.obj \ $(TMP_DIR)\tkWinInit.obj \ $(TMP_DIR)\tkWinKey.obj \ $(TMP_DIR)\tkWinMenu.obj \ $(TMP_DIR)\tkWinPixmap.obj \ $(TMP_DIR)\tkWinPointer.obj \ $(TMP_DIR)\tkWinRegion.obj \ $(TMP_DIR)\tkWinScrlbr.obj \ $(TMP_DIR)\tkWinSend.obj \ $(TMP_DIR)\tkWinSendCom.obj \ $(TMP_DIR)\tkWinWindow.obj \ $(TMP_DIR)\tkWinWm.obj \ $(TMP_DIR)\tkWinX.obj \ $(TMP_DIR)\stubs.obj \ $(TMP_DIR)\tk3d.obj \ $(TMP_DIR)\tkArgv.obj \ $(TMP_DIR)\tkAtom.obj \ | > > > | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | $(TMP_DIR)\tkWinColor.obj \ $(TMP_DIR)\tkWinConfig.obj \ $(TMP_DIR)\tkWinCursor.obj \ $(TMP_DIR)\tkWinDialog.obj \ $(TMP_DIR)\tkWinDraw.obj \ $(TMP_DIR)\tkWinEmbed.obj \ $(TMP_DIR)\tkWinFont.obj \ $(TMP_DIR)\tkWinGDI.obj \ $(TMP_DIR)\tkWinIco.obj \ $(TMP_DIR)\tkWinImage.obj \ $(TMP_DIR)\tkWinInit.obj \ $(TMP_DIR)\tkWinKey.obj \ $(TMP_DIR)\tkWinMenu.obj \ $(TMP_DIR)\tkWinPixmap.obj \ $(TMP_DIR)\tkWinPointer.obj \ $(TMP_DIR)\tkWinRegion.obj \ $(TMP_DIR)\tkWinScrlbr.obj \ $(TMP_DIR)\tkWinSend.obj \ $(TMP_DIR)\tkWinSendCom.obj \ $(TMP_DIR)\tkWinSysTray.obj \ $(TMP_DIR)\tkWinWindow.obj \ $(TMP_DIR)\tkWinWm.obj \ $(TMP_DIR)\tkWinX.obj \ $(TMP_DIR)\stubs.obj \ $(TMP_DIR)\tk3d.obj \ $(TMP_DIR)\tkArgv.obj \ $(TMP_DIR)\tkAtom.obj \ |
︙ | ︙ | |||
211 212 213 214 215 216 217 218 219 220 221 222 223 224 | $(TMP_DIR)\tkFont.obj \ $(TMP_DIR)\tkFrame.obj \ $(TMP_DIR)\tkGC.obj \ $(TMP_DIR)\tkGeometry.obj \ $(TMP_DIR)\tkGet.obj \ $(TMP_DIR)\tkGrab.obj \ $(TMP_DIR)\tkGrid.obj \ $(TMP_DIR)\tkImage.obj \ $(TMP_DIR)\tkImgBmap.obj \ $(TMP_DIR)\tkImgListFormat.obj \ $(TMP_DIR)\tkImgGIF.obj \ $(TMP_DIR)\tkImgPNG.obj \ $(TMP_DIR)\tkImgPPM.obj \ $(TMP_DIR)\tkImgSVGnano.obj \ | > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | $(TMP_DIR)\tkFont.obj \ $(TMP_DIR)\tkFrame.obj \ $(TMP_DIR)\tkGC.obj \ $(TMP_DIR)\tkGeometry.obj \ $(TMP_DIR)\tkGet.obj \ $(TMP_DIR)\tkGrab.obj \ $(TMP_DIR)\tkGrid.obj \ $(TMP_DIR)\tkIcu.obj \ $(TMP_DIR)\tkImage.obj \ $(TMP_DIR)\tkImgBmap.obj \ $(TMP_DIR)\tkImgListFormat.obj \ $(TMP_DIR)\tkImgGIF.obj \ $(TMP_DIR)\tkImgPNG.obj \ $(TMP_DIR)\tkImgPPM.obj \ $(TMP_DIR)\tkImgSVGnano.obj \ |
︙ | ︙ | |||
305 306 307 308 309 310 311 312 313 314 315 316 | $(TMP_DIR)\ttkStubLib.obj ### The following paths CANNOT have spaces in them as they appear on ### the left side of implicit rules. XLIBDIR = $(ROOT)\xlib TTKDIR = $(ROOT)\generic\ttk BITMAPDIR = $(ROOT)\bitmaps # Additional include and C macro definitions for the implicit rules # defined in rules.vc PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" | > > > > > > | | < | < > > > > > > > > > > > > > > > > > > > > | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | $(TMP_DIR)\ttkStubLib.obj ### The following paths CANNOT have spaces in them as they appear on ### the left side of implicit rules. XLIBDIR = $(ROOT)\xlib TTKDIR = $(ROOT)\generic\ttk BITMAPDIR = $(ROOT)\bitmaps # Directories where to build TIP430 ZIP files # One for Tk - always built, contains Tk scripts # One for Wish - for static builds, contains Tcl+Tk scripts LIBTKVFS = $(OUT_DIR)\libtk.vfs WISHSCRIPTZIP = $(OUT_DIR)\wish.zip # Additional include and C macro definitions for the implicit rules # defined in rules.vc PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" CONFIG_DEFS =/DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \ /DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \ /DHAVE_STRINGS_H=1 /DTCL_UTF_MAX=3 \ !if $(HAVE_UXTHEME_H) /DHAVE_UXTHEME_H=1 \ !endif !if $(TTK_SQUARE_WIDGET) /DTTK_SQUARE_WIDGET=1 \ !endif !if $(TK_NO_DEPRECATED) /DTK_NO_DEPRECATED=1 !endif PRJ_DEFINES = /DBUILD_ttk $(CONFIG_DEFS) /Dinline=__inline /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE # Additional Link libraries needed beyond those in rules.vc PRJ_LIBS = netapi32.lib gdi32.lib user32.lib userenv.lib winspool.lib shell32.lib ole32.lib uuid.lib #--------------------------------------------------------------------- # TkTest flags #--------------------------------------------------------------------- !if "$(TESTPAT)" != "" TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) !endif #--------------------------------------------------------------------- # Project specific targets #--------------------------------------------------------------------- release: setup $(TKSTUBLIB) $(WISH) !if !$(USING_PRE87_TCL) release: libtkzip embed !endif all: release $(CAT32) core: setup $(TKSTUBLIB) $(TKLIB) cwish: $(WISHC) libtkzip: setup $(TKSCRIPTZIP) !if $(TK_EMBED_SCRIPTS) !if $(STATIC_BUILD) embed: setup $(WISH) $(WISHSCRIPTZIP) @copy /y /b "$(WISH)"+"$(WISHSCRIPTZIP)" "$(WISH)" !else # Note this is currently dead code as TK_EMBED_SCRIPTS is always 0 # for non-static builds as the C code does not currently setup up # a VFS for a non-static wish. embed: setup $(TKLIB) $(TKSCRIPTZIP) @copy /y /b "$(TKLIB)"+"$(TKSCRIPTZIP)" "$(TKLIB)" !endif !else # ! TK_EMBED_SCRIPTS - still need to build the zip even if not embedded embed: $(TKSCRIPTZIP) !endif install: install-binaries install-libraries install-docs !if $(SYMBOLS) install: install-pdbs !endif tktest: setup $(TKTEST) $(CAT32) setup: default-setup |
︙ | ︙ | |||
462 463 464 465 466 467 468 469 470 471 | $(_VC_MANIFEST_EMBED_EXE) $(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB) $(GUIEXECMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) $(CAT32): $(_TCLDIR)\win\cat.c $(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $? | > > > > > > > > > > > > > > > > > > > > > > > > | > | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | $(_VC_MANIFEST_EMBED_EXE) $(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB) $(GUIEXECMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) TKSCRIPTZIPTOP = tk_library #TKSCRIPTZIPTOP = "tk$(DOTVERSION)" $(TKSCRIPTZIP): .PHONY @echo Building Tk library zip file @if not exist "$(LIBTKVFS)" $(MKDIR) "$(LIBTKVFS)" @if exist "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)" $(RMDIR) "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)" @$(CPYDIR) $(LIBDIR) "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)" @cd "$(OUT_DIR)" && $(TCLSH) << file delete -force {$@} zipfs mkzip {$@} {$(LIBTKVFS)} {$(LIBTKVFS)} << !if $(STATIC_BUILD) $(WISHSCRIPTZIP): $(TKSCRIPTZIP) @echo Building Wish Tcl+Tk library zip file @if exist "$(LIBTKVFS)\tcl_library" $(RMDIR) "$(LIBTKVFS)\tcl_library" @cd "$(OUT_DIR)" && $(TCLSH) << file delete -force {$@} zipfs mount mnt "$(TCLSCRIPTZIP:\=/)" file copy [file join [zipfs root] mnt tcl_library] "$(LIBTKVFS:\=/)" zipfs mkzip {$@} {$(LIBTKVFS)} {$(LIBTKVFS)} << !endif $(CAT32): $(_TCLDIR)\win\cat.c $(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $? $(CONEXECMD) -stack:16384 $(TMP_DIR)\cat.obj $(_VC_MANIFEST_EMBED_EXE) #--------------------------------------------------------------------- # Regenerate the stubs files. [Development use only] #--------------------------------------------------------------------- genstubs: !if !exist($(TCLSH)) @echo Build tclsh first! !else set TCL_LIBRARY=$(TCL_LIBRARY) $(TCLSH) $(_TCLDIR)\tools\genStubs.tcl $(GENERICDIR) \ $(GENERICDIR)\$(PROJECT).decls $(GENERICDIR)\$(PROJECT)Int.decls $(TCLSH) $(_TCLDIR)\tools\genStubs.tcl $(GENERICDIR)\ttk $(GENERICDIR)\ttk\ttk.decls !endif #--------------------------------------------------------------------- # Build the Windows HTML help file. #--------------------------------------------------------------------- |
︙ | ︙ | |||
539 540 541 542 543 544 545 546 547 | @$(CPY) "$(OUT_DIR)\*.pdb" "$(BIN_INSTALL_DIR)\" # "emacs font-lock highlighting fix #--------------------------------------------------------------------- # Special case object file targets #--------------------------------------------------------------------- $(TMP_DIR)\testMain.obj: $(WIN_DIR)\winMain.c $(cc32) $(appcflags_nostubs) /DTK_TEST /DUNICODE /D_UNICODE \ | > | > > > > > > > > | > > > > > > > > | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | @$(CPY) "$(OUT_DIR)\*.pdb" "$(BIN_INSTALL_DIR)\" # "emacs font-lock highlighting fix #--------------------------------------------------------------------- # Special case object file targets #--------------------------------------------------------------------- # Note: Static builds now always mandate statically linking Tcl registry etc. $(TMP_DIR)\testMain.obj: $(WIN_DIR)\winMain.c $(cc32) $(appcflags_nostubs) /DTK_TEST /DUNICODE /D_UNICODE \ /DTCL_USE_STATIC_PACKAGES=$(STATIC_BUILD) \ -Fo$@ $? $(ROOT)\manifest.uuid: copy $(WIN_DIR)\gitmanifest.in $(ROOT)\manifest.uuid git rev-parse HEAD >>$(ROOT)\manifest.uuid $(TMP_DIR)\tkUuid.h: $(ROOT)\manifest.uuid copy $(WIN_DIR)\tkUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\tkUuid.h $(TMP_DIR)\tkTest.obj: $(GENERICDIR)\tkTest.c $(cc32) $(appcflags_nostubs) -Fo$@ $? $(TMP_DIR)\tkOldTest.obj: $(GENERICDIR)\tkOldTest.c $(cc32) $(appcflags_nostubs) -Fo$@ $? $(TMP_DIR)\tkWinTest.obj: $(WIN_DIR)\tkWinTest.c $(cc32) $(appcflags_nostubs) -Fo$@ $? $(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c $(cc32) $(appcflags_nostubs) -Fo$@ $? # Note: Static builds now always mandate statically linking Tcl registry etc. $(TMP_DIR)\winMain.obj: $(WIN_DIR)\winMain.c $(cc32) $(appcflags_nostubs) /DUNICODE /D_UNICODE \ /DTCL_USE_STATIC_PACKAGES=$(STATIC_BUILD) \ -Fo$@ $? $(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c $(cc32) $(pkgcflags) /DUNICODE /D_UNICODE -Fo$@ $? $(TMP_DIR)\tkPkgConfig.obj: $(GENERICDIR)\tkPkgConfig.c $(cc32) $(pkgcflags) \ -DCFG_RUNTIME_DLLFILE="\"$(TKLIBNAME)\"" \ -Fo$@ $? $(TMP_DIR)\tkWindow.obj: $(GENERICDIR)\tkWindow.c $(TMP_DIR)\tkUuid.h $(cc32) $(pkgcflags) -I$(TMP_DIR) -Fo$@ $? # The following objects are part of the stub library and should not # be built as DLL objects but none of the symbols should be exported # and no reference made to a C runtime. $(TMP_DIR)\tkStubLib.obj : $(GENERICDIR)\tkStubLib.c $(cc32) $(stubscflags) -Fo$@ $? |
︙ | ︙ | |||
661 662 663 664 665 666 667 | @$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\" !endif @$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\" !if !$(STATIC_BUILD) @echo creating package index @type << > $(OUT_DIR)\pkgIndex.tcl | | > > > | > > | > > | > > > > > > > | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | @$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\" !endif @$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\" !if !$(STATIC_BUILD) @echo creating package index @type << > $(OUT_DIR)\pkgIndex.tcl if {![package vsatisfies [package provide Tcl] 8.6-]} return if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)] || ([info exists ::argv] && ("-display" in $$::argv)))} { if {[package vsatisfies [package provide Tcl] 9.0]} { package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin libtcl9tk$(DOTVERSION).dll]]] } else { package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin libtk$(DOTVERSION).dll]]] } } else { if {[package vsatisfies [package provide Tcl] 9.0]} { package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin $(TKLIBNAME9)]]] } else { package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin $(TKLIBNAME8)]]] } } package ifneeded Tk $(TK_PATCH_LEVEL) [list package require -exact tk $(TK_PATCH_LEVEL)] << @$(CPY) $(OUT_DIR)\pkgIndex.tcl "$(SCRIPT_INSTALL_DIR)\" !endif #" install-libraries: @echo installing Tk headers @$(CPY) "$(GENERICDIR)\tk.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tkDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tkPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11\" !if !$(USING_PRE87_TCL) @$(CPY) "$(TKSCRIPTZIP)" "$(LIB_INSTALL_DIR)" !endif !if !$(TK_EMBED_SCRIPTS) @echo installing script library @$(CPY) "$(LIBDIR)\*" "$(SCRIPT_INSTALL_DIR)\" @echo installing theme library @$(CPY) "$(LIBDIR)\ttk\*" "$(SCRIPT_INSTALL_DIR)\ttk\" @echo installing images @$(CPY) "$(LIBDIR)\images\*" "$(SCRIPT_INSTALL_DIR)\images\" @echo installing language files @$(CPY) "$(LIBDIR)\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\" !endif @echo installing demos @$(CPY) "$(DEMODIR)\*" "$(DEMO_INSTALL_DIR)\" @$(CPY) "$(DEMODIR)\images\*" "$(DEMO_INSTALL_DIR)\images\" #" #--------------------------------------------------------------------- |
︙ | ︙ | |||
716 717 718 719 720 721 722 | @echo Removing $(WISH) ... @if exist $(WISH) del $(WISH) @echo Removing $(TKTEST) ... @if exist $(TKTEST) del $(TKTEST) @echo Removing $(TKSTUBLIB) ... @if exist $(TKSTUBLIB) del $(TKSTUBLIB) | > > > > > | 821 822 823 824 825 826 827 828 829 830 831 832 | @echo Removing $(WISH) ... @if exist $(WISH) del $(WISH) @echo Removing $(TKTEST) ... @if exist $(TKTEST) del $(TKTEST) @echo Removing $(TKSTUBLIB) ... @if exist $(TKSTUBLIB) del $(TKSTUBLIB) .PHONY: # Local Variables: # mode: makefile # End: |
Changes to win/nmakehlp.c.
1 2 3 4 5 6 | /* * ---------------------------------------------------------------------------- * nmakehlp.c -- * * This is used to fix limitations within nmake and the environment. * | | | | < < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /* * ---------------------------------------------------------------------------- * nmakehlp.c -- * * This is used to fix limitations within nmake and the environment. * * Copyright (c) 2002 David Gravereaux. * Copyright (c) 2006 Pat Thoyts * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * ---------------------------------------------------------------------------- */ #define _CRT_SECURE_NO_DEPRECATE #include <windows.h> #ifdef _MSC_VER #pragma comment (lib, "user32.lib") #pragma comment (lib, "kernel32.lib") #endif #include <stdio.h> #include <math.h> /* * This library is required for x64 builds with _some_ versions of MSVC */ #if defined(_M_IA64) || defined(_M_AMD64) |
︙ | ︙ | |||
38 39 40 41 42 43 44 | #define snprintf _snprintf #endif /* protos */ static int CheckForCompilerFeature(const char *option); | | | | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #define snprintf _snprintf #endif /* protos */ static int CheckForCompilerFeature(const char *option); static int CheckForLinkerFeature(char **options, int count); static int IsIn(const char *string, const char *substring); static int SubstituteFile(const char *substs, const char *filename); static int QualifyPath(const char *path); static int LocateDependency(const char *keyfile); static const char *GetVersionFromFile(const char *filename, const char *match, int numdots); static DWORD WINAPI ReadFromPipe(LPVOID args); /* globals */ #define CHUNK 25 #define STATICBUFFERSIZE 1000 typedef struct { HANDLE pipe; char buffer[STATICBUFFERSIZE]; } pipeinfo; pipeinfo Out = {INVALID_HANDLE_VALUE, ""}; pipeinfo Err = {INVALID_HANDLE_VALUE, ""}; /* * exitcodes: 0 == no, 1 == yes, 2 == error */ int main( int argc, char *argv[]) { char msg[300]; DWORD dwWritten; int chars; const char *s; /* * Make sure children (cl.exe and link.exe) are kept quiet. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); |
︙ | ︙ | |||
274 275 276 277 278 279 280 | if (!ok) { DWORD err = GetLastError(); int chars = snprintf(msg, sizeof(msg) - 1, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | if (!ok) { DWORD err = GetLastError(); int chars = snprintf(msg, sizeof(msg) - 1, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPSTR)&msg[chars], (300-chars), 0); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); return 2; } /* * Close our references to the write handles that have now been inherited. |
︙ | ︙ | |||
327 328 329 330 331 332 333 | || strstr(Err.buffer, "D9002") != NULL || strstr(Out.buffer, "D2021") != NULL || strstr(Err.buffer, "D2021") != NULL); } static int CheckForLinkerFeature( | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | || strstr(Err.buffer, "D9002") != NULL || strstr(Out.buffer, "D2021") != NULL || strstr(Err.buffer, "D2021") != NULL); } static int CheckForLinkerFeature( char **options, int count) { STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; DWORD threadID; char msg[300]; |
︙ | ︙ | |||
408 409 410 411 412 413 414 | if (!ok) { DWORD err = GetLastError(); int chars = snprintf(msg, sizeof(msg) - 1, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| | | | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | if (!ok) { DWORD err = GetLastError(); int chars = snprintf(msg, sizeof(msg) - 1, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPSTR)&msg[chars], (300-chars), 0); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); return 2; } /* * Close our references to the write handles that have now been inherited. |
︙ | ︙ | |||
504 505 506 507 508 509 510 | static const char * GetVersionFromFile( const char *filename, const char *match, int numdots) { | < | | | | < | | | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | static const char * GetVersionFromFile( const char *filename, const char *match, int numdots) { static char szBuffer[100]; char *szResult = NULL; FILE *fp = fopen(filename, "rt"); if (fp != NULL) { /* * Read data until we see our match string. */ while (fgets(szBuffer, sizeof(szBuffer), fp) != NULL) { LPSTR p, q; p = strstr(szBuffer, match); if (p != NULL) { /* * Skip to first digit after the match. */ p += strlen(match); while (*p && !isdigit((unsigned char)*p)) { ++p; } /* * Find ending whitespace. */ q = p; while (*q && (strchr("0123456789.ab", *q)) && (((!strchr(".ab", *q) && !strchr("ab", q[-1])) || --numdots))) { ++q; } *q = 0; szResult = p; break; } } fclose(fp); } return szResult; } |
︙ | ︙ | |||
563 564 565 566 567 568 569 | char * value; } list_item_t; /* insert a list item into the list (list may be null) */ static list_item_t * list_insert(list_item_t **listPtrPtr, const char *key, const char *value) { | | | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | char * value; } list_item_t; /* insert a list item into the list (list may be null) */ static list_item_t * list_insert(list_item_t **listPtrPtr, const char *key, const char *value) { list_item_t *itemPtr = (list_item_t *)malloc(sizeof(list_item_t)); if (itemPtr) { itemPtr->key = strdup(key); itemPtr->value = strdup(value); itemPtr->nextPtr = NULL; while(*listPtrPtr) { listPtrPtr = &(*listPtrPtr)->nextPtr; |
︙ | ︙ | |||
612 613 614 615 616 617 618 | */ static int SubstituteFile( const char *substitutions, const char *filename) { | < < | | | | > > > > > > > > > > > | < < | < < < > | | 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | */ static int SubstituteFile( const char *substitutions, const char *filename) { static char szBuffer[1024], szCopy[1024]; list_item_t *substPtr = NULL; FILE *fp, *sp; fp = fopen(filename, "rt"); if (fp != NULL) { /* * Build a list of substutitions from the first filename */ sp = fopen(substitutions, "rt"); if (sp != NULL) { while (fgets(szBuffer, sizeof(szBuffer), sp) != NULL) { unsigned char *ks, *ke, *vs, *ve; ks = (unsigned char*)szBuffer; while (ks && *ks && isspace(*ks)) ++ks; ke = ks; while (ke && *ke && !isspace(*ke)) ++ke; vs = ke; while (vs && *vs && isspace(*vs)) ++vs; ve = vs; while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve; *ke = 0, *ve = 0; list_insert(&substPtr, (char*)ks, (char*)vs); } fclose(sp); } /* debug: dump the list */ #ifndef NDEBUG { int n = 0; list_item_t *p = NULL; for (p = substPtr; p != NULL; p = p->nextPtr, ++n) { fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value); } } #endif /* * Run the substitutions over each line of the input */ while (fgets(szBuffer, sizeof(szBuffer), fp) != NULL) { list_item_t *p = NULL; for (p = substPtr; p != NULL; p = p->nextPtr) { char *m = strstr(szBuffer, p->key); if (m) { char *cp, *op, *sp; cp = szCopy; op = szBuffer; while (op != m) *cp++ = *op++; sp = p->value; while (sp && *sp) *cp++ = *sp++; op += strlen(p->key); while (*op) *cp++ = *op++; *cp = 0; memcpy(szBuffer, szCopy, sizeof(szCopy)); } } printf("%s", szBuffer); } list_free(&substPtr); } fclose(fp); return 0; } BOOL FileExists(LPCTSTR szPath) { #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #endif DWORD pathAttr = GetFileAttributes(szPath); return (pathAttr != INVALID_FILE_ATTRIBUTES && !(pathAttr & FILE_ATTRIBUTE_DIRECTORY)); } /* * QualifyPath -- * * This composes the current working directory with a provided path * and returns the fully qualified and normalized path. * Mostly needed to setup paths for testing. */ static int QualifyPath( const char *szPath) { char szCwd[MAX_PATH + 1]; GetFullPathName(szPath, sizeof(szCwd)-1, szCwd, NULL); printf("%s\n", szCwd); return 0; } /* * Implements LocateDependency for a single directory. See that command * for an explanation. * Returns 0 if found after printing the directory. * Returns 1 if not found but no errors. * Returns 2 on any kind of error * Basically, these are used as exit codes for the process. */ static int LocateDependencyHelper(const char *dir, const char *keypath) { HANDLE hSearch; char path[MAX_PATH+1]; size_t dirlen; int keylen, ret; WIN32_FIND_DATA finfo; if (dir == NULL || keypath == NULL) return 2; /* Have no real error reporting mechanism into nmake */ dirlen = strlen(dir); if ((dirlen + 3) > sizeof(path)) return 2; |
︙ | ︙ | |||
761 762 763 764 765 766 767 | continue; sublen = strlen(finfo.cFileName); if ((dirlen+1+sublen+1+keylen+1) > sizeof(path)) continue; /* Path does not fit, assume not matched */ strncpy(path+dirlen+1, finfo.cFileName, sublen); path[dirlen+1+sublen] = '\\'; strncpy(path+dirlen+1+sublen+1, keypath, keylen+1); | | | 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | continue; sublen = strlen(finfo.cFileName); if ((dirlen+1+sublen+1+keylen+1) > sizeof(path)) continue; /* Path does not fit, assume not matched */ strncpy(path+dirlen+1, finfo.cFileName, sublen); path[dirlen+1+sublen] = '\\'; strncpy(path+dirlen+1+sublen+1, keypath, keylen+1); if (FileExists(path)) { /* Found a match, print to stdout */ path[dirlen+1+sublen] = '\0'; QualifyPath(path); ret = 0; break; } } while (FindNextFile(hSearch, &finfo)); |
︙ | ︙ | |||
787 788 789 790 791 792 793 | * the parent and grandparent of the current working directory. * If found, the command prints * name_DIRPATH=<full path of located directory> * and returns 0. If not found, does not print anything and returns 1. */ static int LocateDependency(const char *keypath) { | > | | | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | * the parent and grandparent of the current working directory. * If found, the command prints * name_DIRPATH=<full path of located directory> * and returns 0. If not found, does not print anything and returns 1. */ static int LocateDependency(const char *keypath) { size_t i; int ret; static const char *paths[] = {"..", "..\\..", "..\\..\\.."}; for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) { ret = LocateDependencyHelper(paths[i], keypath); if (ret == 0) return ret; } return ret; |
︙ | ︙ |
Changes to win/rc/tk.rc.
︙ | ︙ | |||
34 35 36 37 38 39 40 | BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tk DLL\0" VALUE "OriginalFilename", "tk" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".dll\0" VALUE "CompanyName", "ActiveState Corporation\0" VALUE "FileVersion", TK_PATCH_LEVEL | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tk DLL\0" VALUE "OriginalFilename", "tk" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".dll\0" VALUE "CompanyName", "ActiveState Corporation\0" VALUE "FileVersion", TK_PATCH_LEVEL VALUE "LegalCopyright", "Copyright \251 2001 ActiveState Corporation, et al\0" VALUE "ProductName", "Tk " TK_VERSION " for Windows\0" VALUE "ProductVersion", TK_PATCH_LEVEL END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 |
︙ | ︙ |
Changes to win/rc/wish.rc.
︙ | ︙ | |||
40 41 42 43 44 45 46 | BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Wish Application\0" VALUE "OriginalFilename", "wish" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".exe\0" VALUE "CompanyName", "ActiveState Corporation\0" VALUE "FileVersion", TK_PATCH_LEVEL | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Wish Application\0" VALUE "OriginalFilename", "wish" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".exe\0" VALUE "CompanyName", "ActiveState Corporation\0" VALUE "FileVersion", TK_PATCH_LEVEL VALUE "LegalCopyright", "Copyright \251 2000 ActiveState Corporation, et al\0" VALUE "ProductName", "Tk " TK_VERSION " for Windows\0" VALUE "ProductVersion", TK_PATCH_LEVEL END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 |
︙ | ︙ |
Changes to win/rules-ext.vc.
︙ | ︙ | |||
27 28 29 30 31 32 33 | !if "$(PROJECT)" == "tcl" !error The rules-ext.vc file is not intended for Tcl itself. !endif # We extract version numbers using the nmakehlp program. For now use # the local copy of nmakehlp. Once we locate Tcl, we will use that # one if it is newer. | > | > > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | !if "$(PROJECT)" == "tcl" !error The rules-ext.vc file is not intended for Tcl itself. !endif # We extract version numbers using the nmakehlp program. For now use # the local copy of nmakehlp. Once we locate Tcl, we will use that # one if it is newer. !if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" !if [$(CC) -nologo -DNDEBUG "nmakehlp.c" -link -subsystem:console > nul] !endif !else !if [copy x86_64-w64-mingw32-nmakehlp.exe nmakehlp.exe >NUL] !endif !endif # First locate the Tcl directory that we are working with. !if "$(TCLDIR)" != "" _RULESDIR = $(TCLDIR:/=\) |
︙ | ︙ |
Changes to win/rules.vc.
1 2 3 4 5 6 7 8 | #------------------------------------------------------------- -*- makefile -*- # rules.vc -- # # Part of the nmake based build system for Tcl and its extensions. # This file does all the hard work in terms of parsing build options, # compiler switches, defining common targets and macros. The Tcl makefile # directly includes this. Extensions include it via "rules-ext.vc". # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #------------------------------------------------------------- -*- makefile -*- # rules.vc -- # # Part of the nmake based build system for Tcl and its extensions. # This file does all the hard work in terms of parsing build options, # compiler switches, defining common targets and macros. The Tcl makefile # directly includes this. Extensions include it via "rules-ext.vc". # # See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for # detailed documentation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 2001-2003 David Gravereaux. # Copyright (c) 2003-2008 Patrick Thoyts # Copyright (c) 2017 Ashok P. Nadkarni #------------------------------------------------------------------------------ !ifndef _RULES_VC _RULES_VC = 1 # The following macros define the version of the rules.vc nmake build system # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 RULES_VERSION_MINOR = 10 # The PROJECT macro must be defined by parent makefile. !if "$(PROJECT)" == "" !error *** Error: Macro PROJECT not defined! Please define it before including rules.vc !endif !if "$(PRJ_PACKAGE_TCLNAME)" == "" |
︙ | ︙ | |||
407 408 409 410 411 412 413 | # following macros: # VCVERSION - the internal compiler version as 1200, 1400, 1910 etc. # This is also printed by the compiler in dotted form 19.10 etc. # VCVER - the "marketing version", for example Visual C++ 6 for internal # compiler version 1200. This is kept only for legacy reasons as it # does not make sense for recent Microsoft compilers. Only used for # output directory names. | | | | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | # following macros: # VCVERSION - the internal compiler version as 1200, 1400, 1910 etc. # This is also printed by the compiler in dotted form 19.10 etc. # VCVER - the "marketing version", for example Visual C++ 6 for internal # compiler version 1200. This is kept only for legacy reasons as it # does not make sense for recent Microsoft compilers. Only used for # output directory names. # ARCH - set to IX86, ARM64 or AMD64 depending on 32- or 64-bit target # NATIVE_ARCH - set to IX86, ARM64 or AMD64 for the host machine # MACHINE - same as $(ARCH) - legacy # _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed cc32 = $(CC) # built-in default. link32 = link lib32 = lib rc32 = $(RC) # built-in default. |
︙ | ︙ | |||
431 432 433 434 435 436 437 438 439 440 441 442 443 444 | _VC_MANIFEST_EMBED_DLL= VCVER=0 !if ![echo VCVERSION=_MSC_VER > vercl.x] \ && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \ && ![echo ARCH=IX86 >> vercl.x] \ && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ && ![echo ARCH=AMD64 >> vercl.x] \ && ![echo $(_HASH)endif >> vercl.x] \ && ![$(cc32) -nologo -TC -P vercl.x 2>NUL] !include vercl.i !if $(VCVERSION) < 1900 !if ![echo VCVER= ^\> vercl.vc] \ && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc] !include vercl.vc | > > | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | _VC_MANIFEST_EMBED_DLL= VCVER=0 !if ![echo VCVERSION=_MSC_VER > vercl.x] \ && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \ && ![echo ARCH=IX86 >> vercl.x] \ && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ && ![echo ARCH=AMD64 >> vercl.x] \ && ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \ && ![echo ARCH=ARM64 >> vercl.x] \ && ![echo $(_HASH)endif >> vercl.x] \ && ![$(cc32) -nologo -TC -P vercl.x 2>NUL] !include vercl.i !if $(VCVERSION) < 1900 !if ![echo VCVER= ^\> vercl.vc] \ && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc] !include vercl.vc |
︙ | ︙ | |||
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | #---------------------------------------------------------------- # The MACHINE macro is used by legacy makefiles so set it as well !ifdef MACHINE !if "$(MACHINE)" == "x86" !undef MACHINE MACHINE = IX86 !elseif "$(MACHINE)" == "x64" !undef MACHINE MACHINE = AMD64 !endif !if "$(MACHINE)" != "$(ARCH)" !error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). !endif !else MACHINE=$(ARCH) !endif #--------------------------------------------------------------- # The PLATFORM_IDENTIFY macro matches the values returned by # the Tcl platform::identify command !if "$(MACHINE)" == "AMD64" PLATFORM_IDENTIFY = win32-x86_64 !else PLATFORM_IDENTIFY = win32-ix86 !endif # The MULTIPLATFORM macro controls whether binary extensions are installed # in platform-specific directories. Intended to be set/used by extensions. !ifndef MULTIPLATFORM_INSTALL MULTIPLATFORM_INSTALL = 0 !endif #------------------------------------------------------------ # Figure out the *host* architecture by reading the registry !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 !else NATIVE_ARCH=AMD64 !endif # Since MSVC8 we must deal with manifest resources. !if $(VCVERSION) >= 1400 _VC_MANIFEST_EMBED_EXE=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:$@;1 | > > > > > > > | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | #---------------------------------------------------------------- # The MACHINE macro is used by legacy makefiles so set it as well !ifdef MACHINE !if "$(MACHINE)" == "x86" !undef MACHINE MACHINE = IX86 !elseif "$(MACHINE)" == "arm64" !undef MACHINE MACHINE = ARM64 !elseif "$(MACHINE)" == "x64" !undef MACHINE MACHINE = AMD64 !endif !if "$(MACHINE)" != "$(ARCH)" !error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). !endif !else MACHINE=$(ARCH) !endif #--------------------------------------------------------------- # The PLATFORM_IDENTIFY macro matches the values returned by # the Tcl platform::identify command !if "$(MACHINE)" == "AMD64" PLATFORM_IDENTIFY = win32-x86_64 !elseif "$(MACHINE)" == "ARM64" PLATFORM_IDENTIFY = win32-arm !else PLATFORM_IDENTIFY = win32-ix86 !endif # The MULTIPLATFORM macro controls whether binary extensions are installed # in platform-specific directories. Intended to be set/used by extensions. !ifndef MULTIPLATFORM_INSTALL MULTIPLATFORM_INSTALL = 0 !endif #------------------------------------------------------------ # Figure out the *host* architecture by reading the registry !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 !elseif ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i ARM | findstr /i 64-bit] NATIVE_ARCH=ARM64 !else NATIVE_ARCH=AMD64 !endif # Since MSVC8 we must deal with manifest resources. !if $(VCVERSION) >= 1400 _VC_MANIFEST_EMBED_EXE=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:$@;1 |
︙ | ︙ | |||
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | !endif # $(TCLINSTALL) !endif # !$(DOING_TCL) !endif # NMAKEHLPC # We always build nmakehlp even if it exists since we do not know # what source it was built from. !if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul] !endif ################################################################ # 5. Test for compiler features # Visual C++ compiler options have changed over the years. Check # which options are supported by the compiler in use. # # The following macros are set: | > > > > > | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | !endif # $(TCLINSTALL) !endif # !$(DOING_TCL) !endif # NMAKEHLPC # We always build nmakehlp even if it exists since we do not know # what source it was built from. !if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" !if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul] !endif !else !if [copy $(NMAKEHLPC:nmakehlp.c=x86_64-w64-mingw32-nmakehlp.exe) nmakehlp.exe >NUL] !endif !endif ################################################################ # 5. Test for compiler features # Visual C++ compiler options have changed over the years. Check # which options are supported by the compiler in use. # # The following macros are set: |
︙ | ︙ | |||
648 649 650 651 652 653 654 655 | # If compiler has enabled link time optimization, linker must too with -ltcg !ifdef CC_GL_OPT_ENABLED !if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)] LINKERFLAGS = $(LINKERFLAGS) -ltcg !endif !endif ######################################################################## | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | < | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | # If compiler has enabled link time optimization, linker must too with -ltcg !ifdef CC_GL_OPT_ENABLED !if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)] LINKERFLAGS = $(LINKERFLAGS) -ltcg !endif !endif ################################################################ # 6. Extract various version numbers from headers # For Tcl and Tk, version numbers are extracted from tcl.h and tk.h # respectively. For extensions, versions are extracted from the # configure.in or configure.ac from the TEA configuration if it # exists, and unset otherwise. # Sets the following macros: # TCL_MAJOR_VERSION # TCL_MINOR_VERSION # TCL_RELEASE_SERIAL # TCL_PATCH_LEVEL # TCL_PATCH_LETTER # TCL_VERSION # TK_MAJOR_VERSION # TK_MINOR_VERSION # TK_RELEASE_SERIAL # TK_PATCH_LEVEL # TK_PATCH_LETTER # TK_VERSION # DOTVERSION - set as (for example) 2.5 # VERSION - set as (for example 25) #-------------------------------------------------------------- !if [echo REM = This file is generated from rules.vc > versions.vc] !endif !if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" "define TCL_MAJOR_VERSION" >> versions.vc] !endif !if [echo TCL_MINOR_VERSION = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] !endif !if [echo TCL_RELEASE_SERIAL = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" TCL_RELEASE_SERIAL >> versions.vc] !endif !if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] !endif !if defined(_TK_H) !if [echo TK_MAJOR_VERSION = \>> versions.vc] \ && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc] !endif !if [echo TK_MINOR_VERSION = \>> versions.vc] \ && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc] !endif !if [echo TK_RELEASE_SERIAL = \>> versions.vc] \ && [nmakehlp -V "$(_TK_H)" TK_RELEASE_SERIAL >> versions.vc] !endif !if [echo TK_PATCH_LEVEL = \>> versions.vc] \ && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc] !endif !endif # _TK_H !include versions.vc TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) !if [nmakehlp -f $(TCL_PATCH_LEVEL) "a"] TCL_PATCH_LETTER = a !elseif [nmakehlp -f $(TCL_PATCH_LEVEL) "b"] TCL_PATCH_LETTER = b !else TCL_PATCH_LETTER = . !endif !if defined(_TK_H) TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !if [nmakehlp -f $(TK_PATCH_LEVEL) "a"] TK_PATCH_LETTER = a !elseif [nmakehlp -f $(TK_PATCH_LEVEL) "b"] TK_PATCH_LETTER = b !else TK_PATCH_LETTER = . !endif !endif # Set DOTVERSION and VERSION !if $(DOING_TCL) DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) VERSION = $(TCL_VERSION) !elseif $(DOING_TK) DOTVERSION = $(TK_DOTVERSION) VERSION = $(TK_VERSION) !else # Doing a non-Tk extension # If parent makefile has not defined DOTVERSION, try to get it from TEA # first from a configure.in file, and then from configure.ac !ifndef DOTVERSION !if [echo DOTVERSION = \> versions.vc] \ || [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc] !if [echo DOTVERSION = \> versions.vc] \ || [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc] !error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc. !endif !endif !include versions.vc !endif # DOTVERSION VERSION = $(DOTVERSION:.=) !endif # $(DOING_TCL) ... etc. # Windows RC files have 3 version components. Ensure this irrespective # of how many components the package has specified. Basically, ensure # minimum 4 components by appending 4 0's and then pick out the first 4. # Also take care of the fact that DOTVERSION may have "a" or "b" instead # of "." separating the version components. DOTSEPARATED=$(DOTVERSION:a=.) DOTSEPARATED=$(DOTSEPARATED:b=.) !if [echo RCCOMMAVERSION = \> versions.vc] \ || [for /f "tokens=1,2,3,4,5* delims=." %a in ("$(DOTSEPARATED).0.0.0.0") do echo %a,%b,%c,%d >> versions.vc] !error *** Could not generate RCCOMMAVERSION *** !endif !include versions.vc ######################################################################## # 7. Parse the OPTS macro to work out the requested build configuration. # Based on this, we will construct the actual switches to be passed to the # compiler and linker using the macros defined in the previous section. # The following macros are defined by this section based on OPTS # STATIC_BUILD - 0 -> Tcl is to be built as a shared library # 1 -> build as a static library and shell # TCL_THREADS - legacy but always 1 on Windows since winsock requires it. # DEBUG - 1 -> debug build, 0 -> release builds # SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's # PROFILE - 1 -> generate profiling info, 0 -> no profiling # PGO - 1 -> profile based optimization, 0 -> no # MSVCRT - 1 -> link to dynamic C runtime even when building static Tcl build # 0 -> link to static C runtime for static Tcl build. # Does not impact shared Tcl builds (STATIC_BUILD == 0) # Default: 1 for Tcl 8.7 and up, 0 otherwise. # TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions # in the Tcl and Wish shell. 0 -> keep them as shared libraries. Does # not impact shared Tcl builds. Implied by STATIC_BUILD since Tcl 8.7. # USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation. # 0 -> Use the non-thread allocator. # UNCHECKED - 1 -> when doing a debug build with symbols, use the release # C runtime, 0 -> use the debug C runtime. # USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking # CONFIG_CHECK - 1 -> check current build configuration against Tcl # configuration (ignored for Tcl itself) # _USE_64BIT_TIME_T - forces a build using 64-bit time_t for 32-bit build # (CRT library should support this, not needed for Tcl 9.x) # TCL_UTF_MAX=3 - forces a build using UTF-16 internally (not recommended). # Further, LINKERFLAGS are modified based on above. # Default values for all the above STATIC_BUILD = 0 TCL_THREADS = 1 DEBUG = 0 SYMBOLS = 0 |
︙ | ︙ | |||
720 721 722 723 724 725 726 | !if [nmakehlp -f $(OPTS) "nomsvcrt"] !message *** Doing nomsvcrt MSVCRT = 0 !else !if [nmakehlp -f $(OPTS) "msvcrt"] !message *** Doing msvcrt !else | | | | | | | 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | !if [nmakehlp -f $(OPTS) "nomsvcrt"] !message *** Doing nomsvcrt MSVCRT = 0 !else !if [nmakehlp -f $(OPTS) "msvcrt"] !message *** Doing msvcrt !else !if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7 && $(STATIC_BUILD) MSVCRT = 0 !endif !endif !endif # [nmakehlp -f $(OPTS) "nomsvcrt"] !if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD) !message *** Doing staticpkg TCL_USE_STATIC_PACKAGES = 1 !endif !if [nmakehlp -f $(OPTS) "nothreads"] !message *** Compile explicitly for non-threaded tcl TCL_THREADS = 0 USE_THREAD_ALLOC= 0 !endif !if $(TCL_MAJOR_VERSION) == 8 !if [nmakehlp -f $(OPTS) "time64bit"] !message *** Force 64-bit time_t _USE_64BIT_TIME_T = 1 !endif !if [nmakehlp -f $(OPTS) "utf16"] !message *** Force UTF-16 internally TCL_UTF_MAX = 3 !endif !endif # Yes, it's weird that the "symbols" option controls DEBUG and # the "pdbs" option controls SYMBOLS. That's historical. !if [nmakehlp -f $(OPTS) "symbols"] !message *** Doing symbols |
︙ | ︙ | |||
832 833 834 835 836 837 838 | MSG=^ This compiler does not support profile guided optimization. !error $(MSG) !endif !endif ################################################################ | | | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | MSG=^ This compiler does not support profile guided optimization. !error $(MSG) !endif !endif ################################################################ # 8. Parse the STATS macro to configure code instrumentation # The following macros are set by this section: # TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation # 0 -> disables # TCL_COMPILE_DEBUG - 1 -> enables byte compiler logging # 0 -> disables # Default both are off |
︙ | ︙ | |||
862 863 864 865 866 867 868 | !else TCL_COMPILE_DEBUG = 0 !endif !endif #################################################################### | | | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | !else TCL_COMPILE_DEBUG = 0 !endif !endif #################################################################### # 9. Parse the CHECKS macro to configure additional compiler checks # The following macros are set by this section: # WARNINGS - compiler switches that control the warnings level # TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions # 0 -> enable deprecated functions # Defaults - Permit deprecated functions and warning level 3 TCL_NO_DEPRECATED = 0 |
︙ | ︙ | |||
894 895 896 897 898 899 900 | !if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] !message *** Doing 64bit portability warnings WARNINGS = $(WARNINGS) -Wp64 !endif !endif | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 | !if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] !message *** Doing 64bit portability warnings WARNINGS = $(WARNINGS) -Wp64 !endif !endif ################################################################ # 10. Construct output directory and file paths # Figure-out how to name our intermediate and output directories. # In order to avoid inadvertent mixing of object files built using # different compilers, build configurations etc., # |
︙ | ︙ | |||
1083 1084 1085 1086 1087 1088 1089 1090 | !error *** Could not fully qualify path TMP_DIR=$(TMP_DIR) !endif !include nmakehlp.out # The name of the stubs library for the project being built STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions | > > | > > > > > | 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 | !error *** Could not fully qualify path TMP_DIR=$(TMP_DIR) !endif !include nmakehlp.out # The name of the stubs library for the project being built STUBPREFIX = $(PROJECT)stub # # Set up paths to various Tcl executables and libraries needed by extensions # # TIP 430. Unused for 8.6 but no harm defining it to allow a common rules.vc TCLSCRIPTZIPNAME = libtcl$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)$(TCL_PATCH_LETTER)$(TCL_RELEASE_SERIAL).zip TKSCRIPTZIPNAME = libtk$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)$(TK_PATCH_LETTER)$(TK_RELEASE_SERIAL).zip !if $(DOING_TCL) TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) TCLSCRIPTZIP = $(OUT_DIR)\$(TCLSCRIPTZIPNAME) TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) TCL_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)" !else # !$(DOING_TCL) |
︙ | ︙ | |||
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 | # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\lib TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target TCL_INCLUDES = -I"$(_TCLDIR)\include" !else # Building against Tcl sources TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe !if !exist($(TCLSH)) TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\library TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = $(_TCLDIR)\tools TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" !endif # TCLINSTALL tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)" | > > | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 | # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\lib TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib TCLSCRIPTZIP = $(_TCLDIR)\lib\$(TCLSCRIPTZIPNAME) TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target TCL_INCLUDES = -I"$(_TCLDIR)\include" !else # Building against Tcl sources TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe !if !exist($(TCLSH)) TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\library TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib TCLSCRIPTZIP = $(_TCLDIR)\win\$(BUILDDIRTOP)\$(TCLSCRIPTZIPNAME) TCLTOOLSDIR = $(_TCLDIR)\tools TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" !endif # TCLINSTALL tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)" |
︙ | ︙ | |||
1160 1161 1162 1163 1164 1165 1166 | !endif !endif # Do the same for Tk and Tk extensions that require the Tk libraries !if $(DOING_TK) || $(NEED_TK) WISHNAMEPREFIX = wish WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe | | > > | > > > > > | > > > > > > > | > > > > > > | 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 | !endif !endif # Do the same for Tk and Tk extensions that require the Tk libraries !if $(DOING_TK) || $(NEED_TK) WISHNAMEPREFIX = wish WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe TKLIBNAME8 = tk$(TK_VERSION)$(SUFX).$(EXT) TKLIBNAME9 = tcl9tk$(TK_VERSION)$(SUFX).$(EXT) !if $(TCL_MAJOR_VERSION) == 8 TKLIBNAME = tk$(TK_VERSION)$(SUFX).$(EXT) TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib !else TKLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).$(EXT) TKIMPLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).lib !endif TKSTUBLIBNAME = tkstub$(TK_VERSION).lib !if $(DOING_TK) WISH = $(OUT_DIR)\$(WISHNAME) TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) TKLIB = $(OUT_DIR)\$(TKLIBNAME) TK_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)" TKSCRIPTZIP = $(OUT_DIR)\$(TKSCRIPTZIPNAME) !else # effectively NEED_TK !if $(TKINSTALL) # Building against installed Tk WISH = $(_TKDIR)\bin\$(WISHNAME) TKSTUBLIB = $(_TKDIR)\lib\$(TKSTUBLIBNAME) TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) # When building extensions, may be linking against Tk that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TKIMPLIB)") TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) !endif TK_INCLUDES = -I"$(_TKDIR)\include" TKSCRIPTZIP = $(_TKDIR)\lib\$(TKSCRIPTZIPNAME) !else # Building against Tk sources WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME) TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME) TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) # When building extensions, may be linking against Tk that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TKIMPLIB)") TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) !endif TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" TKSCRIPTZIP = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSCRIPTZIPNAME) !endif # TKINSTALL tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" !endif # $(DOING_TK) !endif # $(DOING_TK) || $(NEED_TK) # Various output paths PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib PRJLIBNAME8 = $(PROJECT)$(VERSION)$(SUFX).$(EXT) PRJLIBNAME9 = tcl9$(PROJECT)$(VERSION)$(SUFX).$(EXT) !if $(TCL_MAJOR_VERSION) == 8 PRJLIBNAME = $(PRJLIBNAME8) !else PRJLIBNAME = $(PRJLIBNAME9) !endif PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) # If extension parent makefile has not defined a resource definition file, # we will generate one from standard template. |
︙ | ︙ | |||
1281 1282 1283 1284 1285 1286 1287 | # lflags - complete linker switches (subsumes ldebug) except subsystem type # dlllflags - complete linker switches to build DLLs (subsumes lflags) # conlflags - complete linker switches for console program (subsumes lflags) # guilflags - complete linker switches for GUI program (subsumes lflags) # baselibs - minimum Windows libraries required. Parent makefile can # define PRJ_LIBS before including rules.rc if additional libs are needed | | | | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | # lflags - complete linker switches (subsumes ldebug) except subsystem type # dlllflags - complete linker switches to build DLLs (subsumes lflags) # conlflags - complete linker switches for console program (subsumes lflags) # guilflags - complete linker switches for GUI program (subsumes lflags) # baselibs - minimum Windows libraries required. Parent makefile can # define PRJ_LIBS before including rules.rc if additional libs are needed OPTDEFINES = /DSTDC_HEADERS /DUSE_NMAKE=1 !if $(VCVERSION) > 1600 OPTDEFINES = $(OPTDEFINES) /DHAVE_STDINT_H=1 !else OPTDEFINES = $(OPTDEFINES) /DMP_NO_STDINT=1 !endif !if $(VCVERSION) >= 1800 OPTDEFINES = $(OPTDEFINES) /DHAVE_INTTYPES_H=1 /DHAVE_STDBOOL_H=1 !endif |
︙ | ︙ | |||
1307 1308 1309 1310 1311 1312 1313 | OPTDEFINES = $(OPTDEFINES) /DUSE_THREAD_ALLOC=1 !endif !endif !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) /DSTATIC_BUILD !elseif $(TCL_VERSION) > 86 OPTDEFINES = $(OPTDEFINES) /DTCL_WITH_EXTERNAL_TOMMATH | | | 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 | OPTDEFINES = $(OPTDEFINES) /DUSE_THREAD_ALLOC=1 !endif !endif !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) /DSTATIC_BUILD !elseif $(TCL_VERSION) > 86 OPTDEFINES = $(OPTDEFINES) /DTCL_WITH_EXTERNAL_TOMMATH !if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" OPTDEFINES = $(OPTDEFINES) /DMP_64BIT !endif !endif !if $(TCL_NO_DEPRECATED) OPTDEFINES = $(OPTDEFINES) /DTCL_NO_DEPRECATED !endif |
︙ | ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | !if $(OPTIMIZING) OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_OPTIMIZED !endif !endif !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_PROFILED !endif | | | < < < > > > | 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 | !if $(OPTIMIZING) OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_OPTIMIZED !endif !endif !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_PROFILED !endif !if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_DO64BIT !endif !if $(VCVERSION) < 1300 OPTDEFINES = $(OPTDEFINES) /DNO_STRTOI64=1 !endif !if $(TCL_MAJOR_VERSION) == 8 !if "$(_USE_64BIT_TIME_T)" == "1" OPTDEFINES = $(OPTDEFINES) /D_USE_64BIT_TIME_T=1 !endif # _ATL_XP_TARGETING - Newer SDK's need this to build for XP COMPILERFLAGS = /D_ATL_XP_TARGETING !endif !if "$(TCL_UTF_MAX)" == "3" OPTDEFINES = $(OPTDEFINES) /DTCL_UTF_MAX=3 !endif # Like the TEA system only set this non empty for non-Tk extensions # Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME # so we pass both !if !$(DOING_TCL) && !$(DOING_TK) PKGNAMEFLAGS = /DPACKAGE_NAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ /DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ |
︙ | ︙ | |||
1394 1395 1396 1397 1398 1399 1400 | cdebug = $(OPTIMIZATIONS) !if $(SYMBOLS) cdebug = $(cdebug) -Zi !endif !endif # $(DEBUG) | | | | > > > > > | 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 | cdebug = $(OPTIMIZATIONS) !if $(SYMBOLS) cdebug = $(cdebug) -Zi !endif !endif # $(DEBUG) # cwarn includes default warning levels, also C4090 (buggy) and C4146 is useless. cwarn = $(WARNINGS) -wd4090 -wd4146 !if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" # Disable pointer<->int warnings related to cast between different sizes # There are a gadzillion of these due to use of ClientData and # clutter up compiler # output increasing chance of a real warning getting lost. So disable them. # Eventually some day, Tcl will be 64-bit clean. cwarn = $(cwarn) -wd4311 -wd4312 !endif ### Common compiler options that are architecture specific !if "$(MACHINE)" == "ARM" carch = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE !else carch = !endif # cpuid is only available on intel machines !if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "AMD64" carch = $(carch) /DHAVE_CPUID=1 !endif !if $(DEBUG) # Turn warnings into errors cwarn = $(cwarn) -WX !endif INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) |
︙ | ︙ | |||
1452 1453 1454 1455 1456 1457 1458 | # here irrespective of the OPTS setting. # # TBD - tclvfs has a comment that stubs libs should not be compiled with -GL # without stating why. Tcl itself compiled stubs libs with this flag. # so we do not remove it from cflags. -GL may prevent extensions # compiled with one VC version to fail to link against stubs library # compiled with another VC version. Check for this and fix accordingly. | | | 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 | # here irrespective of the OPTS setting. # # TBD - tclvfs has a comment that stubs libs should not be compiled with -GL # without stating why. Tcl itself compiled stubs libs with this flag. # so we do not remove it from cflags. -GL may prevent extensions # compiled with one VC version to fail to link against stubs library # compiled with another VC version. Check for this and fix accordingly. stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) /Zl /GL- /DSTATIC_BUILD $(INCLUDES) $(USE_STUBS_DEFS) # Link flags !if $(DEBUG) ldebug = -debug -debugtype:cv !else ldebug = -release -opt:ref -opt:icf,3 |
︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 | !endif ### Declarations common to all linker versions lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 lflags = $(lflags) -nodefaultlib:libucrt.lib | < < < < < < < < < < < < | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | !endif ### Declarations common to all linker versions lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 lflags = $(lflags) -nodefaultlib:libucrt.lib !endif dlllflags = $(lflags) -dll conlflags = $(lflags) -subsystem:console guilflags = $(lflags) -subsystem:windows # Libraries that are required for every image. |
︙ | ︙ | |||
1545 1546 1547 1548 1549 1550 1551 1552 | DEFAULT_BUILD_TARGET = $(PROJECT) !endif default-target: $(DEFAULT_BUILD_TARGET) !if $(MULTIPLATFORM_INSTALL) default-pkgindex: @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ | > | > > > > > | > > > > > > | 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | DEFAULT_BUILD_TARGET = $(PROJECT) !endif default-target: $(DEFAULT_BUILD_TARGET) !if $(MULTIPLATFORM_INSTALL) default-pkgindex: @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl @echo } else { >> $(OUT_DIR)\pkgIndex.tcl @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl @echo } >> $(OUT_DIR)\pkgIndex.tcl !else default-pkgindex: @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl @echo } else { >> $(OUT_DIR)\pkgIndex.tcl @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl @echo } >> $(OUT_DIR)\pkgIndex.tcl !endif default-pkgindex-tea: @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl @PACKAGE_VERSION@ $(DOTVERSION) @PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME) @PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME) @PKG_LIB_FILE@ $(PRJLIBNAME) @PKG_LIB_FILE8@ $(PRJLIBNAME8) @PKG_LIB_FILE9@ $(PRJLIBNAME9) << default-install: default-install-binaries default-install-libraries !if $(SYMBOLS) default-install: default-install-pdbs !endif |
︙ | ︙ | |||
1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 | @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL default-install-pdbs: @echo Installing PDBs to '$(LIB_INSTALL_DIR)' @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" @$(CPY) "$(OUT_DIR)\*.pdb" "$(LIB_INSTALL_DIR)\" default-install-docs-html: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)" default-install-docs-n: | > > | 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 | @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL default-install-pdbs: @echo Installing PDBs to '$(LIB_INSTALL_DIR)' @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" @$(CPY) "$(OUT_DIR)\*.pdb" "$(LIB_INSTALL_DIR)\" # "emacs font-lock highlighting fix default-install-docs-html: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)" default-install-docs-n: |
︙ | ︙ | |||
1760 1761 1762 1763 1764 1765 1766 | !if !$(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl !if exist("$(_TCLDIR)\lib\nmake\tcl.nmake") TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake" !endif !else # !$(TCLINSTALL) - building against Tcl source | | | | 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 | !if !$(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl !if exist("$(_TCLDIR)\lib\nmake\tcl.nmake") TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake" !endif !else # !$(TCLINSTALL) - building against Tcl source !if exist("$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl.nmake") TCLNMAKECONFIG = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl.nmake" !endif !endif # TCLINSTALL !if $(CONFIG_CHECK) !ifdef TCLNMAKECONFIG !include $(TCLNMAKECONFIG) |
︙ | ︙ |
Added win/svnmanifest.in.
> | 1 | svn-r |
Changes to win/targets.vc.
1 2 3 4 5 6 | #------------------------------------------------------------- -*- makefile -*- # targets.vc -- # # Part of the nmake based build system for Tcl and its extensions. # This file defines some standard targets for the convenience of extensions # and can be optionally included by the extension makefile. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #------------------------------------------------------------- -*- makefile -*- # targets.vc -- # # Part of the nmake based build system for Tcl and its extensions. # This file defines some standard targets for the convenience of extensions # and can be optionally included by the extension makefile. # See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for docs. $(PROJECT): setup pkgindex $(PRJLIB) !ifdef PRJ_STUBOBJS $(PROJECT): $(PRJSTUBLIB) $(PRJSTUBLIB): $(PRJ_STUBOBJS) $(LIBCMD) $** |
︙ | ︙ |
Changes to win/tcl.m4.
︙ | ︙ | |||
24 25 26 27 28 29 30 | # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true AC_ARG_WITH(tcl, | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true AC_ARG_WITH(tcl, AS_HELP_STRING([--with-tcl], [directory containing tcl configuration (tclConfig.sh)]), [with_tclconfig="${withval}"]) AC_MSG_CHECKING([for Tcl configuration]) AC_CACHE_VAL(ac_cv_c_tclconfig,[ # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case "${with_tclconfig}" in */tclConfig.sh ) |
︙ | ︙ | |||
142 143 144 145 146 147 148 | # the alternative search directory is invoked by --with-tk # if test x"${no_tk}" = x ; then # we reset no_tk in case something fails here no_tk=true AC_ARG_WITH(tk, | | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | # the alternative search directory is invoked by --with-tk # if test x"${no_tk}" = x ; then # we reset no_tk in case something fails here no_tk=true AC_ARG_WITH(tk, AS_HELP_STRING([--with-tk], [directory containing tk configuration (tkConfig.sh)]), [with_tkconfig="${withval}"]) AC_MSG_CHECKING([for Tk configuration]) AC_CACHE_VAL(ac_cv_c_tkconfig,[ # First check to see if --with-tkconfig was specified. if test x"${with_tkconfig}" != x ; then case "${with_tkconfig}" in */tkConfig.sh ) |
︙ | ︙ | |||
247 248 249 250 251 252 253 | # # Results: # # Substitutes the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE | < | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | # # Results: # # Substitutes the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE # #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TCLCONFIG], [ AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then |
︙ | ︙ | |||
284 285 286 287 288 289 290 | eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) | < | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_FILE) AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) |
︙ | ︙ | |||
354 355 356 357 358 359 360 | #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SHARED], [ AC_MSG_CHECKING([how to build libraries]) AC_ARG_ENABLE(shared, [ --enable-shared build and link with shared libraries (default: on)], [tcl_ok=$enableval], [tcl_ok=yes]) | < < < < < < < < | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SHARED], [ AC_MSG_CHECKING([how to build libraries]) AC_ARG_ENABLE(shared, [ --enable-shared build and link with shared libraries (default: on)], [tcl_ok=$enableval], [tcl_ok=yes]) if test "$tcl_ok" = "yes" ; then AC_MSG_RESULT([shared]) SHARED_BUILD=1 else AC_MSG_RESULT([static]) SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) |
︙ | ︙ | |||
459 460 461 462 463 464 465 466 467 468 469 470 471 472 | # Results: # # Can the following vars: # EXTRA_CFLAGS # CFLAGS_DEBUG # CFLAGS_OPTIMIZE # CFLAGS_WARNING # LDFLAGS_DEBUG # LDFLAGS_OPTIMIZE # LDFLAGS_CONSOLE # LDFLAGS_WINDOW # CC_OBJNAME # CC_EXENAME # CYGPATH | > | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | # Results: # # Can the following vars: # EXTRA_CFLAGS # CFLAGS_DEBUG # CFLAGS_OPTIMIZE # CFLAGS_WARNING # CFLAGS_NOLTO # LDFLAGS_DEBUG # LDFLAGS_OPTIMIZE # LDFLAGS_CONSOLE # LDFLAGS_WINDOW # CC_OBJNAME # CC_EXENAME # CYGPATH |
︙ | ︙ | |||
506 507 508 509 510 511 512 | AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo) AC_CHECK_PROG(WINE, wine, wine,) SHLIB_SUFFIX=".dll" # MACHINE is IX86 for LINK, but this is used by the manifest, | | | | | | > > > > > > > | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo) AC_CHECK_PROG(WINE, wine, wine,) SHLIB_SUFFIX=".dll" # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|arm64|ia64. MACHINE="X86" if test "$GCC" = "yes"; then AC_CACHE_CHECK(for cross-compile version of gcc, ac_cv_cross, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifndef _WIN32 #error cross-compiler #endif ]], [[]])], [ac_cv_cross=no], [ac_cv_cross=yes]) ) if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; arm64|aarch64) CC="aarch64-w64-mingw32-${CC}" LD="aarch64-w64-mingw32-ld" AR="aarch64-w64-mingw32-ar" RANLIB="aarch64-w64-mingw32-ranlib" RC="aarch64-w64-mingw32-windres" ;; *) CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" RC="i686-w64-mingw32-windres" ;; |
︙ | ︙ | |||
580 581 582 583 584 585 586 | # set various compiler flags depending on whether we are using gcc or cl if test "${GCC}" = "yes" ; then extra_cflags="-pipe" extra_ldflags="-pipe -static-libgcc" AC_CACHE_CHECK(for mingw32 version of gcc, ac_cv_win32, | | | | | > > > | | < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | # set various compiler flags depending on whether we are using gcc or cl if test "${GCC}" = "yes" ; then extra_cflags="-pipe" extra_ldflags="-pipe -static-libgcc" AC_CACHE_CHECK(for mingw32 version of gcc, ac_cv_win32, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef _WIN32 #error win32 #endif ]], [[]])], [ac_cv_win32=no], [ac_cv_win32=yes]) ) if test "$ac_cv_win32" != "yes"; then AC_MSG_ERROR([${CC} cannot produce win32 executables.]) fi if test "$do64bit" != "arm64"; then extra_cflags="$extra_cflags -DHAVE_CPUID=1" fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain" AC_CACHE_CHECK(for working -municode linker flag, ac_cv_municode, AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <windows.h> int APIENTRY wWinMain(HINSTANCE a, HINSTANCE b, LPWSTR c, int d) {return 0;} ]], [[]])], [ac_cv_municode=yes], [ac_cv_municode=no]) ) CFLAGS=$hold_cflags if test "$ac_cv_municode" = "yes" ; then extra_ldflags="$extra_ldflags -municode" else extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS" fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" AC_CACHE_CHECK(for working -fno-lto, ac_cv_nolto, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [ac_cv_nolto=yes], [ac_cv_nolto=no]) ) CFLAGS=$hold_cflags if test "$ac_cv_nolto" = "yes" ; then CFLAGS_NOLTO="-fno-lto" else CFLAGS_NOLTO="" fi AC_CACHE_CHECK([if the compiler understands -finput-charset], tcl_cv_cc_input_charset, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_input_charset=yes],[tcl_cv_cc_input_charset=no]) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_input_charset = yes; then extra_cflags="$extra_cflags -finput-charset=UTF-8" fi fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--enable-auto-image-base" AC_CACHE_CHECK(for working --enable-auto-image-base, ac_cv_enable_auto_image_base, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [ac_cv_enable_auto_image_base=yes], [ac_cv_enable_auto_image_base=no]) ) CFLAGS=$hold_cflags if test "$ac_cv_enable_auto_image_base" == "yes" ; then extra_ldflags="$extra_ldflags -Wl,--enable-auto-image-base" fi AC_MSG_CHECKING([compiler flags]) if test "${GCC}" = "yes" ; then SHLIB_LD="" SHLIB_LD_LIBS='${LIBS}' LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32" # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32 -lwinspool" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= RC_INCLUDE=--include RC_DEFINE=--define RES=res.o MAKE_LIB="\${STLIB_LD} \[$]@" |
︙ | ︙ | |||
657 658 659 660 661 662 663 | LIBRARIES="\${SHARED_LIBRARIES}" fi # 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} \ | | | | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | LIBRARIES="\${SHARED_LIBRARIES}" fi # 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%.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="" SHLIB_SUFFIX=.dll EXTRA_CFLAGS="${extra_cflags}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= case "${CC}" in *++) CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" ;; *) CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers" ;; esac # Specify the CC output file names based on the target name CC_OBJNAME="-o \[$]@" CC_EXENAME="-o \[$]@" |
︙ | ︙ | |||
708 709 710 711 712 713 714 715 716 | LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) ;; ia64) MACHINE="IA64" | > > > > | | | | | | | | | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) ;; arm64|aarch64) MACHINE="ARM64" AC_MSG_RESULT([ Using ARM64 $MACHINE mode]) ;; ia64) MACHINE="IA64" AC_MSG_RESULT([ Using IA64 $MACHINE mode]) ;; *) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifndef _WIN64 #error 32-bit #endif ]], [[]])], [tcl_win_64bit=yes], [tcl_win_64bit=no] ) if test "$tcl_win_64bit" = "yes" ; then do64bit=amd64 MACHINE="AMD64" AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) fi ;; esac else if test "${SHARED_BUILD}" = "0" ; then # static AC_MSG_RESULT([using static flags]) |
︙ | ︙ | |||
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | LIBFLAGSUFFIX="" if test "$do64bit" != "no" ; then case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build ;; ia64) MACHINE="IA64" ;; esac AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) fi LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib" case "x`echo \${VisualStudioVersion}`" in x1[[4-9]]*) LIBS="$LIBS ucrt.lib" ;; *) ;; esac if test "$do64bit" != "no" ; then RC="rc" CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" | > > > < | | | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | LIBFLAGSUFFIX="" if test "$do64bit" != "no" ; then case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build ;; arm64|aarch64) MACHINE="ARM64" ;; ia64) MACHINE="IA64" ;; esac AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) fi LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib" case "x`echo \${VisualStudioVersion}`" in x1[[4-9]]*) LIBS="$LIBS ucrt.lib" ;; *) ;; esac if test "$do64bit" != "no" ; then RC="rc" CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo -MACHINE:${MACHINE}" LINKBIN="link" # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 LIBS="$LIBS bufferoverflowU.lib" else RC="rc" # -Od - no optimization # -WX - warnings as errors CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo" LINKBIN="link" fi LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib winspool.lib" SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" SHLIB_LD_LIBS='${LIBS}' # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" RC_OUT=-fo RC_TYPE=-r |
︙ | ︙ | |||
847 848 849 850 851 852 853 | if test "$do64bit" != "no" ; then AC_DEFINE(TCL_CFG_DO64BIT) fi if test "${GCC}" = "yes" ; then AC_CACHE_CHECK(for SEH support in compiler, tcl_cv_seh, | | | | | | | | | | | | | | | | | < | | | > | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | if test "$do64bit" != "no" ; then AC_DEFINE(TCL_CFG_DO64BIT) fi if test "${GCC}" = "yes" ; then AC_CACHE_CHECK(for SEH support in compiler, tcl_cv_seh, AC_RUN_IFELSE([AC_LANG_SOURCE([[ #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN int main(int argc, char** argv) { int a, b = 0; __try { a = 666 / b; } __except (EXCEPTION_EXECUTE_HANDLER) { return 0; } return 1; } ]])], [tcl_cv_seh=yes], [tcl_cv_seh=no], [tcl_cv_seh=no]) ) if test "$tcl_cv_seh" = "no" ; then AC_DEFINE(HAVE_NO_SEH, 1, [Defined when mingw does not support SEH]) fi # # Check to see if the excpt.h include file provided contains the # definition for EXCEPTION_DISPOSITION; if not, which is the case # with Cygwin's version as of 2002-04-10, define it to be int, # sufficient for getting the current code to work. # AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files, tcl_cv_eh_disposition, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ # define WIN32_LEAN_AND_MEAN # include <windows.h> # undef WIN32_LEAN_AND_MEAN ]], [[ EXCEPTION_DISPOSITION x; ]])], [tcl_cv_eh_disposition=yes], [tcl_cv_eh_disposition=no]) ) if test "$tcl_cv_eh_disposition" = "no" ; then AC_DEFINE(EXCEPTION_DISPOSITION, int, [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION]) fi # Check to see if winnt.h defines CHAR, SHORT, and LONG # even if VOID has already been #defined. The win32api # used by mingw and cygwin is known to do this. AC_CACHE_CHECK(for winnt.h that ignores VOID define, tcl_cv_winnt_ignore_void, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #define VOID void #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN ]], [[ CHAR c; SHORT s; LONG l; ]])], [tcl_cv_winnt_ignore_void=yes], [tcl_cv_winnt_ignore_void=no]) ) if test "$tcl_cv_winnt_ignore_void" = "yes" ; then AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1, [Defined when cygwin/mingw ignores VOID define in winnt.h]) fi AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],) # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. AC_CACHE_CHECK(for cast to union support, tcl_cv_cast_to_union, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ union foo { int i; double d; }; union foo f = (union foo) (int) 0; ]])], [tcl_cv_cast_to_union=yes], [tcl_cv_cast_to_union=no]) ) if test "$tcl_cv_cast_to_union" = "yes"; then AC_DEFINE(HAVE_CAST_TO_UNION, 1, [Defined when compiler supports casting to union type.]) fi fi # DL_LIBS is empty, but then we match the Unix version AC_SUBST(DL_LIBS) AC_SUBST(CFLAGS_DEBUG) AC_SUBST(CFLAGS_OPTIMIZE) AC_SUBST(CFLAGS_WARNING) AC_SUBST(CFLAGS_NOLTO) ]) #------------------------------------------------------------------------ # SC_WITH_TCL -- # # Location of the Tcl build directory. # |
︙ | ︙ | |||
1053 1054 1055 1056 1057 1058 1059 | # Results # Subst's the following values: # BUILD_TCLSH #------------------------------------------------------------------------ AC_DEFUN([SC_BUILD_TCLSH], [ AC_MSG_CHECKING([for tclsh in Tcl build directory]) | | | 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | # Results # Subst's the following values: # BUILD_TCLSH #------------------------------------------------------------------------ AC_DEFUN([SC_BUILD_TCLSH], [ AC_MSG_CHECKING([for tclsh in Tcl build directory]) BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}\${EXESUFFIX} AC_MSG_RESULT($BUILD_TCLSH) AC_SUBST(BUILD_TCLSH) ]) #-------------------------------------------------------------------- # SC_TCL_CFG_ENCODING TIP #59 # |
︙ | ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | AC_DEFUN([SC_TCL_CFG_ENCODING], [ AC_ARG_WITH(encoding, [ --with-encoding encoding for configuration values], with_tcencoding=${withval}) if test x"${with_tcencoding}" != x ; then AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}") else | < | | 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | AC_DEFUN([SC_TCL_CFG_ENCODING], [ AC_ARG_WITH(encoding, [ --with-encoding encoding for configuration values], with_tcencoding=${withval}) if test x"${with_tcencoding}" != x ; then AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}") else AC_DEFINE(TCL_CFGVAL_ENCODING,"utf-8") fi ]) #-------------------------------------------------------------------- # SC_EMBED_MANIFEST # # Figure out if we can embed the manifest where necessary |
︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 | # VC_MANIFEST_EMBED_EXE # #-------------------------------------------------------------------- AC_DEFUN([SC_EMBED_MANIFEST], [ AC_MSG_CHECKING(whether to embed manifest) AC_ARG_ENABLE(embedded-manifest, | | | 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | # VC_MANIFEST_EMBED_EXE # #-------------------------------------------------------------------- AC_DEFUN([SC_EMBED_MANIFEST], [ AC_MSG_CHECKING(whether to embed manifest) AC_ARG_ENABLE(embedded-manifest, AS_HELP_STRING([--enable-embedded-manifest], [embed manifest if possible (default: yes)]), [embed_ok=$enableval], [embed_ok=yes]) VC_MANIFEST_EMBED_DLL= VC_MANIFEST_EMBED_EXE= result=no if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \ |
︙ | ︙ |
Added win/tkUuid.h.in.
> | 1 | #define TK_VERSION_UUID \ |
Changes to win/tkWin.h.
1 2 3 4 5 6 | /* * tkWin.h -- * * Declarations of public types and interfaces that are only * available under Windows. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | /* * tkWin.h -- * * Declarations of public types and interfaces that are only * available under Windows. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKWIN #define _TKWIN /* * We must specify the lower version we intend to support. In particular * the SystemParametersInfo API doesn't like to receive structures that * are larger than it expects which affects the font assignments. * * WINVER = 0x0600 means Windows Vista and above. Even though we still * support Windows XP, but the Vista-specifics are tested at runtime. */ #ifndef WINVER # define WINVER 0x0601 #endif #ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0601 #endif #ifndef _WIN32_IE # define _WIN32_IE 0x0800 #endif #ifndef _TK #include <tk.h> #endif #define WIN32_LEAN_AND_MEAN |
︙ | ︙ |
Changes to win/tkWin32Dll.c.
1 2 3 4 5 | /* * tkWin32Dll.c -- * * This file contains a stub dll entry point. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkWin32Dll.c -- * * This file contains a stub dll entry point. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #ifndef STATIC_BUILD |
︙ | ︙ | |||
97 98 99 100 101 102 103 | BOOL APIENTRY DllMain( HINSTANCE hInstance, DWORD reason, LPVOID reserved) { | | | > > | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | BOOL APIENTRY DllMain( HINSTANCE hInstance, DWORD reason, LPVOID reserved) { #if defined(HAVE_NO_SEH) && !defined(__aarch64__) TCLEXCEPTION_REGISTRATION registration; #endif (void)reserved; /* * If we are attaching to the DLL from a new process, tell Tk about the * hInstance to use. */ switch (reason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hInstance); TkWinSetHINSTANCE(hInstance); break; case DLL_PROCESS_DETACH: /* * Protect the call to TkFinalize in an SEH block. We can't be * guaranteed Tk is always being unloaded from a stable condition. */ #ifdef HAVE_NO_SEH # if defined(__aarch64__) /* Don't run TkFinalize(NULL) on mingw-w64 for ARM64, since we don't have corresponding assembler-code. */ # elif defined(_WIN64) __asm__ __volatile__ ( /* * Construct an TCLEXCEPTION_REGISTRATION to protect the call to * TkFinalize */ "leaq %[registration], %%rdx" "\n\t" "movq %%gs:0, %%rax" "\n\t" "movq %%rax, 0x0(%%rdx)" "\n\t" /* link */ "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 */ /* * Link the TCLEXCEPTION_REGISTRATION on the chain |
︙ | ︙ |
Changes to win/tkWin3d.c.
1 2 3 4 5 6 | /* * tkWin3d.c -- * * This file contains the platform specific routines for drawing 3D * borders in the Windows 95 style. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWin3d.c -- * * This file contains the platform specific routines for drawing 3D * borders in the Windows 95 style. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tk3d.h" |
︙ | ︙ |
Changes to win/tkWinButton.c.
1 2 3 4 5 6 | /* * tkWinButton.c -- * * This file implements the Windows specific portion of the button * widgets. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinButton.c -- * * This file implements the Windows specific portion of the button * widgets. * * Copyright © 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #define OEMRESOURCE #include "tkWinInt.h" |
︙ | ︙ |
Changes to win/tkWinClipboard.c.
1 2 3 4 5 | /* * tkWinClipboard.c -- * * This file contains functions for managing the clipboard. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinClipboard.c -- * * This file contains functions for managing the clipboard. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tkSelect.h" |
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 | { char *data, *destPtr; Tcl_DString ds; HGLOBAL handle; Tcl_Encoding encoding; int result, locale, noBackslash = 0; if (!OpenClipboard(NULL)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "clipboard cannot be opened, another application grabbed it")); Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL); return TCL_ERROR; } | > > > > < < < < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | { char *data, *destPtr; Tcl_DString ds; HGLOBAL handle; Tcl_Encoding encoding; int result, locale, noBackslash = 0; if ((selection != Tk_InternAtom(tkwin, "CLIPBOARD")) || (target != XA_STRING)) { goto error; } if (!OpenClipboard(NULL)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "clipboard cannot be opened, another application grabbed it")); Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL); return TCL_ERROR; } /* * Attempt to get the data in Unicode form if available as this is less * work that CF_TEXT. */ result = TCL_ERROR; |
︙ | ︙ | |||
128 129 130 131 132 133 134 | if (encoding) { Tcl_FreeEncoding(encoding); } CloseClipboard(); goto error; } data = (char *)GlobalLock(handle); | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | if (encoding) { Tcl_FreeEncoding(encoding); } CloseClipboard(); goto error; } data = (char *)GlobalLock(handle); (void)Tcl_ExternalToUtfDStringEx(encoding, data, -1, TCL_ENCODING_NOCOMPLAIN, &ds); GlobalUnlock(handle); if (encoding) { Tcl_FreeEncoding(encoding); } } else if (IsClipboardFormatAvailable(CF_HDROP)) { DROPFILES *drop; |
︙ | ︙ |
Changes to win/tkWinColor.c.
1 2 3 4 5 | /* * tkWinColor.c -- * * Functions to map color names to system color values. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinColor.c -- * * Functions to map color names to system color values. * * Copyright © 1995 Sun Microsystems, Inc. * Copyright © 1994 Software Research Associates, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tkColor.h" |
︙ | ︙ | |||
297 298 299 300 301 302 303 | * Allocates a new color in the palette. * *---------------------------------------------------------------------- */ int XAllocColor( | | < | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | * Allocates a new color in the palette. * *---------------------------------------------------------------------- */ int XAllocColor( TCL_UNUSED(Display *), Colormap colormap, XColor *color) { TkWinColormap *cmap = (TkWinColormap *) colormap; PALETTEENTRY entry, closeEntry; HDC dc = GetDC(NULL); entry.peRed = (color->red) >> 8; entry.peGreen = (color->green) >> 8; entry.peBlue = (color->blue) >> 8; entry.peFlags = 0; if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) { |
︙ | ︙ | |||
398 399 400 401 402 403 404 | * set. * *---------------------------------------------------------------------- */ int XFreeColors( | | | < < | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | * set. * *---------------------------------------------------------------------- */ int XFreeColors( TCL_UNUSED(Display *), Colormap colormap, unsigned long *pixels, int npixels, TCL_UNUSED(unsigned long)) { TkWinColormap *cmap = (TkWinColormap *) colormap; COLORREF cref; UINT count, index; size_t refCount; int i; PALETTEENTRY entry, *entries; Tcl_HashEntry *entryPtr; HDC dc = GetDC(NULL); /* * We don't have to do anything for non-palette devices. */ if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) { /* |
︙ | ︙ | |||
472 473 474 475 476 477 478 | * Allocates an empty palette and color list. * *---------------------------------------------------------------------- */ Colormap XCreateColormap( | | | | | < < < < | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | * Allocates an empty palette and color list. * *---------------------------------------------------------------------- */ Colormap XCreateColormap( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Visual *), TCL_UNUSED(int)) { char logPalBuf[sizeof(LOGPALETTE) + 256 * sizeof(PALETTEENTRY)]; LOGPALETTE *logPalettePtr; PALETTEENTRY *entryPtr; TkWinColormap *cmap; Tcl_HashEntry *hashPtr; int isNew; UINT i; HPALETTE sysPal; /* * Allocate a starting palette with all of the reserved colors. */ logPalettePtr = (LOGPALETTE *) logPalBuf; logPalettePtr->palVersion = 0x300; |
︙ | ︙ | |||
539 540 541 542 543 544 545 | * palette must not be selected into a device context when this occurs. * *---------------------------------------------------------------------- */ int XFreeColormap( | | < | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | * palette must not be selected into a device context when this occurs. * *---------------------------------------------------------------------- */ int XFreeColormap( TCL_UNUSED(Display *), Colormap colormap) { TkWinColormap *cmap = (TkWinColormap *) colormap; if (!DeleteObject(cmap->palette)) { Tcl_Panic("Unable to free colormap, palette is still selected"); } Tcl_DeleteHashTable(&cmap->refCounts); ckfree(cmap); return Success; |
︙ | ︙ |
Changes to win/tkWinConfig.c.
1 2 3 4 5 6 | /* * tkWinConfig.c -- * * This module implements the Windows system defaults for the * configuration package. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* * tkWinConfig.c -- * * This module implements the Windows system defaults for the * configuration package. * * Copyright © 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" /* *---------------------------------------------------------------------- * * Tk_GetSystemDefault -- * * Given a dbName and className for a configuration option, return a * string representation of the option. * * Results: * Returns a Tk_Uid that is the string identifier that identifies this * option. Returns NULL if there are no system defaults that match this * pair. * * Side effects: * None, once the package is initialized. * *---------------------------------------------------------------------- */ Tcl_Obj * Tk_GetSystemDefault( Tk_Window tkwin, /* A window to use. */ const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { Tcl_Obj *valueObjPtr; Tk_Uid classUid; |
︙ | ︙ |
Changes to win/tkWinCursor.c.
1 2 3 4 5 | /* * tkWinCursor.c -- * * This file contains Win32 specific cursor related routines. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkWinCursor.c -- * * This file contains Win32 specific cursor related routines. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ | |||
35 36 37 38 39 40 41 | #endif /* * The table below is used to map from the name of a predefined cursor to its * resource identifier. */ | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #endif /* * The table below is used to map from the name of a predefined cursor to its * resource identifier. */ static const struct CursorName { const char *name; LPCTSTR id; } cursorNames[] = { {"starting", IDC_APPSTARTING}, {"arrow", IDC_ARROW}, {"ibeam", IDC_IBEAM}, {"icon", IDC_ICON}, |
︙ | ︙ | |||
92 93 94 95 96 97 98 | TkCursor * TkGetCursorByName( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry for * details on legal syntax. */ { | | | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | TkCursor * TkGetCursorByName( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry for * details on legal syntax. */ { const struct CursorName *namePtr; TkWinCursor *cursorPtr; TkSizeT argc; const char **argv = NULL; (void)tkwin; /* * All cursor names are valid lists of one element (for * Unix-compatibility), even unadorned system cursor names. */ if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) { return NULL; } if (argc == 0) { goto badCursorSpec; |
︙ | ︙ |
Changes to win/tkWinDefault.h.
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #define DEF_BUTTON_BORDER_WIDTH "2" #define DEF_BUTTON_CURSOR "" #define DEF_BUTTON_COMMAND "" #define DEF_BUTTON_COMPOUND "none" #define DEF_BUTTON_DEFAULT "disabled" #define DEF_BUTTON_DISABLED_FG_COLOR DISABLED #define DEF_BUTTON_DISABLED_FG_MONO "" #define DEF_BUTTON_FG NORMAL_FG #define DEF_CHKRAD_FG TEXT_FG #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT HIGHLIGHT | > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #define DEF_BUTTON_BORDER_WIDTH "2" #define DEF_BUTTON_CURSOR "" #define DEF_BUTTON_COMMAND "" #define DEF_BUTTON_COMPOUND "none" #define DEF_BUTTON_DEFAULT "disabled" #define DEF_BUTTON_DISABLED_FG_COLOR DISABLED #define DEF_BUTTON_DISABLED_FG_MONO "" #define DEF_LABEL_FG NORMAL_FG #define DEF_BUTTON_FG NORMAL_FG #define DEF_CHKRAD_FG TEXT_FG #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT HIGHLIGHT |
︙ | ︙ | |||
87 88 89 90 91 92 93 | #define DEF_BUTTON_SELECT_IMAGE NULL #define DEF_BUTTON_STATE "normal" #define DEF_LABEL_TAKE_FOCUS "0" #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" #define DEF_BUTTON_TRISTATE_VALUE "" | < | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #define DEF_BUTTON_SELECT_IMAGE NULL #define DEF_BUTTON_STATE "normal" #define DEF_LABEL_TAKE_FOCUS "0" #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" #define DEF_BUTTON_TRISTATE_VALUE "" #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" #define DEF_RADIOBUTTON_VARIABLE "selectedButton" #define DEF_CHECKBUTTON_VARIABLE "" /* |
︙ | ︙ | |||
266 267 268 269 270 271 272 | #define DEF_MENU_ENTRY_ON_VALUE "1" #define DEF_MENU_ENTRY_SELECT_IMAGE NULL #define DEF_MENU_ENTRY_STATE "normal" #define DEF_MENU_ENTRY_VALUE NULL #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL | < | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | #define DEF_MENU_ENTRY_ON_VALUE "1" #define DEF_MENU_ENTRY_SELECT_IMAGE NULL #define DEF_MENU_ENTRY_STATE "normal" #define DEF_MENU_ENTRY_VALUE NULL #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL /* * Defaults for menus overall: */ #define DEF_MENU_ACTIVE_BG_COLOR SELECT_BG #define DEF_MENU_ACTIVE_BG_MONO BLACK |
︙ | ︙ | |||
331 332 333 334 335 336 337 | #define DEF_MENUBUTTON_PADX "4p" #define DEF_MENUBUTTON_PADY "3p" #define DEF_MENUBUTTON_RELIEF "flat" #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" | < | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | #define DEF_MENUBUTTON_PADX "4p" #define DEF_MENUBUTTON_PADY "3p" #define DEF_MENUBUTTON_RELIEF "flat" #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" /* * Defaults for messages: */ |
︙ | ︙ |
Changes to win/tkWinDialog.c.
1 2 3 4 5 | /* * tkWinDialog.c -- * * Contains the Windows implementation of the common dialog boxes. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkWinDialog.c -- * * Contains the Windows implementation of the common dialog boxes. * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tkFileFilter.h" |
︙ | ︙ | |||
586 587 588 589 590 591 592 | Tcl_DString *dsPtr, Tcl_Obj *initialPtr, int *indexPtr); static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam); static void SetTkDialog(ClientData clientData); static const char *ConvertExternalFilename(LPCWSTR, Tcl_DString *); | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | Tcl_DString *dsPtr, Tcl_Obj *initialPtr, int *indexPtr); static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam); static void SetTkDialog(ClientData clientData); static const char *ConvertExternalFilename(LPCWSTR, Tcl_DString *); /* *------------------------------------------------------------------------- * * EatSpuriousMessageBugFix -- * * In the file open/save dialog, double clicking on a list item causes * the dialog box to close, but an unwanted WM_LBUTTONUP message is sent |
︙ | ︙ | |||
778 779 780 781 782 783 784 | dwCustColors[i] = RGB(255-i * 10, i, i * 10); } oldColor = RGB(0xa0, 0xa0, 0xa0); inited = 1; } parent = tkwin; | | | | | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | dwCustColors[i] = RGB(255-i * 10, i, i * 10); } oldColor = RGB(0xa0, 0xa0, 0xa0); inited = 1; } parent = tkwin; chooseColor.lStructSize = sizeof(CHOOSECOLORW); chooseColor.hwndOwner = NULL; chooseColor.hInstance = NULL; chooseColor.rgbResult = oldColor; chooseColor.lpCustColors = dwCustColors; chooseColor.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK; chooseColor.lCustData = (LPARAM) NULL; chooseColor.lpfnHook = (LPOFNHOOKPROC)(void *)ColorDlgHookProc; chooseColor.lpTemplateName = (LPWSTR) interp; for (i = 1; i < objc; i += 2) { int index; const char *string; Tcl_Obj *optionPtr, *valuePtr; optionPtr = objv[i]; valuePtr = objv[i + 1]; if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings, "option", TCL_EXACT, &index) != TCL_OK) { return TCL_ERROR; } if (i + 1 == objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", Tcl_GetString(optionPtr))); Tcl_SetErrorCode(interp, "TK", "COLORDIALOG", "VALUE", NULL); return TCL_ERROR; |
︙ | ︙ | |||
904 905 906 907 908 909 910 | UINT uMsg, /* Type of message. */ WPARAM wParam, /* First message parameter. */ LPARAM lParam) /* Second message parameter. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *title; | | | | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 | UINT uMsg, /* Type of message. */ WPARAM wParam, /* First message parameter. */ LPARAM lParam) /* Second message parameter. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *title; CHOOSECOLORW *ccPtr; (void)wParam; if (WM_INITDIALOG == uMsg) { /* * Set the title string of the dialog. */ ccPtr = (CHOOSECOLORW *) lParam; title = (const char *) ccPtr->lCustData; if ((title != NULL) && (title[0] != '\0')) { Tcl_DString ds; Tcl_DStringInit(&ds); SetWindowTextW(hDlg, Tcl_UtfToWCharDString(title, -1, &ds)); |
︙ | ︙ | |||
1067 1068 1069 1070 1071 1072 1073 | {"-parent", FILE_PARENT}, {"-title", FILE_TITLE}, {"-typevariable", FILE_TYPEVARIABLE}, {NULL, FILE_DEFAULT/*ignored*/ } }; static const struct Options dirOptions[] = { {"-initialdir", FILE_INITDIR}, | | | | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | {"-parent", FILE_PARENT}, {"-title", FILE_TITLE}, {"-typevariable", FILE_TYPEVARIABLE}, {NULL, FILE_DEFAULT/*ignored*/ } }; static const struct Options dirOptions[] = { {"-initialdir", FILE_INITDIR}, {"-mustexist", FILE_MUSTEXIST}, {"-parent", FILE_PARENT}, {"-title", FILE_TITLE}, {NULL, FILE_DEFAULT/*ignored*/ } }; const struct Options *options = NULL; switch (oper) { case OFN_FILE_SAVE: options = saveOptions; break; case OFN_DIR_CHOOSE: options = dirOptions; break; case OFN_FILE_OPEN: options = openOptions; break; } ZeroMemory(optsPtr, sizeof(*optsPtr)); /* 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; for (i = 1; i < objc; i += 2) { int index; |
︙ | ︙ | |||
1207 1208 1209 1210 1211 1212 1213 | { HRESULT hr; IFileDialog *fdlgPtr = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->newFileDialogsState == FDLG_STATE_INIT) { | | < < | | | | | | | | | | < | | | | | | | < | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | { HRESULT hr; IFileDialog *fdlgPtr = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->newFileDialogsState == FDLG_STATE_INIT) { tsdPtr->newFileDialogsState = FDLG_STATE_USE_OLD; hr = CoInitialize(0); /* XXX - need we schedule CoUninitialize at thread shutdown ? */ /* Ensure all COM interfaces we use are available */ if (SUCCEEDED(hr)) { hr = CoCreateInstance(&ClsidFileOpenDialog, NULL, CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgPtr); if (SUCCEEDED(hr)) { fdlgPtr->lpVtbl->Release(fdlgPtr); hr = CoCreateInstance(&ClsidFileSaveDialog, NULL, CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog, (void **) &fdlgPtr); if (SUCCEEDED(hr)) { fdlgPtr->lpVtbl->Release(fdlgPtr); /* Looks like we have all we need */ tsdPtr->newFileDialogsState = FDLG_STATE_USE_NEW; } } } } return (tsdPtr->newFileDialogsState == FDLG_STATE_USE_NEW); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1409 1410 1411 1412 1413 1414 1415 | normPath = Tcl_FSGetNormalizedPath(interp, iniDirPath); /* XXX - Note on failures do not raise error, simply ignore ini dir */ if (normPath) { LPCWSTR nativePath; Tcl_IncrRefCount(normPath); nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/ if (nativePath) { | | | 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | normPath = Tcl_FSGetNormalizedPath(interp, iniDirPath); /* XXX - Note on failures do not raise error, simply ignore ini dir */ if (normPath) { LPCWSTR nativePath; Tcl_IncrRefCount(normPath); nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/ if (nativePath) { hr = SHCreateItemFromParsingName( nativePath, NULL, &IIDIShellItem, (void **) &dirIf); if (SUCCEEDED(hr)) { /* Note we use SetFolder, not SetDefaultFolder - see MSDN */ fdlgIf->lpVtbl->SetFolder(fdlgIf, dirIf); /* Ignore errors */ } } |
︙ | ︙ | |||
1896 1897 1898 1899 1900 1901 1902 | /* *------------------------------------------------------------------------- * * OFNHookProc -- * | | | 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 | /* *------------------------------------------------------------------------- * * OFNHookProc -- * * Dialog box hook function. This is used to set the "tk_dialog" * variable for test/debugging when the dialog is ready to receive * messages. When multiple file selection is enabled this function * is used to process the list of names. * * Results: * Returns 0 to allow default processing of messages to occur. * |
︙ | ︙ | |||
2117 2118 2119 2120 2121 2122 2123 | } else { TkSizeT len; if (valuePtr == NULL) { len = 0; } else { | | | 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 | } else { TkSizeT len; if (valuePtr == NULL) { len = 0; } else { (void) Tcl_GetStringFromObj(valuePtr, &len); } /* * We format the filetype into a string understood by Windows: {"Text * Documents" {.doc .txt} {TEXT}} becomes "Text Documents * (*.doc,*.txt)\0*.doc;*.txt\0" * |
︙ | ︙ | |||
2707 2708 2709 2710 2711 2712 2713 | * -enablenonfolders can be used to allow non folders to be selected. * * Not called when user changes edit box directly. */ if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) { SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir); | | | | 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 | * -enablenonfolders can be used to allow non folders to be selected. * * Not called when user changes edit box directly. */ if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) { SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir); /* enable the OK button */ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); } else { /* disable the OK button */ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); } UpdateWindow(hwnd); return 1; case BFFM_INITIALIZED: { /* |
︙ | ︙ | |||
2775 2776 2777 2778 2779 2780 2781 | * This function implements the MessageBox window for the Windows * platform. See the user documentation for details on what it does. * * Results: * See user documentation. * * Side effects: | | | 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 | * This function implements the MessageBox window for the Windows * platform. See the user documentation for details on what it does. * * Results: * See user documentation. * * Side effects: * None. The MessageBox window will be destroyed before this function * returns. * *---------------------------------------------------------------------- */ int Tk_MessageBoxObjCmd( |
︙ | ︙ | |||
2823 2824 2825 2826 2827 2828 2829 | for (i = 1; i < objc; i += 2) { int index; Tcl_Obj *optionPtr, *valuePtr; optionPtr = objv[i]; valuePtr = objv[i + 1]; | | | | 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 | for (i = 1; i < objc; i += 2) { int index; Tcl_Obj *optionPtr, *valuePtr; optionPtr = objv[i]; valuePtr = objv[i + 1]; if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings, "option", TCL_EXACT, &index) != TCL_OK) { return TCL_ERROR; } if (i + 1 == objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", Tcl_GetString(optionPtr))); Tcl_SetErrorCode(interp, "TK", "MSGBOX", "VALUE", NULL); return TCL_ERROR; |
︙ | ︙ | |||
3147 3148 3149 3150 3151 3152 3153 | static UINT_PTR CALLBACK HookProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { | | | 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 | static UINT_PTR CALLBACK HookProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { CHOOSEFONTW *pcf = (CHOOSEFONTW *) lParam; HWND hwndCtrl; static HookData *phd = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (WM_INITDIALOG == msg && lParam != 0) { phd = (HookData *) pcf->lCustData; |
︙ | ︙ | |||
3220 3221 3222 3223 3224 3225 3226 | /* * Helper for the FontchooserConfigure command to return the current value of * any of the options (which may be NULL in the structure) */ enum FontchooserOption { | | | 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 | /* * Helper for the FontchooserConfigure command to return the current value of * any of the options (which may be NULL in the structure) */ enum FontchooserOption { FontchooserCmd, FontchooserFont, FontchooserParent, FontchooserTitle, FontchooserVisible }; static Tcl_Obj * FontchooserCget( HookData *hdPtr, int optionIndex) |
︙ | ︙ | |||
3297 3298 3299 3300 3301 3302 3303 | int objc, Tcl_Obj *const objv[]) { Tk_Window tkwin = (Tk_Window)clientData; HookData *hdPtr = NULL; int i, r = TCL_OK; static const char *const optionStrings[] = { | | | 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 | int objc, Tcl_Obj *const objv[]) { Tk_Window tkwin = (Tk_Window)clientData; HookData *hdPtr = NULL; int i, r = TCL_OK; static const char *const optionStrings[] = { "-command", "-font", "-parent", "-title", "-visible", NULL }; hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); /* * With no arguments we return all the options in a dict. */ |
︙ | ︙ | |||
3324 3325 3326 3327 3328 3329 3330 | } return r; } for (i = 1; i < objc; i += 2) { int optionIndex; | | | | 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 | } return r; } for (i = 1; i < objc; i += 2) { int optionIndex; if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0, &optionIndex) != TCL_OK) { return TCL_ERROR; } if (objc == 2) { /* * If one option and no arg - return the current value. */ |
︙ | ︙ | |||
3459 3460 3461 3462 3463 3464 3465 | if (parent == NULL) { return TCL_ERROR; } } Tk_MakeWindowExist(parent); | | | | | 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 | if (parent == NULL) { return TCL_ERROR; } } Tk_MakeWindowExist(parent); ZeroMemory(&cf, sizeof(CHOOSEFONTW)); ZeroMemory(&lf, sizeof(LOGFONTW)); lf.lfCharSet = DEFAULT_CHARSET; cf.lStructSize = sizeof(CHOOSEFONTW); cf.hwndOwner = Tk_GetHWND(Tk_WindowId(parent)); cf.lpLogFont = &lf; cf.nFontType = SCREEN_FONTTYPE; cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_ENABLEHOOK; cf.rgbColors = RGB(0,0,0); cf.lpfnHook = HookProc; cf.lCustData = (INT_PTR) hdPtr; |
︙ | ︙ |
Changes to win/tkWinDraw.c.
1 2 3 4 5 6 | /* * tkWinDraw.c -- * * This file contains the Xlib emulation functions pertaining to actually * drawing objects on a window. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkWinDraw.c -- * * This file contains the Xlib emulation functions pertaining to actually * drawing objects on a window. * * Copyright © 1995 Sun Microsystems, Inc. * Copyright © 1994 Software Research Associates, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ | |||
582 583 584 585 586 587 588 | infoPtr->bmiHeader.biClrUsed = 0; } bitmap = CreateDIBitmap(dc, &infoPtr->bmiHeader, CBM_INIT, image->data, infoPtr, DIB_RGB_COLORS); ckfree(infoPtr); } if (!bitmap) { | < | | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | infoPtr->bmiHeader.biClrUsed = 0; } bitmap = CreateDIBitmap(dc, &infoPtr->bmiHeader, CBM_INIT, image->data, infoPtr, DIB_RGB_COLORS); ckfree(infoPtr); } if (!bitmap) { DeleteDC(dcMem); TkWinReleaseDrawableDC(d, dc, &state); return BadValue; } bitmap = (HBITMAP)SelectObject(dcMem, bitmap); BitBlt(dc, dest_x, dest_y, (int) width, (int) height, dcMem, src_x, src_y, SRCCOPY); DeleteObject(SelectObject(dcMem, bitmap)); DeleteDC(dcMem); |
︙ | ︙ | |||
1454 1455 1456 1457 1458 1459 1460 | ExtTextOutW(dc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); SetBkColor(dc, oldColor); } /* *---------------------------------------------------------------------- * | | | | 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 | ExtTextOutW(dc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); SetBkColor(dc, oldColor); } /* *---------------------------------------------------------------------- * * Tk_DrawHighlightBorder -- * * This function draws a rectangular ring around the outside of a widget * to indicate that it has received the input focus. * * On Windows, we just draw the simple inset ring. On other sytems, e.g. * the Mac, the focus ring is a little more complicated, so we need this * abstraction. * * Results: * None. * * Side effects: * A rectangle "width" pixels wide is drawn in "drawable", corresponding * to the outer area of "tkwin". * *---------------------------------------------------------------------- */ void Tk_DrawHighlightBorder( Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable) { (void)bgGC; |
︙ | ︙ |
Changes to win/tkWinEmbed.c.
1 2 3 4 5 6 7 8 | /* * tkWinEmbed.c -- * * This file contains platform specific procedures for Windows platforms * to provide basic operations needed for application embedding (where * one application can use as its main window an internal window from * another application). * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkWinEmbed.c -- * * This file contains platform specific procedures for Windows platforms * to provide basic operations needed for application embedding (where * one application can use as its main window an internal window from * another application). * * Copyright © 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ | |||
179 180 181 182 183 184 185 | } Tcl_Release(winPtr); } /* *---------------------------------------------------------------------- * | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | } Tcl_Release(winPtr); } /* *---------------------------------------------------------------------- * * Tk_UseWindow -- * * This procedure causes a Tk window to use a given Windows handle for a * window as its underlying window, rather than a new Windows window * being created automatically. It is invoked by an embedded application * to specify the window in which the application is embedded. * * This procedure uses a simple attachment protocol by sending TK_INFO |
︙ | ︙ | |||
225 226 227 228 229 230 231 | * Side effects: * None. * *---------------------------------------------------------------------- */ int | | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | * Side effects: * None. * *---------------------------------------------------------------------- */ int Tk_UseWindow( Tcl_Interp *interp, /* If not NULL, used for error reporting if * string is bogus. */ Tk_Window tkwin, /* Tk window that does not yet have an * associated X window. */ const char *string) /* String identifying an X window to use for * tkwin; must be an integer value. */ { |
︙ | ︙ | |||
340 341 342 343 344 345 346 | return TCL_OK; } /* *---------------------------------------------------------------------- * | | | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | return TCL_OK; } /* *---------------------------------------------------------------------- * * Tk_MakeContainer -- * * This procedure is called to indicate that a particular window will be * a container for an embedded application. This changes certain aspects * of the window's behavior, such as whether it will receive events * anymore. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void Tk_MakeContainer( Tk_Window tkwin) { TkWindow *winPtr = (TkWindow *) tkwin; Container *containerPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
885 886 887 888 889 890 891 | EmbedWindowDeleted(containerPtr->parentPtr); } } /* *---------------------------------------------------------------------- * | | | | | | | | | | | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | EmbedWindowDeleted(containerPtr->parentPtr); } } /* *---------------------------------------------------------------------- * * Tk_GetOtherWindow -- * * If both the container and embedded window are in the same process, * this procedure will return either one, given the other. * * Results: * If tkwin is a container, the return value is the token for the * embedded window, and vice versa. If the "other" window isn't in this * process, NULL is returned. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tk_Window Tk_GetOtherWindow( Tk_Window tkwin) /* Tk's structure for a container or embedded * window. */ { Container *containerPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { if ((Tk_Window)containerPtr->embeddedPtr == tkwin) { return (Tk_Window)containerPtr->parentPtr; } else if ((Tk_Window)containerPtr->parentPtr == tkwin) { return (Tk_Window)containerPtr->embeddedPtr; } } return NULL; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 | * Find the Container structure for this window work. Delete the * information about the embedded application and free the container's * record. The main container may be null. [Bug #476176] */ prevPtr = NULL; containerPtr = tsdPtr->firstContainerPtr; | < > | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | * Find the Container structure for this window work. Delete the * information about the embedded application and free the container's * record. The main container may be null. [Bug #476176] */ prevPtr = NULL; containerPtr = tsdPtr->firstContainerPtr; while (1) { if (containerPtr == NULL) return; if (containerPtr->embeddedPtr == winPtr) { containerPtr->embeddedHWnd = NULL; containerPtr->embeddedPtr = NULL; break; } if (containerPtr->parentPtr == winPtr) { SendMessageW(containerPtr->embeddedHWnd, WM_CLOSE, 0, 0); |
︙ | ︙ |
Changes to win/tkWinFont.c.
1 2 3 4 5 6 | /* * tkWinFont.c -- * * Contains the Windows implementation of the platform-independent font * package interface. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkWinFont.c -- * * Contains the Windows implementation of the platform-independent font * package interface. * * Copyright © 1994 Software Research Associates, Inc. * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tkFont.h" |
︙ | ︙ | |||
845 846 847 848 849 850 851 | start = source; end = start + numBytes; for (p = start; p < end; ) { next = p + TkUtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; | | | | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | start = source; end = start + numBytes; for (p = start; p < end; ) { next = p + TkUtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, start, p - start, TCL_ENCODING_NOCOMPLAIN, &runString); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); Tcl_DStringFree(&runString); if (maxLength >= 0 && (curX+size.cx) > maxLength) { |
︙ | ︙ | |||
873 874 875 876 877 878 879 | if (!moretomeasure) { /* * We get here if the previous loop was just finished normally, * without a break. Just measure the last run and that's it. */ familyPtr = lastSubFontPtr->familyPtr; | | | | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | if (!moretomeasure) { /* * We get here if the previous loop was just finished normally, * without a break. Just measure the last run and that's it. */ familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, start, p - start, TCL_ENCODING_NOCOMPLAIN, &runString); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *) Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); Tcl_DStringFree(&runString); if (maxLength >= 0 && (curX+size.cx) > maxLength) { moretomeasure = 1; |
︙ | ︙ | |||
1489 1490 1491 1492 1493 1494 1495 | * instead we limit to drawing chunks of 200 bytes since that works * well in practice. */ if ((thisSubFontPtr != lastSubFontPtr) || (p-source > 200)) { if (p > source) { familyPtr = lastSubFontPtr->familyPtr; | | | | | | | | 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 | * instead we limit to drawing chunks of 200 bytes since that works * well in practice. */ if ((thisSubFontPtr != lastSubFontPtr) || (p-source > 200)) { if (p > source) { familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, source, p - source, TCL_ENCODING_NOCOMPLAIN, &runString); familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); x += cosA*size.cx; y -= sinA*size.cx; Tcl_DStringFree(&runString); } lastSubFontPtr = thisSubFontPtr; source = p; SelectFont(hdc, fontPtr, lastSubFontPtr, angle); GetTextMetricsW(hdc, &tm); } p = next; } if (p > source) { familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDStringEx(familyPtr->encoding, source, p - source, TCL_ENCODING_NOCOMPLAIN, &runString); familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); Tcl_DStringFree(&runString); } SelectObject(hdc, oldFont); } |
︙ | ︙ | |||
2728 2729 2730 2731 2732 2733 2734 | HFONT hFont, /* HFONT to query. */ USHORT **startCountPtr, /* Filled with malloced pointer to character * range information. */ USHORT **endCountPtr, /* Filled with malloced pointer to character * range information. */ int *symbolPtr) { | | | 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 | HFONT hFont, /* HFONT to query. */ USHORT **startCountPtr, /* Filled with malloced pointer to character * range information. */ USHORT **endCountPtr, /* Filled with malloced pointer to character * range information. */ int *symbolPtr) { int n, i, j, k, swapped, offset, cbData, segCount; DWORD cmapKey; USHORT *startCount, *endCount; CMAPTABLE cmapTable; ENCODINGTABLE encTable; SUBTABLE subTable; char *s; |
︙ | ︙ | |||
2804 2805 2806 2807 2808 2809 2810 | endCount = (USHORT *)ckalloc(cbData); offset = encTable.offset + sizeof(subTable.segment); GetFontData(hdc, cmapKey, (DWORD) offset, endCount, cbData); offset += cbData + sizeof(USHORT); GetFontData(hdc, cmapKey, (DWORD) offset, startCount, cbData); if (swapped) { | | | | | | | | | | 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 | endCount = (USHORT *)ckalloc(cbData); offset = encTable.offset + sizeof(subTable.segment); GetFontData(hdc, cmapKey, (DWORD) offset, endCount, cbData); offset += cbData + sizeof(USHORT); GetFontData(hdc, cmapKey, (DWORD) offset, startCount, cbData); if (swapped) { for (j = 0; j < segCount; j++) { SwapShort(&endCount[j]); SwapShort(&startCount[j]); } } if (*symbolPtr != 0) { /* * Empirically determined: When a symbol font is loaded, * the character existence metrics obtained from the * system are mildly wrong. If the real range of the * symbol font is from 0020 to 00FE, then the metrics are * reported as F020 to F0FE. When we load a symbol font, * we must fix the character existence metrics. * * Symbol fonts should only use the symbol encoding for * 8-bit characters [note Bug: 2406] */ for (k = 0; k < segCount; k++) { if (((startCount[k] & 0xff00) == 0xf000) && ((endCount[k] & 0xff00) == 0xf000)) { startCount[k] &= 0xff; endCount[k] &= 0xff; } } } } } } else if (GetTextCharset(hdc) == ANSI_CHARSET) { /* |
︙ | ︙ |
Added win/tkWinGDI.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 | /* * tkWinGDI.c -- * * This module implements access to the Win32 GDI API. * * Copyright © 1991-2018 Microsoft Corp. * Copyright © 2009, Michael I. Schwartz. * Copyright © 1998-2019 Harald Oehlmann, Elmicron GmbH * Copyright © 2021 Kevin Walzer/WordTech Communications LLC. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <windows.h> #include <stdlib.h> #include <math.h> #include <wtypes.h> #include <winspool.h> #include <commdlg.h> #include <wingdi.h> #include <tcl.h> #include "tkWinInt.h" /* * Create a standard "DrawFunc" to make this more workable.... */ #ifdef _MSC_VER typedef BOOL (WINAPI *DrawFunc) ( HDC, int, int, int, int, int, int, int, int); /* Arc, Chord, Pie. */ #else typedef BOOL WINAPI (*DrawFunc) ( HDC, int, int, int, int, int, int, int, int); /* Arc, Chord, Pie. */ #endif /* Real functions. */ static int GdiArc(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiBitmap(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiCharWidths(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiImage(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiPhoto(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiLine(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiOval(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiPolygon(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiRectangle(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiText(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiMap(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int GdiCopyBits(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); /* Local copies of similar routines elsewhere in Tcl/Tk. */ static int GdiGetColor(const char *name, COLORREF *color); /* * Helper functions. */ static int GdiMakeLogFont(Tcl_Interp *interp, const char *str, LOGFONTW *lf, HDC hDC); static int GdiMakePen(Tcl_Interp *interp, int width, int dashstyle, const char *dashstyledata, int capstyle, int joinstyle, int stipplestyle, const char *stippledata, unsigned long color, HDC hDC, HGDIOBJ *oldPen); static int GdiFreePen(Tcl_Interp *interp, HDC hDC, HGDIOBJ oldPen); static int GdiMakeBrush(Tcl_Interp *interp, unsigned int style, unsigned long color, long hatch, LOGBRUSH *lb, HDC hDC, HGDIOBJ *oldBrush); static int GdiFreeBrush(Tcl_Interp *interp, HDC hDC, HGDIOBJ oldBcrush); static int GdiGetHdcInfo(HDC hdc, LPPOINT worigin, LPSIZE wextent, LPPOINT vorigin, LPSIZE vextent); /* Helper functions for printing the window client area. */ enum PrintType { PTWindow = 0, PTClient = 1, PTScreen = 2 }; static HANDLE CopyToDIB(HWND wnd, enum PrintType type); static HBITMAP CopyScreenToBitmap(LPRECT lpRect); static HANDLE BitmapToDIB(HBITMAP hb, HPALETTE hp); static HANDLE CopyScreenToDIB(LPRECT lpRect); static int DIBNumColors(LPBITMAPINFOHEADER lpDIB); static int PalEntriesOnDevice(HDC hDC); static HPALETTE GetSystemPalette(void); static void GetDisplaySize(LONG *width, LONG *height); static int GdiWordToWeight(const char *str); static int GdiParseFontWords(Tcl_Interp *interp, LOGFONTW *lf, const char *str[], int numargs); static int PrintSelectPrinter(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int PrintOpenPrinter(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int PrintClosePrinter(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int PrintOpenDoc(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int PrintCloseDoc(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int PrintOpenPage(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int PrintClosePage(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* * Global state. */ static PRINTDLGW pd; static DOCINFOW di; static WCHAR *localPrinterName = NULL; static int copies, paper_width, paper_height, dpi_x, dpi_y; static LPDEVNAMES devnames; static HDC printDC; /* * To make the "subcommands" follow a standard convention, add them to this * array. The first element is the subcommand name, and the second a standard * Tcl command handler. */ static const struct gdi_command { const char *command_string; Tcl_CmdProc *command; } gdi_commands[] = { { "arc", GdiArc }, { "bitmap", GdiBitmap }, { "characters", GdiCharWidths }, { "image", GdiImage }, { "line", GdiLine }, { "map", GdiMap }, { "oval", GdiOval }, { "photo", GdiPhoto }, { "polygon", GdiPolygon }, { "rectangle", GdiRectangle }, { "text", GdiText }, { "copybits", GdiCopyBits }, }; /* *---------------------------------------------------------------------- * * GdiArc -- * * Map canvas arcs to GDI context. * * Results: * Renders arcs. * *---------------------------------------------------------------------- */ static int GdiArc( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi arc hdc x1 y1 x2 y2 " "-extent angle -start angle -style arcstyle " "-fill color -outline color " "-width dimension -dash dashrule " "-outlinestipple ignored -stipple ignored\n" ; int x1, y1, x2, y2; int xr0, yr0, xr1, yr1; HDC hDC; double extent = 0.0, start = 0.0; DrawFunc drawfunc; int width = 0; HPEN hPen; COLORREF linecolor = 0, fillcolor = BS_NULL; int dolinecolor = 0, dofillcolor = 0; HBRUSH hBrush; LOGBRUSH lbrush; HGDIOBJ oldobj; int dodash = 0; const char *dashdata = 0; drawfunc = Pie; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } hDC = printDC; x1 = atoi(argv[2]); y1 = atoi(argv[3]); x2 = atoi(argv[4]); y2 = atoi(argv[5]); argc -= 6; argv += 6; while (argc >= 2) { if (strcmp(argv[0], "-extent") == 0) { extent = atof(argv[1]); } else if (strcmp(argv[0], "-start") == 0) { start = atof(argv[1]); } else if (strcmp(argv[0], "-style") == 0) { if (strcmp(argv[1], "pieslice") == 0) { drawfunc = Pie; } else if (strcmp(argv[1], "arc") == 0) { drawfunc = Arc; } else if (strcmp(argv[1], "chord") == 0) { drawfunc = Chord; } } else if (strcmp(argv[0], "-fill") == 0) { /* Handle all args, even if we don't use them yet. */ if (GdiGetColor(argv[1], &fillcolor)) { dofillcolor = 1; } } else if (strcmp(argv[0], "-outline") == 0) { if (GdiGetColor(argv[1], &linecolor)) { dolinecolor = 1; } } else if (strcmp(argv[0], "-outlinestipple") == 0) { /* ignored */ } else if (strcmp(argv[0], "-stipple") == 0) { /* ignored */ } else if (strcmp(argv[0], "-width") == 0) { width = atoi(argv[1]); } else if (strcmp(argv[0], "-dash") == 0) { if (argv[1]) { dodash = 1; dashdata = argv[1]; } } else { /* Don't know that option! */ Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } argc -= 2; argv += 2; } xr0 = xr1 = (x1 + x2) / 2; yr0 = yr1 = (y1 + y2) / 2; /* * The angle used by the arc must be "warped" by the eccentricity of the * ellipse. Thanks to Nigel Dodd <[email protected]> for bringing a * nice example. */ xr0 += (int)(100.0 * (x2 - x1) * cos((start * 2.0 * 3.14159265) / 360.0)); yr0 -= (int)(100.0 * (y2 - y1) * sin((start * 2.0 * 3.14159265) / 360.0)); xr1 += (int)(100.0 * (x2 - x1) * cos(((start+extent) * 2.0 * 3.14159265) / 360.0)); yr1 -= (int)(100.0 * (y2 - y1) * sin(((start+extent) * 2.0 * 3.14159265) / 360.0)); /* * Under Win95, SetArcDirection isn't implemented--so we have to assume * that arcs are drawn counterclockwise (e.g., positive extent) So if it's * negative, switch the coordinates! */ if (extent < 0) { int xr2 = xr0; int yr2 = yr0; xr0 = xr1; xr1 = xr2; yr0 = yr1; yr1 = yr2; } if (dofillcolor) { GdiMakeBrush(interp, 0, fillcolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush); } else { oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH)); } if (width || dolinecolor) { GdiMakePen(interp, width, dodash, dashdata, 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen); } (*drawfunc)(hDC, x1, y1, x2, y2, xr0, yr0, xr1, yr1); if (width || dolinecolor) { GdiFreePen(interp, hDC, hPen); } if (dofillcolor) { GdiFreeBrush(interp, hDC, hBrush); } else { SelectObject(hDC, oldobj); } return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiBitmap -- * * Unimplemented for now. Should use the same techniques as * CanvasPsBitmap (tkCanvPs.c). * * Results: * None. * *---------------------------------------------------------------------- */ static int GdiBitmap( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(const char **)) { static const char usage_message[] = "::tk::print::_gdi bitmap hdc x y " "-anchor [center|n|e|s|w] -background color " "-bitmap bitmap -foreground color\n" "Not implemented yet. Sorry!"; /* * Skip this for now. Should be based on common code with the copybits * command. */ Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * GdiImage -- * * Unimplemented for now. Unimplemented for now. Should switch on image * type and call either GdiPhoto or GdiBitmap. This code is similar to * that in tkWinImage.c. * * Results: * None. * *---------------------------------------------------------------------- */ static int GdiImage( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(const char **)) { static const char usage_message[] = "::tk::print::_gdi image hdc x y -anchor [center|n|e|s|w] -image name\n" "Not implemented yet. Sorry!"; /* Skip this for now..... */ /* Should be based on common code with the copybits command. */ Tcl_AppendResult(interp, usage_message, NULL); /* Normally, usage results in TCL_ERROR--but wait til' it's implemented. */ return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiPhoto -- * * Contributed by Lukas Rosenthaler <[email protected]> * * Note: The canvas doesn't directly support photos (only as images), so * this is the first ::tk::print::_gdi command without an equivalent * canvas command. This code may be modified to support photo images on * the canvas. * * Results: * Renders a photo. * *---------------------------------------------------------------------- */ static int GdiPhoto( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi photo hdc [-destination x y [w [h]]] -photo name\n"; HDC dst; int dst_x = 0, dst_y = 0, dst_w = 0, dst_h = 0; int nx, ny, sll; const char *photoname = 0; /* For some reason Tk_FindPhoto takes a char *. */ Tk_PhotoHandle photo_handle; Tk_PhotoImageBlock img_block; BITMAPINFO bitmapinfo; /* Since we don't need the bmiColors table, * there is no need for dynamic allocation. */ int oldmode; /* For saving the old stretch mode. */ POINT pt; /* For saving the brush org. */ char *pbuf = NULL; int i, j, k; int retval = TCL_OK; /* * Parse the arguments. */ /* HDC is required. */ if (argc < 2) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } dst = printDC; /* * Next, check to see if 'dst' can support BitBlt. * If not, raise an error. */ if ((GetDeviceCaps(dst, RASTERCAPS) & RC_STRETCHDIB) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "::tk::print::_gdi photo not supported on device context (0x%s)", argv[1])); return TCL_ERROR; } /* Parse the command line arguments. */ for (j = 2; j < argc; j++) { if (strcmp(argv[j], "-destination") == 0) { double x, y, w, h; int count = 0; char dummy; if (j < argc) { count = sscanf(argv[++j], "%lf%lf%lf%lf%c", &x, &y, &w, &h, &dummy); } if (count < 2 || count > 4) { /* Destination must provide at least 2 arguments. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "-destination requires a list of 2 to 4 numbers\n%s", usage_message)); return TCL_ERROR; } dst_x = (int) x; dst_y = (int) y; if (count == 3) { dst_w = (int) w; dst_h = -1; } else if (count == 4) { dst_w = (int) w; dst_h = (int) h; } } else if (strcmp(argv[j], "-photo") == 0) { photoname = argv[++j]; } } if (photoname == 0) { /* No photo provided. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "No photo name provided to ::tk::print::_gdi photo\n%s", usage_message)); return TCL_ERROR; } photo_handle = Tk_FindPhoto(interp, photoname); if (photo_handle == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "::tk::print::_gdi photo: Photo name %s can't be located\n%s", photoname, usage_message)); return TCL_ERROR; } Tk_PhotoGetImage(photo_handle, &img_block); nx = img_block.width; ny = img_block.height; sll = ((3*nx + 3) / 4)*4; /* Must be multiple of 4. */ /* * Buffer is potentially large enough that failure to allocate might be * recoverable. */ pbuf = (char *) Tcl_AttemptAlloc(sll * ny * sizeof(char)); if (pbuf == 0) { /* Memory allocation failure. */ Tcl_AppendResult(interp, "::tk::print::_gdi photo failed--out of memory", NULL); return TCL_ERROR; } /* After this, all returns must go through retval. */ /* BITMAP expects BGR; photo provides RGB. */ for (k = 0; k < ny; k++) { for (i = 0; i < nx; i++) { pbuf[k*sll + 3*i] = img_block.pixelPtr[ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[2]]; pbuf[k*sll + 3*i + 1] = img_block.pixelPtr[ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[1]]; pbuf[k*sll + 3*i + 2] = img_block.pixelPtr[ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[0]]; } } memset(&bitmapinfo, 0L, sizeof(BITMAPINFO)); bitmapinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bitmapinfo.bmiHeader.biWidth = nx; bitmapinfo.bmiHeader.biHeight = -ny; bitmapinfo.bmiHeader.biPlanes = 1; bitmapinfo.bmiHeader.biBitCount = 24; bitmapinfo.bmiHeader.biCompression = BI_RGB; bitmapinfo.bmiHeader.biSizeImage = 0; /* sll*ny;. */ bitmapinfo.bmiHeader.biXPelsPerMeter = 0; bitmapinfo.bmiHeader.biYPelsPerMeter = 0; bitmapinfo.bmiHeader.biClrUsed = 0; bitmapinfo.bmiHeader.biClrImportant = 0; oldmode = SetStretchBltMode(dst, HALFTONE); /* * According to the Win32 Programmer's Manual, we have to set the brush * org, now. */ SetBrushOrgEx(dst, 0, 0, &pt); if (dst_w <= 0) { dst_w = nx; dst_h = ny; } else if (dst_h <= 0) { dst_h = ny*dst_w / nx; } if (StretchDIBits(dst, dst_x, dst_y, dst_w, dst_h, 0, 0, nx, ny, pbuf, &bitmapinfo, DIB_RGB_COLORS, SRCCOPY) == (int)GDI_ERROR) { int errcode = GetLastError(); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "::tk::print::_gdi photo internal failure: " "StretchDIBits error code %d", errcode)); retval = TCL_ERROR; } /* Clean up the hDC. */ if (oldmode != 0) { SetStretchBltMode(dst, oldmode); SetBrushOrgEx(dst, pt.x, pt.y, &pt); } Tcl_Free(pbuf); if (retval == TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%d %d %d %d", dst_x, dst_y, dst_w, dst_h)); } return retval; } /* *---------------------------------------------------------------------- * * Bezierize -- * * Interface to Tk's line smoother, used for lines and pollies. * Provided by Jasper Taylor <[email protected]>. * * Results: * Smooths lines. * *---------------------------------------------------------------------- */ int Bezierize( POINT* polypoints, int npoly, int nStep, POINT* bpointptr) { /* First, translate my points into a list of doubles. */ double *inPointList, *outPointList; int n; int nbpoints = 0; POINT* bpoints; inPointList = (double *) Tcl_AttemptAlloc(2 * sizeof(double) * npoly); if (inPointList == 0) { /* TODO: unreachable */ return nbpoints; /* 0. */ } for (n=0; n<npoly; n++) { inPointList[2*n] = polypoints[n].x; inPointList[2*n + 1] = polypoints[n].y; } nbpoints = 1 + npoly * nStep; /* this is the upper limit. */ outPointList = (double *) Tcl_AttemptAlloc(2 * sizeof(double) * nbpoints); if (outPointList == 0) { /* TODO: unreachable */ Tcl_Free((void *) inPointList); return 0; } nbpoints = TkMakeBezierCurve(NULL, inPointList, npoly, nStep, NULL, outPointList); Tcl_Free((void *) inPointList); bpoints = (POINT *) Tcl_AttemptAlloc(sizeof(POINT)*nbpoints); if (bpoints == 0) { /* TODO: unreachable */ Tcl_Free((void *) outPointList); return 0; } for (n=0; n<nbpoints; n++) { bpoints[n].x = (long) outPointList[2*n]; bpoints[n].y = (long) outPointList[2*n + 1]; } Tcl_Free((void *) outPointList); *bpointptr = *bpoints; return nbpoints; } /* *---------------------------------------------------------------------- * * GdiLine -- * * Maps lines to GDI context. * * Results: * Renders lines. * *---------------------------------------------------------------------- */ static int GdiLine( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi line hdc x1 y1 ... xn yn " "-arrow [first|last|both|none] -arrowshape {d1 d2 d3} " "-dash dashlist " "-capstyle [butt|projecting|round] -fill color " "-joinstyle [bevel|miter|round] -smooth [true|false|bezier] " "-splinesteps number -stipple bitmap -width linewid"; char *strend; POINT *polypoints; int npoly; int x, y; HDC hDC; HPEN hPen; LOGBRUSH lbrush; HBRUSH hBrush; int width = 0; COLORREF linecolor = 0; int dolinecolor = 0; int dosmooth = 0; int doarrow = 0; /* 0=none; 1=end; 2=start; 3=both. */ int arrowshape[3]; int nStep = 12; int dodash = 0; const char *dashdata = 0; arrowshape[0] = 8; arrowshape[1] = 10; arrowshape[2] = 3; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } hDC = printDC; polypoints = (POINT *) Tcl_AttemptAlloc((argc - 1) * sizeof(POINT)); if (polypoints == 0) { Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL); return TCL_ERROR; } polypoints[0].x = atol(argv[2]); polypoints[0].y = atol(argv[3]); polypoints[1].x = atol(argv[4]); polypoints[1].y = atol(argv[5]); argc -= 6; argv += 6; npoly = 2; while (argc >= 2) { /* Check for a number. */ x = strtoul(argv[0], &strend, 0); if (strend > argv[0]) { /* One number.... */ y = strtoul(argv[1], &strend, 0); if (strend > argv[1]) { /* TWO numbers!. */ polypoints[npoly].x = x; polypoints[npoly].y = y; npoly++; argc -= 2; argv += 2; } else { /* Only one number... Assume a usage error. */ Tcl_Free((void *)polypoints); Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } } else { if (strcmp(*argv, "-arrow") == 0) { if (strcmp(argv[1], "none") == 0) { doarrow = 0; } else if (strcmp(argv[1], "both") == 0) { doarrow = 3; } else if (strcmp(argv[1], "first") == 0) { doarrow = 2; } else if (strcmp(argv[1], "last") == 0) { doarrow = 1; } argv += 2; argc -= 2; } else if (strcmp(*argv, "-arrowshape") == 0) { /* List of 3 numbers--set arrowshape array. */ int a1, a2, a3; char dummy; if (sscanf(argv[1], "%d%d%d%c", &a1, &a2, &a3, &dummy) == 3 && a1 > 0 && a2 > 0 && a3 > 0) { arrowshape[0] = a1; arrowshape[1] = a2; arrowshape[2] = a3; } /* Else the argument was bad. */ argv += 2; argc -= 2; } else if (strcmp(*argv, "-capstyle") == 0) { argv += 2; argc -= 2; } else if (strcmp(*argv, "-fill") == 0) { if (GdiGetColor(argv[1], &linecolor)) { dolinecolor = 1; } argv += 2; argc -= 2; } else if (strcmp(*argv, "-joinstyle") == 0) { argv += 2; argc -= 2; } else if (strcmp(*argv, "-smooth") == 0) { /* Argument is true/false or 1/0 or bezier. */ if (argv[1]) { switch (argv[1][0]) { case 't': case 'T': case '1': case 'b': case 'B': /* bezier. */ dosmooth = 1; break; default: dosmooth = 0; break; } argv += 2; argc -= 2; } } else if (strcmp(*argv, "-splinesteps") == 0) { nStep = atoi(argv[1]); argv += 2; argc -= 2; } else if (strcmp(*argv, "-dash") == 0) { if (argv[1]) { dodash = 1; dashdata = argv[1]; } argv += 2; argc -= 2; } else if (strcmp(*argv, "-dashoffset") == 0) { argv += 2; argc -= 2; } else if (strcmp(*argv, "-stipple") == 0) { argv += 2; argc -= 2; } else if (strcmp(*argv, "-width") == 0) { width = atoi(argv[1]); argv += 2; argc -= 2; } else { /* It's an unknown argument!. */ argc--; argv++; } /* Check for arguments * Most of the arguments affect the "Pen" */ } } if (width || dolinecolor || dodash) { GdiMakePen(interp, width, dodash, dashdata, 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen); } if (doarrow != 0) { GdiMakeBrush(interp, 0, linecolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush); } if (dosmooth) { /* Use PolyBezier. */ int nbpoints; POINT *bpoints = 0; nbpoints = Bezierize(polypoints,npoly,nStep,bpoints); if (nbpoints > 0) { Polyline(hDC, bpoints, nbpoints); } else { Polyline(hDC, polypoints, npoly); /* Out of memory? Just draw a regular line. */ } if (bpoints != 0) { Tcl_Free((void *)bpoints); } } else { Polyline(hDC, polypoints, npoly); } if (dodash && doarrow) { /* Don't use dashed or thick pen for the arrows! */ GdiFreePen(interp, hDC, hPen); GdiMakePen(interp, width, 0, 0, 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen); } /* Now the arrowheads, if any. */ if (doarrow & 1) { /* Arrowhead at end = polypoints[npoly-1].x, polypoints[npoly-1].y. */ POINT ahead[6]; double dx, dy, length; double sinTheta, cosTheta; double vertX, vertY, temp; double fracHeight; fracHeight = 2.0 / arrowshape[2]; ahead[0].x = ahead[5].x = polypoints[npoly-1].x; ahead[0].y = ahead[5].y = polypoints[npoly-1].y; dx = ahead[0].x - polypoints[npoly-2].x; dy = ahead[0].y - polypoints[npoly-2].y; if ((length = hypot(dx, dy)) == 0) { sinTheta = cosTheta = 0.0; } else { sinTheta = dy / length; cosTheta = dx / length; } vertX = ahead[0].x - arrowshape[0]*cosTheta; vertY = ahead[0].y - arrowshape[0]*sinTheta; temp = arrowshape[2]*sinTheta; ahead[1].x = (long)(ahead[0].x - arrowshape[1]*cosTheta + temp); ahead[4].x = (long)(ahead[1].x - 2 * temp); temp = arrowshape[2]*cosTheta; ahead[1].y = (long)(ahead[0].y - arrowshape[1]*sinTheta - temp); ahead[4].y = (long)(ahead[1].y + 2 * temp); ahead[2].x = (long)(ahead[1].x*fracHeight + vertX*(1.0-fracHeight)); ahead[2].y = (long)(ahead[1].y*fracHeight + vertY*(1.0-fracHeight)); ahead[3].x = (long)(ahead[4].x*fracHeight + vertX*(1.0-fracHeight)); ahead[3].y = (long)(ahead[4].y*fracHeight + vertY*(1.0-fracHeight)); Polygon(hDC, ahead, 6); } if (doarrow & 2) { /* Arrowhead at end = polypoints[0].x, polypoints[0].y. */ POINT ahead[6]; double dx, dy, length; double sinTheta, cosTheta; double vertX, vertY, temp; double fracHeight; fracHeight = 2.0 / arrowshape[2]; ahead[0].x = ahead[5].x = polypoints[0].x; ahead[0].y = ahead[5].y = polypoints[0].y; dx = ahead[0].x - polypoints[1].x; dy = ahead[0].y - polypoints[1].y; if ((length = hypot(dx, dy)) == 0) { sinTheta = cosTheta = 0.0; } else { sinTheta = dy / length; cosTheta = dx / length; } vertX = ahead[0].x - arrowshape[0]*cosTheta; vertY = ahead[0].y - arrowshape[0]*sinTheta; temp = arrowshape[2]*sinTheta; ahead[1].x = (long)(ahead[0].x - arrowshape[1]*cosTheta + temp); ahead[4].x = (long)(ahead[1].x - 2 * temp); temp = arrowshape[2]*cosTheta; ahead[1].y = (long)(ahead[0].y - arrowshape[1]*sinTheta - temp); ahead[4].y = (long)(ahead[1].y + 2 * temp); ahead[2].x = (long)(ahead[1].x*fracHeight + vertX*(1.0-fracHeight)); ahead[2].y = (long)(ahead[1].y*fracHeight + vertY*(1.0-fracHeight)); ahead[3].x = (long)(ahead[4].x*fracHeight + vertX*(1.0-fracHeight)); ahead[3].y = (long)(ahead[4].y*fracHeight + vertY*(1.0-fracHeight)); Polygon(hDC, ahead, 6); } if (width || dolinecolor || dodash) { GdiFreePen(interp, hDC, hPen); } if (doarrow) { GdiFreeBrush(interp, hDC, hBrush); } Tcl_Free((void *)polypoints); return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiOval -- * * Maps ovals to GDI context. * * Results: * Renders ovals. * *---------------------------------------------------------------------- */ static int GdiOval( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi oval hdc x1 y1 x2 y2 -fill color -outline color " "-stipple bitmap -width linewid"; int x1, y1, x2, y2; HDC hDC; HPEN hPen; int width = 0; COLORREF linecolor = 0, fillcolor = 0; int dolinecolor = 0, dofillcolor = 0; HBRUSH hBrush; LOGBRUSH lbrush; HGDIOBJ oldobj; int dodash = 0; const char *dashdata = 0; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } hDC = printDC; x1 = atol(argv[2]); y1 = atol(argv[3]); x2 = atol(argv[4]); y2 = atol(argv[5]); if (x1 > x2) { int x3 = x1; x1 = x2; x2 = x3; } if (y1 > y2) { int y3 = y1; y1 = y2; y2 = y3; } argc -= 6; argv += 6; while (argc > 0) { /* Now handle any other arguments that occur. */ if (strcmp(argv[0], "-fill") == 0) { if (argv[1] && GdiGetColor(argv[1], &fillcolor)) { dofillcolor = 1; } } else if (strcmp(argv[0], "-outline") == 0) { if (argv[1] && GdiGetColor(argv[1], &linecolor)) { dolinecolor = 1; } } else if (strcmp(argv[0], "-stipple") == 0) { /* Not actually implemented */ } else if (strcmp(argv[0], "-width") == 0) { if (argv[1]) { width = atoi(argv[1]); } } else if (strcmp(argv[0], "-dash") == 0) { if (argv[1]) { dodash = 1; dashdata = argv[1]; } } argv += 2; argc -= 2; } if (dofillcolor) { GdiMakeBrush(interp, 0, fillcolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush); } else { oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH)); } if (width || dolinecolor) { GdiMakePen(interp, width, dodash, dashdata, 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen); } /* * Per Win32, Rectangle includes lower and right edges--per Tcl8.3.2 and * earlier documentation, canvas rectangle does not. Thus, add 1 to right * and lower bounds to get appropriate behavior. */ Ellipse(hDC, x1, y1, x2+1, y2+1); if (width || dolinecolor) { GdiFreePen(interp, hDC, hPen); } if (dofillcolor) { GdiFreeBrush(interp, hDC, hBrush); } else { SelectObject(hDC, oldobj); } return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiPolygon -- * * Maps polygons to GDI context. * * Results: * Renders polygons. * *---------------------------------------------------------------------- */ static int GdiPolygon( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi polygon hdc x1 y1 ... xn yn " "-fill color -outline color -smooth [true|false|bezier] " "-splinesteps number -stipple bitmap -width linewid"; char *strend; POINT *polypoints; int npoly; int dosmooth = 0; int nStep = 12; int x, y; HDC hDC; HPEN hPen; int width = 0; COLORREF linecolor = 0, fillcolor = BS_NULL; int dolinecolor = 0, dofillcolor = 0; LOGBRUSH lbrush; HBRUSH hBrush; HGDIOBJ oldobj; int dodash = 0; const char *dashdata = 0; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } hDC = printDC; polypoints = (POINT *) Tcl_AttemptAlloc((argc - 1) * sizeof(POINT)); if (polypoints == 0) { /* TODO: unreachable */ Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL); return TCL_ERROR; } polypoints[0].x = atol(argv[2]); polypoints[0].y = atol(argv[3]); polypoints[1].x = atol(argv[4]); polypoints[1].y = atol(argv[5]); argc -= 6; argv += 6; npoly = 2; while (argc >= 2) { /* Check for a number */ x = strtoul(argv[0], &strend, 0); if (strend > argv[0]) { /* One number.... */ y = strtoul(argv[1], &strend, 0); if (strend > argv[1]) { /* TWO numbers!. */ polypoints[npoly].x = x; polypoints[npoly].y = y; npoly++; argc -= 2; argv += 2; } else { /* Only one number... Assume a usage error. */ Tcl_Free((void *) polypoints); Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } } else { /* * Check for arguments. * Most of the arguments affect the "Pen" and "Brush". */ if (strcmp(argv[0], "-fill") == 0) { if (argv[1] && GdiGetColor(argv[1], &fillcolor)) { dofillcolor = 1; } } else if (strcmp(argv[0], "-outline") == 0) { if (GdiGetColor(argv[1], &linecolor)) { dolinecolor = 0; } } else if (strcmp(argv[0], "-smooth") == 0) { if (argv[1]) { switch (argv[1][0]) { case 't': case 'T': case '1': case 'b': case 'B': /* bezier. */ dosmooth = 1; break; default: dosmooth = 0; break; } } } else if (strcmp(argv[0], "-splinesteps") == 0) { if (argv[1]) { nStep = atoi(argv[1]); } } else if (strcmp(argv[0], "-stipple") == 0) { /* Not supported */ } else if (strcmp(argv[0], "-width") == 0) { if (argv[1]) { width = atoi(argv[1]); } } else if (strcmp(argv[0], "-dash") == 0) { if (argv[1]) { dodash = 1; dashdata = argv[1]; } } argc -= 2; argv += 2; } } if (dofillcolor) { GdiMakeBrush(interp, 0, fillcolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush); } else { oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH)); } if (width || dolinecolor) { GdiMakePen(interp, width, dodash, dashdata, 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen); } if (dosmooth) { int nbpoints; POINT *bpoints = 0; nbpoints = Bezierize(polypoints,npoly,nStep,bpoints); if (nbpoints > 0) { Polygon(hDC, bpoints, nbpoints); } else { Polygon(hDC, polypoints, npoly); } if (bpoints != 0) { Tcl_Free((void *)bpoints); } } else { Polygon(hDC, polypoints, npoly); } if (width || dolinecolor) { GdiFreePen(interp, hDC, hPen); } if (dofillcolor) { GdiFreeBrush(interp, hDC, hBrush); } else { SelectObject(hDC, oldobj); } Tcl_Free((void *)polypoints); return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiRectangle -- * * Maps rectangles to GDI context. * * Results: * Renders rectangles. * *---------------------------------------------------------------------- */ static int GdiRectangle( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi rectangle hdc x1 y1 x2 y2 " "-fill color -outline color " "-stipple bitmap -width linewid"; int x1, y1, x2, y2; HDC hDC; HPEN hPen; int width = 0; COLORREF linecolor = 0, fillcolor = BS_NULL; int dolinecolor = 0, dofillcolor = 0; LOGBRUSH lbrush; HBRUSH hBrush; HGDIOBJ oldobj; int dodash = 0; const char *dashdata = 0; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } hDC = printDC; x1 = atol(argv[2]); y1 = atol(argv[3]); x2 = atol(argv[4]); y2 = atol(argv[5]); if (x1 > x2) { int x3 = x1; x1 = x2; x2 = x3; } if (y1 > y2) { int y3 = y1; y1 = y2; y2 = y3; } argc -= 6; argv += 6; /* Now handle any other arguments that occur. */ while (argc > 1) { if (strcmp(argv[0], "-fill") == 0) { if (argv[1] && GdiGetColor(argv[1], &fillcolor)) { dofillcolor = 1; } } else if (strcmp(argv[0], "-outline") == 0) { if (argv[1] && GdiGetColor(argv[1], &linecolor)) { dolinecolor = 1; } } else if (strcmp(argv[0], "-stipple") == 0) { /* Not supported; ignored */ } else if (strcmp(argv[0], "-width") == 0) { if (argv[1]) { width = atoi(argv[1]); } } else if (strcmp(argv[0], "-dash") == 0) { if (argv[1]) { dodash = 1; dashdata = argv[1]; } } argc -= 2; argv += 2; } /* * Note: If any fill is specified, the function must create a brush and * put the coordinates in a RECTANGLE structure, and call FillRect. * FillRect requires a BRUSH / color. * If not, the function Rectangle must be called. */ if (dofillcolor) { GdiMakeBrush(interp, 0, fillcolor, 0, &lbrush, hDC, (HGDIOBJ *)&hBrush); } else { oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH)); } if (width || dolinecolor) { GdiMakePen(interp, width, dodash, dashdata, 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen); } /* * Per Win32, Rectangle includes lower and right edges--per Tcl8.3.2 and * earlier documentation, canvas rectangle does not. Thus, add 1 to * right and lower bounds to get appropriate behavior. */ Rectangle(hDC, x1, y1, x2+1, y2+1); if (width || dolinecolor) { GdiFreePen(interp, hDC, hPen); } if (dofillcolor) { GdiFreeBrush(interp, hDC, hBrush); } else { SelectObject(hDC, oldobj); } return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiCharWidths -- * * Computes /character widths. This is completely inadequate for * typesetting, but should work for simple text manipulation. * * Results: * Returns character width. * *---------------------------------------------------------------------- */ static int GdiCharWidths( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi characters hdc [-font fontname] [-array ary]"; /* * Returns widths of characters from font in an associative array. * Font is currently selected font for HDC if not specified. * Array name is GdiCharWidths if not specified. * Widths should be in the same measures as all other values (1/1000 inch). */ HDC hDC; LOGFONTW lf; HFONT hfont, oldfont; int made_font = 0; const char *aryvarname = "GdiCharWidths"; /* For now, assume 256 characters in the font.... */ int widths[256]; int retval; if (argc < 2) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } hDC = printDC; argc -= 2; argv += 2; while (argc > 0) { if (strcmp(argv[0], "-font") == 0) { argc--; argv++; if (GdiMakeLogFont(interp, argv[0], &lf, hDC)) { if ((hfont = CreateFontIndirectW(&lf)) != NULL) { made_font = 1; oldfont = SelectObject(hDC, hfont); } } /* Else leave the font alone!. */ } else if (strcmp(argv[0], "-array") == 0) { argv++; argc--; if (argc > 0) { aryvarname = argv[0]; } } argv++; argc--; } /* Now, get the widths using the correct function for font type. */ if ((retval = GetCharWidth32W(hDC, 0, 255, widths)) == FALSE) { retval = GetCharWidthW(hDC, 0, 255, widths); } /* * Retval should be 1 (TRUE) if the function succeeded. If the function * fails, get the "extended" error code and return. Be sure to deallocate * the font if necessary. */ if (retval == FALSE) { DWORD val = GetLastError(); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "::tk::print::_gdi character failed with code %ld", val)); if (made_font) { SelectObject(hDC, oldfont); DeleteObject(hfont); } return TCL_ERROR; } { int i; char ind[2]; ind[1] = '\0'; for (i = 0; i < 255; i++) { /* TODO: use a bytearray for the index name so NUL works */ ind[0] = i; Tcl_SetVar2Ex(interp, aryvarname, ind, Tcl_NewIntObj(widths[i]), TCL_GLOBAL_ONLY); } } /* Now, remove the font if we created it only for this function. */ if (made_font) { SelectObject(hDC, oldfont); DeleteObject(hfont); } /* The return value should be the array name(?). */ Tcl_AppendResult(interp, (char *)aryvarname, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiText -- * * Maps text to GDI context. * * Results: * Renders text. * *---------------------------------------------------------------------- */ int GdiText( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi text hdc x y -anchor [center|n|e|s|w] " "-fill color -font fontname " "-justify [left|right|center] " "-stipple bitmap -text string -width linelen " "-single -backfill"; HDC hDC; int x, y; const char *string = 0; RECT sizerect; UINT format_flags = DT_EXPANDTABS|DT_NOPREFIX; /* Like the canvas. */ Tk_Anchor anchor = 0; LOGFONTW lf; HFONT hfont, oldfont; int made_font = 0; int retval; int dotextcolor = 0; int dobgmode = 0; int bgmode; COLORREF textcolor = 0; int usesingle = 0; WCHAR *wstring; Tcl_DString tds; if (argc < 4) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } /* Parse the command. */ hDC = printDC; x = atol(argv[2]); y = atol(argv[3]); argc -= 4; argv += 4; sizerect.left = sizerect.right = x; sizerect.top = sizerect.bottom = y; while (argc > 0) { if (strcmp(argv[0], "-anchor") == 0) { argc--; argv++; if (argc > 0) { Tk_GetAnchor(interp, argv[0], &anchor); } } else if (strcmp(argv[0], "-justify") == 0) { argc--; argv++; if (argc > 0) { if (strcmp(argv[0], "left") == 0) { format_flags |= DT_LEFT; } else if (strcmp(argv[0], "center") == 0) { format_flags |= DT_CENTER; } else if (strcmp(argv[0], "right") == 0) { format_flags |= DT_RIGHT; } } } else if (strcmp(argv[0], "-text") == 0) { argc--; argv++; if (argc > 0) { string = argv[0]; } } else if (strcmp(argv[0], "-font") == 0) { argc--; argv++; if (GdiMakeLogFont(interp, argv[0], &lf, hDC)) { if ((hfont = CreateFontIndirectW(&lf)) != NULL) { made_font = 1; oldfont = SelectObject(hDC, hfont); } } /* Else leave the font alone! */ } else if (strcmp(argv[0], "-stipple") == 0) { argc--; argv++; /* Not implemented yet. */ } else if (strcmp(argv[0], "-fill") == 0) { argc--; argv++; /* Get text color. */ if (GdiGetColor(argv[0], &textcolor)) { dotextcolor = 1; } } else if (strcmp(argv[0], "-width") == 0) { argc--; argv++; if (argc > 0) { sizerect.right += atol(argv[0]); } /* If a width is specified, break at words. */ format_flags |= DT_WORDBREAK; } else if (strcmp(argv[0], "-single") == 0) { usesingle = 1; } else if (strcmp(argv[0], "-backfill") == 0) { dobgmode = 1; } argc--; argv++; } if (string == 0) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } /* Set the format flags for -single: Overrides -width. */ if (usesingle == 1) { format_flags |= DT_SINGLELINE; format_flags |= DT_NOCLIP; format_flags &= ~DT_WORDBREAK; } Tcl_DStringInit(&tds); /* Just for fun, let's try translating string to Unicode. */ wstring = Tcl_UtfToWCharDString(string, -1, &tds); DrawTextW(hDC, wstring, Tcl_DStringLength(&tds)/2, &sizerect, format_flags | DT_CALCRECT); /* Adjust the rectangle according to the anchor. */ x = y = 0; switch (anchor) { case TK_ANCHOR_N: x = (sizerect.right - sizerect.left) / 2; break; case TK_ANCHOR_S: x = (sizerect.right - sizerect.left) / 2; y = (sizerect.bottom - sizerect.top); break; case TK_ANCHOR_E: x = (sizerect.right - sizerect.left); y = (sizerect.bottom - sizerect.top) / 2; break; case TK_ANCHOR_W: y = (sizerect.bottom - sizerect.top) / 2; break; case TK_ANCHOR_NE: x = (sizerect.right - sizerect.left); break; case TK_ANCHOR_NW: break; case TK_ANCHOR_SE: x = (sizerect.right - sizerect.left); y = (sizerect.bottom - sizerect.top); break; case TK_ANCHOR_SW: y = (sizerect.bottom - sizerect.top); break; default: x = (sizerect.right - sizerect.left) / 2; y = (sizerect.bottom - sizerect.top) / 2; break; } sizerect.right -= x; sizerect.left -= x; sizerect.top -= y; sizerect.bottom -= y; /* Get the color right. */ if (dotextcolor) { textcolor = SetTextColor(hDC, textcolor); } if (dobgmode) { bgmode = SetBkMode(hDC, OPAQUE); } else { bgmode = SetBkMode(hDC, TRANSPARENT); } /* Print the text. */ retval = DrawTextW(hDC, wstring, Tcl_DStringLength(&tds)/2, &sizerect, format_flags); Tcl_DStringFree(&tds); /* Get the color set back. */ if (dotextcolor) { textcolor = SetTextColor(hDC, textcolor); } SetBkMode(hDC, bgmode); if (made_font) { SelectObject(hDC, oldfont); DeleteObject(hfont); } /* In this case, the return value is the height of the text. */ Tcl_SetObjResult(interp, Tcl_NewIntObj(retval)); return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiGetHdcInfo -- * * Gets salient characteristics of the CTM. * * Results: * The return value is 0 if any failure occurs--in which case none of the * other values are meaningful. Otherwise the return value is the * current mapping mode. * *---------------------------------------------------------------------- */ static int GdiGetHdcInfo( HDC hdc, LPPOINT worigin, LPSIZE wextent, LPPOINT vorigin, LPSIZE vextent) { int mapmode; int retval; memset(worigin, 0, sizeof(POINT)); memset(vorigin, 0, sizeof(POINT)); memset(wextent, 0, sizeof(SIZE)); memset(vextent, 0, sizeof(SIZE)); if ((mapmode = GetMapMode(hdc)) == 0) { /* Failed! */ retval = 0; } else { retval = mapmode; } if (GetWindowExtEx(hdc, wextent) == FALSE) { /* Failed! */ retval = 0; } if (GetViewportExtEx(hdc, vextent) == FALSE) { /* Failed! */ retval = 0; } if (GetWindowOrgEx(hdc, worigin) == FALSE) { /* Failed! */ retval = 0; } if (GetViewportOrgEx(hdc, vorigin) == FALSE) { /* Failed! */ retval = 0; } return retval; } /* *---------------------------------------------------------------------- * * GdiNameToMode -- * * Converts Windows mapping mode names. * * Results: * Mapping modes are delineated. * *---------------------------------------------------------------------- */ static int GdiNameToMode( const char *name) { static const struct gdimodes { int mode; const char *name; } modes[] = { { MM_ANISOTROPIC, "MM_ANISOTROPIC" }, { MM_HIENGLISH, "MM_HIENGLISH" }, { MM_HIMETRIC, "MM_HIMETRIC" }, { MM_ISOTROPIC, "MM_ISOTROPIC" }, { MM_LOENGLISH, "MM_LOENGLISH" }, { MM_LOMETRIC, "MM_LOMETRIC" }, { MM_TEXT, "MM_TEXT" }, { MM_TWIPS, "MM_TWIPS" } }; size_t i; for (i=0; i < sizeof(modes) / sizeof(struct gdimodes); i++) { if (strcmp(modes[i].name, name) == 0) { return modes[i].mode; } } return atoi(name); } /* *---------------------------------------------------------------------- * * GdiModeToName -- * * Converts the mode number to a printable form. * * Results: * Mapping numbers are delineated. * *---------------------------------------------------------------------- */ static const char *GdiModeToName( int mode) { static const struct gdi_modes { int mode; const char *name; } modes[] = { { MM_ANISOTROPIC, "Anisotropic" }, { MM_HIENGLISH, "1/1000 inch" }, { MM_HIMETRIC, "1/100 mm" }, { MM_ISOTROPIC, "Isotropic" }, { MM_LOENGLISH, "1/100 inch" }, { MM_LOMETRIC, "1/10 mm" }, { MM_TEXT, "1 to 1" }, { MM_TWIPS, "1/1440 inch" } }; size_t i; for (i=0; i < sizeof(modes) / sizeof(struct gdi_modes); i++) { if (modes[i].mode == mode) { return modes[i].name; } } return "Unknown"; } /* *---------------------------------------------------------------------- * * GdiMap -- * * Sets mapping mode between logical and physical device space. * * Results: * Bridges map modes. * *---------------------------------------------------------------------- */ static int GdiMap( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { static const char usage_message[] = "::tk::print::_gdi map hdc " "[-logical x[y]] [-physical x[y]] " "[-offset {x y} ] [-default] [-mode mode]"; HDC hdc; int mapmode; /* Mapping mode. */ SIZE wextent; /* Device extent. */ SIZE vextent; /* Viewport extent. */ POINT worigin; /* Device origin. */ POINT vorigin; /* Viewport origin. */ int argno; /* Keep track of what parts of the function need to be executed. */ int need_usage = 0; int use_logical = 0; int use_physical = 0; int use_offset = 0; int use_default = 0; int use_mode = 0; /* Required parameter: HDC for printer. */ if (argc < 2) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } hdc = printDC; if ((mapmode = GdiGetHdcInfo(hdc, &worigin, &wextent, &vorigin, &vextent)) == 0) { /* Failed!. */ Tcl_AppendResult(interp, "Cannot get current HDC info", NULL); return TCL_ERROR; } /* Parse remaining arguments. */ for (argno = 2; argno < argc; argno++) { if (strcmp(argv[argno], "-default") == 0) { vextent.cx = vextent.cy = wextent.cx = wextent.cy = 1; vorigin.x = vorigin.y = worigin.x = worigin.y = 0; mapmode = MM_TEXT; use_default = 1; } else if (strcmp(argv[argno], "-mode") == 0) { if (argno + 1 >= argc) { need_usage = 1; } else { mapmode = GdiNameToMode(argv[argno + 1]); use_mode = 1; argno++; } } else if (strcmp(argv[argno], "-offset") == 0) { if (argno + 1 >= argc) { need_usage = 1; } else { /* It would be nice if this parsed units as well.... */ if (sscanf(argv[argno + 1], "%ld%ld", &vorigin.x, &vorigin.y) == 2) { use_offset = 1; } else { need_usage = 1; } argno++; } } else if (strcmp(argv[argno], "-logical") == 0) { if (argno + 1 >= argc) { need_usage = 1; } else { int count; argno++; /* In "real-life", this should parse units as well.. */ if ((count = sscanf(argv[argno], "%ld%ld", &wextent.cx, &wextent.cy)) != 2) { if (count == 1) { mapmode = MM_ISOTROPIC; use_logical = 1; wextent.cy = wextent.cx; /* Make them the same. */ } else { need_usage = 1; } } else { mapmode = MM_ANISOTROPIC; use_logical = 2; } } } else if (strcmp(argv[argno], "-physical") == 0) { if (argno + 1 >= argc) { need_usage = 1; } else { int count; argno++; /* In "real-life", this should parse units as well.. */ if ((count = sscanf(argv[argno], "%ld%ld", &vextent.cx, &vextent.cy)) != 2) { if (count == 1) { mapmode = MM_ISOTROPIC; use_physical = 1; vextent.cy = vextent.cx; /* Make them the same. */ } else { need_usage = 1; } } else { mapmode = MM_ANISOTROPIC; use_physical = 2; } } } } /* Check for any impossible combinations. */ if (use_logical != use_physical) { need_usage = 1; } if (use_default && (use_logical || use_offset || use_mode)) { need_usage = 1; } if (use_mode && use_logical && (mapmode != MM_ISOTROPIC && mapmode != MM_ANISOTROPIC)) { need_usage = 1; } if (need_usage) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } /* Call Windows CTM functions. */ if (use_logical || use_default || use_mode) { /* Don't call for offset only. */ SetMapMode(hdc, mapmode); } if (use_offset || use_default) { POINT oldorg; SetViewportOrgEx(hdc, vorigin.x, vorigin.y, &oldorg); SetWindowOrgEx(hdc, worigin.x, worigin.y, &oldorg); } if (use_logical) { /* Same as use_physical. */ SIZE oldsiz; SetWindowExtEx(hdc, wextent.cx, wextent.cy, &oldsiz); SetViewportExtEx(hdc, vextent.cx, vextent.cy, &oldsiz); } /* * Since we may not have set up every parameter, get them again for the * report. */ mapmode = GdiGetHdcInfo(hdc, &worigin, &wextent, &vorigin, &vextent); /* * Output current CTM info. * Note: This should really be in terms that can be used in a * ::tk::print::_gdi map command! */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Transform: \"(%ld, %ld) -> (%ld, %ld)\" " "Origin: \"(%ld, %ld)\" " "MappingMode: \"%s\"", vextent.cx, vextent.cy, wextent.cx, wextent.cy, vorigin.x, vorigin.y, GdiModeToName(mapmode))); return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiCopyBits -- * * Copies window bits from source to destination. * * Results: * Copies window bits. * *---------------------------------------------------------------------- */ static int GdiCopyBits( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) { /* Goal: get the Tk_Window from the top-level * convert it to an HWND * get the HDC * Do a bitblt to the given hdc * Use an optional parameter to point to an arbitrary window instead of * the main * Use optional parameters to map to the width and height required for the * dest. */ static const char usage_message[] = "::tk::print::_gdi copybits hdc [-window w|-screen] [-client] " "[-source \"a b c d\"] " "[-destination \"a b c d\"] [-scale number] [-calc]"; Tk_Window mainWin; Tk_Window workwin; Window wnd; HDC src; HDC dst; HWND hwnd = 0; HANDLE hDib; /* Handle for device-independent bitmap. */ LPBITMAPINFOHEADER lpDIBHdr; LPSTR lpBits; enum PrintType wintype = PTWindow; int hgt, wid; char *strend; long errcode; int k; /* Variables to remember what we saw in the arguments. */ int do_window = 0; int do_screen = 0; int do_scale = 0; int do_print = 1; /* Variables to remember the values in the arguments. */ const char *window_spec; double scale = 1.0; int src_x = 0, src_y = 0, src_w = 0, src_h = 0; int dst_x = 0, dst_y = 0, dst_w = 0, dst_h = 0; int is_toplevel = 0; /* * The following steps are peculiar to the top level window. * There is likely a clever way to do the mapping of a widget pathname to * the proper window, to support the idea of using a parameter for this * purpose. */ if ((workwin = mainWin = Tk_MainWindow(interp)) == 0) { Tcl_AppendResult(interp, "Can't find main Tk window", NULL); return TCL_ERROR; } /* * Parse the arguments. */ /* HDC is required. */ if (argc < 2) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } dst = printDC; /* * Next, check to see if 'dst' can support BitBlt. If not, raise an * error. */ if ((GetDeviceCaps(dst, RASTERCAPS) & RC_BITBLT) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Can't do bitmap operations on device context\n")); return TCL_ERROR; } /* Loop through the remaining arguments. */ for (k=2; k<argc; k++) { if (strcmp(argv[k], "-window") == 0) { if (argv[k+1] && argv[k+1][0] == '.') { do_window = 1; workwin = Tk_NameToWindow(interp, window_spec = argv[++k], mainWin); if (workwin == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Can't find window %s in this application", window_spec)); return TCL_ERROR; } } else { /* Use strtoul() so octal or hex representations will be * parsed. */ hwnd = (HWND) INT2PTR(strtoul(argv[++k], &strend, 0)); if (strend == 0 || strend == argv[k]) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Can't understand window id %s", argv[k])); return TCL_ERROR; } } } else if (strcmp(argv[k], "-screen") == 0) { do_screen = 1; wintype = PTScreen; } else if (strcmp(argv[k], "-client") == 0) { wintype = PTClient; } else if (strcmp(argv[k], "-source") == 0) { float a, b, c, d; int count = sscanf(argv[++k], "%f%f%f%f", &a, &b, &c, &d); if (count < 2) { /* Can't make heads or tails of it.... */ Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } src_x = (int)a; src_y = (int)b; if (count == 4) { src_w = (int)c; src_h = (int)d; } } else if (strcmp(argv[k], "-destination") == 0) { float a, b, c, d; int count; count = sscanf(argv[++k], "%f%f%f%f", &a, &b, &c, &d); if (count < 2) { /* Can't make heads or tails of it.... */ Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } dst_x = (int)a; dst_y = (int)b; if (count == 3) { dst_w = (int)c; dst_h = -1; } else if (count == 4) { dst_w = (int)c; dst_h = (int)d; } } else if (strcmp(argv[k], "-scale") == 0) { if (argv[++k]) { scale = strtod(argv[k], &strend); if (strend == 0 || strend == argv[k]) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Can't understand scale specification %s", argv[k])); return TCL_ERROR; } if (scale <= 0.01 || scale >= 100.0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Unreasonable scale specification %s", argv[k])); return TCL_ERROR; } do_scale = 1; } } else if (strcmp(argv[k], "-noprint") == 0 || strncmp(argv[k], "-calc", 5) == 0) { /* This option suggested by Pascal Bouvier to get sizes without * printing. */ do_print = 0; } } /* * Check to ensure no incompatible arguments were used. */ if (do_window && do_screen) { Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } /* * Get the MS Window we want to copy. Given the HDC, we can get the * "Window". */ if (hwnd == 0) { if (Tk_IsTopLevel(workwin)) { is_toplevel = 1; } if ((wnd = Tk_WindowId(workwin)) == 0) { Tcl_AppendResult(interp, "Can't get id for Tk window", NULL); return TCL_ERROR; } /* Given the "Window" we can get a Microsoft Windows HWND. */ if ((hwnd = Tk_GetHWND(wnd)) == 0) { Tcl_AppendResult(interp, "Can't get Windows handle for Tk window", NULL); return TCL_ERROR; } /* * If it's a toplevel, give it special treatment: Get the top-level * window instead. If the user only wanted the client, the -client * flag will take care of it. This uses "windows" tricks rather than * Tk since the obvious method of getting the wrapper window didn't * seem to work. */ if (is_toplevel) { HWND tmpWnd = hwnd; while ((tmpWnd = GetParent(tmpWnd)) != 0) { hwnd = tmpWnd; } } } /* Given the HWND, we can get the window's device context. */ if ((src = GetWindowDC(hwnd)) == 0) { Tcl_AppendResult(interp, "Can't get device context for Tk window", NULL); return TCL_ERROR; } if (do_screen) { LONG w, h; GetDisplaySize(&w, &h); wid = w; hgt = h; } else if (is_toplevel) { RECT tl; GetWindowRect(hwnd, &tl); wid = tl.right - tl.left; hgt = tl.bottom - tl.top; } else { if ((hgt = Tk_Height(workwin)) <= 0) { Tcl_AppendResult(interp, "Can't get height of Tk window", NULL); ReleaseDC(hwnd,src); return TCL_ERROR; } if ((wid = Tk_Width(workwin)) <= 0) { Tcl_AppendResult(interp, "Can't get width of Tk window", NULL); ReleaseDC(hwnd,src); return TCL_ERROR; } } /* * Ensure all the widths and heights are set up right * A: No dimensions are negative * B: No dimensions exceed the maximums * C: The dimensions don't lead to a 0 width or height image. */ if (src_x < 0) { src_x = 0; } if (src_y < 0) { src_y = 0; } if (dst_x < 0) { dst_x = 0; } if (dst_y < 0) { dst_y = 0; } if (src_w > wid || src_w <= 0) { src_w = wid; } if (src_h > hgt || src_h <= 0) { src_h = hgt; } if (do_scale && dst_w == 0) { /* Calculate destination width and height based on scale. */ dst_w = (int)(scale * src_w); dst_h = (int)(scale * src_h); } if (dst_h == -1) { dst_h = (int) (((long)src_h * dst_w) / (src_w + 1)) + 1; } if (dst_h == 0 || dst_w == 0) { dst_h = src_h; dst_w = src_w; } if (do_print) { /* * Based on notes from Heiko Schock and Arndt Roger Schneider, create * this as a DIBitmap, to allow output to a greater range of devices. * This approach will also allow selection of * a) Whole screen * b) Whole window * c) Client window only * for the "grab" */ hDib = CopyToDIB(hwnd, wintype); /* GdiFlush();. */ if (!hDib) { Tcl_AppendResult(interp, "Can't create DIB", NULL); ReleaseDC(hwnd,src); return TCL_ERROR; } lpDIBHdr = (LPBITMAPINFOHEADER) GlobalLock(hDib); if (!lpDIBHdr) { Tcl_AppendResult(interp, "Can't get DIB header", NULL); ReleaseDC(hwnd,src); return TCL_ERROR; } lpBits = (LPSTR) lpDIBHdr + lpDIBHdr->biSize + DIBNumColors(lpDIBHdr) * sizeof(RGBQUAD); /* stretch the DIBbitmap directly in the target device. */ if (StretchDIBits(dst, dst_x, dst_y, dst_w, dst_h, src_x, src_y, src_w, src_h, lpBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS, SRCCOPY) == (int)GDI_ERROR) { errcode = GetLastError(); GlobalUnlock(hDib); GlobalFree(hDib); ReleaseDC(hwnd,src); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "StretchDIBits failed with code %ld", errcode)); return TCL_ERROR; } /* free allocated memory. */ GlobalUnlock(hDib); GlobalFree(hDib); } ReleaseDC(hwnd,src); /* * The return value should relate to the size in the destination space. * At least the height should be returned (for page layout purposes). */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%d %d %d %d", dst_x, dst_y, dst_w, dst_h)); return TCL_OK; } /* *---------------------------------------------------------------------- * * DIBNumColors -- * * Computes the number of colors required for a DIB palette. * * Results: * Returns number of colors. * *---------------------------------------------------------------------- */ static int DIBNumColors( LPBITMAPINFOHEADER lpDIB) { WORD wBitCount; /* DIB bit count. */ DWORD dwClrUsed; /* * If this is a Windows-style DIB, the number of colors in the color table * can be less than the number of bits per pixel allows for (i.e. * lpbi->biClrUsed can be set to some value). If this is the case, return * the appropriate value.. */ dwClrUsed = lpDIB->biClrUsed; if (dwClrUsed) { return (WORD) dwClrUsed; } /* * Calculate the number of colors in the color table based on. * The number of bits per pixel for the DIB. */ wBitCount = lpDIB->biBitCount; /* Return number of colors based on bits per pixel. */ switch (wBitCount) { case 1: return 2; case 4: return 16; case 8: return 256; default: return 0; } } /* * Helper functions */ /* * ParseFontWords converts various keywords to modifyers of a * font specification. * For all words, later occurrences override earlier occurrences. * Overstrike and underline cannot be "undone" by other words */ /* *---------------------------------------------------------------------- * * GdiParseFontWords -- * * Converts various keywords to modifiers of a font specification. For * all words, later occurrences override earlier occurrences. Overstrike * and underline cannot be "undone" by other words * * Results: * Keywords converted to modifiers. * *---------------------------------------------------------------------- */ static int GdiParseFontWords( TCL_UNUSED(Tcl_Interp *), LOGFONTW *lf, const char *str[], int numargs) { int i; int retval = 0; /* Number of words that could not be parsed. */ for (i=0; i<numargs; i++) { if (str[i]) { int wt; if ((wt = GdiWordToWeight(str[i])) != -1) { lf->lfWeight = wt; } else if (strcmp(str[i], "roman") == 0) { lf->lfItalic = FALSE; } else if (strcmp(str[i], "italic") == 0) { lf->lfItalic = TRUE; } else if (strcmp(str[i], "underline") == 0) { lf->lfUnderline = TRUE; } else if (strcmp(str[i], "overstrike") == 0) { lf->lfStrikeOut = TRUE; } else { retval++; } } } return retval; } /* *---------------------------------------------------------------------- * * GdiWordToWeight -- * * Converts keywords to font weights. * * Results: * Helps set the proper font for GDI rendering. * *---------------------------------------------------------------------- */ static int GdiWordToWeight( const char *str) { int retval = -1; size_t i; static const struct font_weight { const char *name; int weight; } font_weights[] = { { "thin", FW_THIN }, { "extralight", FW_EXTRALIGHT }, { "ultralight", FW_EXTRALIGHT }, { "light", FW_LIGHT }, { "normal", FW_NORMAL }, { "regular", FW_NORMAL }, { "medium", FW_MEDIUM }, { "semibold", FW_SEMIBOLD }, { "demibold", FW_SEMIBOLD }, { "bold", FW_BOLD }, { "extrabold", FW_EXTRABOLD }, { "ultrabold", FW_EXTRABOLD }, { "heavy", FW_HEAVY }, { "black", FW_HEAVY }, }; if (str == 0) { return -1; } for (i=0; i<sizeof(font_weights) / sizeof(struct font_weight); i++) { if (strcmp(str, font_weights[i].name) == 0) { retval = font_weights[i].weight; break; } } return retval; } /* *---------------------------------------------------------------------- * * MakeLogFont -- * * Takes the font description string and converts this into a logical * font spec. * * Results: * Sets font weight. * *---------------------------------------------------------------------- */ static int GdiMakeLogFont( Tcl_Interp *interp, const char *str, LOGFONTW *lf, HDC hDC) { const char **list; int count; /* Set up defaults for logical font. */ memset(lf, 0, sizeof(*lf)); lf->lfWeight = FW_NORMAL; lf->lfCharSet = DEFAULT_CHARSET; lf->lfOutPrecision = OUT_DEFAULT_PRECIS; lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; /* The cast to (char *) is silly, based on prototype of Tcl_SplitList. */ if (Tcl_SplitList(interp, str, &count, &list) != TCL_OK) { return 0; } /* Now we have the font structure broken into name, size, weight. */ if (count >= 1) { Tcl_DString ds; Tcl_DStringInit(&ds); wcsncpy(lf->lfFaceName, Tcl_UtfToWCharDString(list[0], -1, &ds), LF_FACESIZE-1); Tcl_DStringFree(&ds); lf->lfFaceName[LF_FACESIZE-1] = 0; } else { return 0; } if (count >= 2) { int siz; char *strend; siz = strtol(list[1], &strend, 0); /* * Assumptions: * 1) Like canvas, if a positive number is specified, it's in points. * 2) Like canvas, if a negative number is specified, it's in pixels. */ if (strend > list[1]) { /* If it looks like a number, it is a number.... */ if (siz > 0) { /* Size is in points. */ SIZE wextent, vextent; POINT worigin, vorigin; double factor; switch (GdiGetHdcInfo(hDC, &worigin, &wextent, &vorigin, &vextent)) { case MM_ISOTROPIC: if (vextent.cy < -1 || vextent.cy > 1) { factor = (double)wextent.cy / vextent.cy; if (factor < 0.0) { factor = -factor; } lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0); } else if (vextent.cx < -1 || vextent.cx > 1) { factor = (double)wextent.cx / vextent.cx; if (factor < 0.0) { factor = -factor; } lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0); } else { lf->lfHeight = -siz; /* This is bad news.... */ } break; case MM_ANISOTROPIC: if (vextent.cy != 0) { factor = (double)wextent.cy / vextent.cy; if (factor < 0.0) { factor = -factor; } lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0); } else { lf->lfHeight = -siz; /* This is bad news.... */ } break; case MM_TEXT: default: /* If mapping mode is MM_TEXT, use the documented * formula. */ lf->lfHeight = -MulDiv(siz, GetDeviceCaps(hDC, LOGPIXELSY), 72); break; case MM_HIENGLISH: lf->lfHeight = -MulDiv(siz, 1000, 72); break; case MM_LOENGLISH: lf->lfHeight = -MulDiv(siz, 100, 72); break; case MM_HIMETRIC: lf->lfHeight = -MulDiv(siz, (int)(1000*2.54), 72); break; case MM_LOMETRIC: lf->lfHeight = -MulDiv(siz, (int)(100*2.54), 72); break; case MM_TWIPS: lf->lfHeight = -MulDiv(siz, 1440, 72); break; } } else if (siz == 0) { /* Use default size of 12 points. */ lf->lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72); } else { /* Use pixel size. */ lf->lfHeight = siz; /* Leave this negative. */ } } else { GdiParseFontWords(interp, lf, list+1, count-1); } } if (count >= 3) { GdiParseFontWords(interp, lf, list+2, count-2); } Tcl_Free((char *)list); return 1; } /* *---------------------------------------------------------------------- * * GdiMakePen -- * * Creates a logical pen based on input parameters and selects it into * the hDC. * * Results: * Sets rendering pen. * *---------------------------------------------------------------------- */ static int GdiMakePen( Tcl_Interp *interp, int width, int dashstyle, const char *dashstyledata, TCL_UNUSED(int), /* Ignored for now. */ TCL_UNUSED(int), /* Ignored for now. */ TCL_UNUSED(int), TCL_UNUSED(const char *), /* Ignored for now. */ unsigned long color, HDC hDC, HGDIOBJ *oldPen) { /* * The LOGPEN structure takes the following dash options: * PS_SOLID: a solid pen * PS_DASH: a dashed pen * PS_DOT: a dotted pen * PS_DASHDOT: a pen with a dash followed by a dot * PS_DASHDOTDOT: a pen with a dash followed by 2 dots * * It seems that converting to ExtCreatePen may be more advantageous, as * it matches the Tk canvas pens much better--but not for Win95, which * does not support PS_USERSTYLE. An explicit test (or storage in a static * after first failure) may suffice for working around this. The * ExtCreatePen is not supported at all under Win32. */ HPEN hPen; LOGBRUSH lBrush; DWORD pStyle = PS_SOLID; /* -dash should override*/ DWORD endStyle = PS_ENDCAP_ROUND; /* -capstyle should override. */ DWORD joinStyle = PS_JOIN_ROUND; /* -joinstyle should override. */ DWORD styleCount = 0; DWORD *styleArray = 0; /* * To limit the propagation of allocated memory, the dashes will have a * maximum here. If one wishes to remove the static allocation, please be * sure to update GdiFreePen and ensure that the array is NOT freed if the * LOGPEN option is used. */ static DWORD pStyleData[24]; if (dashstyle != 0 && dashstyledata != 0) { const char *cp; size_t i; char *dup = (char *) Tcl_Alloc(strlen(dashstyledata) + 1); strcpy(dup, dashstyledata); /* DEBUG. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "DEBUG: Found a dash spec of |%s|\n", dashstyledata)); /* Parse the dash spec. */ if (isdigit(dashstyledata[0])) { cp = strtok(dup, " \t,;"); for (i = 0; cp && i < sizeof(pStyleData) / sizeof(DWORD); i++) { pStyleData[styleCount++] = atoi(cp); cp = strtok(NULL, " \t,;"); } } else { for (i=0; dashstyledata[i] != '\0' && i< sizeof(pStyleData) / sizeof(DWORD); i++) { switch (dashstyledata[i]) { case ' ': pStyleData[styleCount++] = 8; break; case ',': pStyleData[styleCount++] = 4; break; case '_': pStyleData[styleCount++] = 6; break; case '-': pStyleData[styleCount++] = 4; break; case '.': pStyleData[styleCount++] = 2; break; default: break; } } } if (styleCount > 0) { styleArray = pStyleData; } else { dashstyle = 0; } if (dup) { Tcl_Free(dup); } } if (dashstyle != 0) { pStyle = PS_USERSTYLE; } /* -stipple could affect this.... */ lBrush.lbStyle = BS_SOLID; lBrush.lbColor = color; lBrush.lbHatch = 0; /* We only use geometric pens, even for 1-pixel drawing. */ hPen = ExtCreatePen(PS_GEOMETRIC|pStyle|endStyle|joinStyle, width, &lBrush, styleCount, styleArray); if (hPen == 0) { /* Failed for some reason...Fall back on CreatePenIndirect. */ LOGPEN lf; lf.lopnWidth.x = width; lf.lopnWidth.y = 0; /* Unused in LOGPEN. */ if (dashstyle == 0) { lf.lopnStyle = PS_SOLID; /* For now...convert 'style' in the future. */ } else { lf.lopnStyle = PS_DASH; /* REALLLLY simple for now. */ } lf.lopnColor = color; /* Assume we're getting a COLORREF. */ /* Now we have a logical pen. Create the "real" pen and put it in the * hDC. */ hPen = CreatePenIndirect(&lf); } *oldPen = SelectObject(hDC, hPen); return 1; } /* *---------------------------------------------------------------------- * * GdiFreePen -- * * Wraps the protocol to delete a created pen. * * Results: * Deletes pen. * *---------------------------------------------------------------------- */ static int GdiFreePen( TCL_UNUSED(Tcl_Interp *), HDC hDC, HGDIOBJ oldPen) { HGDIOBJ gonePen = SelectObject(hDC, oldPen); DeleteObject(gonePen); return 1; } /* *---------------------------------------------------------------------- * * GdiMakeBrush-- * * Creates a logical brush based on input parameters, and selects it into * the hdc. * * Results: * Creates brush. * *---------------------------------------------------------------------- */ static int GdiMakeBrush( TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(unsigned int), unsigned long color, long hatch, LOGBRUSH *lb, HDC hDC, HGDIOBJ *oldBrush) { HBRUSH hBrush; lb->lbStyle = BS_SOLID; /* Support other styles later. */ lb->lbColor = color; /* Assume this is a COLORREF. */ lb->lbHatch = hatch; /* Ignored for now, given BS_SOLID in the Style. */ /* Now we have the logical brush. Create the "real" brush and put it in * the hDC. */ hBrush = CreateBrushIndirect(lb); *oldBrush = SelectObject(hDC, hBrush); return 1; } /* *---------------------------------------------------------------------- * * GdiFreeBrush -- * * Wraps the protocol to delete a created brush. * * Results: * Deletes brush. * *---------------------------------------------------------------------- */ static int GdiFreeBrush( TCL_UNUSED(Tcl_Interp *), HDC hDC, HGDIOBJ oldBrush) { HGDIOBJ goneBrush; goneBrush = SelectObject(hDC, oldBrush); DeleteObject(goneBrush); return 1; } /* * Utility functions from elsewhere in Tcl. * Functions have removed reliance on X and Tk libraries, as well as removing * the need for TkWindows. * GdiGetColor is a copy of a TkpGetColor from tkWinColor.c */ typedef struct { const char *name; int index; } SystemColorEntry; static const SystemColorEntry sysColors[] = { {"3dDarkShadow", COLOR_3DDKSHADOW}, {"3dLight", COLOR_3DLIGHT}, {"ActiveBorder", COLOR_ACTIVEBORDER}, {"ActiveCaption", COLOR_ACTIVECAPTION}, {"AppWorkspace", COLOR_APPWORKSPACE}, {"Background", COLOR_BACKGROUND}, {"ButtonFace", COLOR_BTNFACE}, {"ButtonHighlight", COLOR_BTNHIGHLIGHT}, {"ButtonShadow", COLOR_BTNSHADOW}, {"ButtonText", COLOR_BTNTEXT}, {"CaptionText", COLOR_CAPTIONTEXT}, {"DisabledText", COLOR_GRAYTEXT}, {"GrayText", COLOR_GRAYTEXT}, {"Highlight", COLOR_HIGHLIGHT}, {"HighlightText", COLOR_HIGHLIGHTTEXT}, {"InactiveBorder", COLOR_INACTIVEBORDER}, {"InactiveCaption", COLOR_INACTIVECAPTION}, {"InactiveCaptionText", COLOR_INACTIVECAPTIONTEXT}, {"InfoBackground", COLOR_INFOBK}, {"InfoText", COLOR_INFOTEXT}, {"Menu", COLOR_MENU}, {"MenuText", COLOR_MENUTEXT}, {"Scrollbar", COLOR_SCROLLBAR}, {"Window", COLOR_WINDOW}, {"WindowFrame", COLOR_WINDOWFRAME}, {"WindowText", COLOR_WINDOWTEXT} }; static int numsyscolors = 0; /* *---------------------------------------------------------------------- * * GdiGetColor -- * * Convert color name to color specification. * * Results: * Color name converted. * *---------------------------------------------------------------------- */ static int GdiGetColor( const char *name, COLORREF *color) { if (numsyscolors == 0) { numsyscolors = sizeof(sysColors) / sizeof(SystemColorEntry); } if (_strnicmp(name, "system", 6) == 0) { int i, l, u, r; l = 0; u = numsyscolors; while (l <= u) { i = (l + u) / 2; if ((r = _strcmpi(name+6, sysColors[i].name)) == 0) { break; } if (r < 0) { u = i - 1; } else { l = i + 1; } } if (l > u) { return 0; } *color = GetSysColor(sysColors[i].index); return 1; } else { int result; XColor xcolor; result = XParseColor(NULL, 0, name, &xcolor); *color = ((xcolor.red & 0xFF00)>>8) | (xcolor.green & 0xFF00) | ((xcolor.blue & 0xFF00)<<8); return result; } } /* * Beginning of functions for screen-to-dib translations. * * Several of these functions are based on those in the WINCAP32 program * provided as a sample by Microsoft on the VC++ 5.0 disk. The copyright on * these functions is retained, even for those with significant changes. */ /* *---------------------------------------------------------------------- * * CopyToDIB -- * * Copy window bits to a DIB. * * Results: * Color specification converted. * *---------------------------------------------------------------------- */ static HANDLE CopyToDIB( HWND hWnd, enum PrintType type) { HANDLE hDIB; HBITMAP hBitmap; HPALETTE hPalette; /* Check for a valid window handle. */ if (!hWnd) { return NULL; } switch (type) { case PTWindow: { /* Copy entire window. */ RECT rectWnd; /* Get the window rectangle. */ GetWindowRect(hWnd, &rectWnd); /* * Get the DIB of the window by calling CopyScreenToDIB and passing it * the window rect. */ hDIB = CopyScreenToDIB(&rectWnd); break; } case PTClient: { /* Copy client area. */ RECT rectClient; POINT pt1, pt2; /* Get the client area dimensions. */ GetClientRect(hWnd, &rectClient); /* Convert client coords to screen coords. */ pt1.x = rectClient.left; pt1.y = rectClient.top; pt2.x = rectClient.right; pt2.y = rectClient.bottom; ClientToScreen(hWnd, &pt1); ClientToScreen(hWnd, &pt2); rectClient.left = pt1.x; rectClient.top = pt1.y; rectClient.right = pt2.x; rectClient.bottom = pt2.y; /* * Get the DIB of the client area by calling CopyScreenToDIB and * passing it the client rect. */ hDIB = CopyScreenToDIB(&rectClient); break; } case PTScreen: { /* Entire screen. */ RECT Rect; /* * Get the device-dependent bitmap in lpRect by calling * CopyScreenToBitmap and passing it the rectangle to grab. */ Rect.top = Rect.left = 0; GetDisplaySize(&Rect.right, &Rect.bottom); hBitmap = CopyScreenToBitmap(&Rect); /* Check for a valid bitmap handle. */ if (!hBitmap) { return NULL; } /* Get the current palette. */ hPalette = GetSystemPalette(); /* Convert the bitmap to a DIB. */ hDIB = BitmapToDIB(hBitmap, hPalette); /* Clean up. */ DeleteObject(hPalette); DeleteObject(hBitmap); /* Return handle to the packed-DIB. */ break; } default: /* Invalid print area. */ return NULL; } /* Return the handle to the DIB. */ return hDIB; } /* *---------------------------------------------------------------------- * * GetDisplaySize-- * * GetDisplaySize does just that. There may be an easier way, but it is * not apparent. * * Results: * Returns display size. * *---------------------------------------------------------------------- */ static void GetDisplaySize( LONG *width, LONG *height) { HDC hDC; hDC = CreateDCW(L"DISPLAY", 0, 0, 0); *width = GetDeviceCaps(hDC, HORZRES); *height = GetDeviceCaps(hDC, VERTRES); DeleteDC(hDC); } /* *---------------------------------------------------------------------- * * CopyScreenToBitmap-- * * Copies screen to bitmap. * * Results: * Screen is copied. * *---------------------------------------------------------------------- */ static HBITMAP CopyScreenToBitmap( LPRECT lpRect) { HDC hScrDC, hMemDC; /* Screen DC and memory DC. */ HBITMAP hBitmap, hOldBitmap; /* Handles to deice-dependent bitmaps. */ int nX, nY, nX2, nY2; /* Coordinates of rectangle to grab. */ int nWidth, nHeight; /* DIB width and height */ int xScrn, yScrn; /* Screen resolution. */ /* Check for an empty rectangle. */ if (IsRectEmpty(lpRect)) { return NULL; } /* * Create a DC for the screen and create a memory DC compatible to screen * DC. */ hScrDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); hMemDC = CreateCompatibleDC(hScrDC); /* Get points of rectangle to grab. */ nX = lpRect->left; nY = lpRect->top; nX2 = lpRect->right; nY2 = lpRect->bottom; /* Get screen resolution. */ xScrn = GetDeviceCaps(hScrDC, HORZRES); yScrn = GetDeviceCaps(hScrDC, VERTRES); /* Make sure bitmap rectangle is visible. */ if (nX < 0) { nX = 0; } if (nY < 0) { nY = 0; } if (nX2 > xScrn) { nX2 = xScrn; } if (nY2 > yScrn) { nY2 = yScrn; } nWidth = nX2 - nX; nHeight = nY2 - nY; /* Create a bitmap compatible with the screen DC. */ hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight); /* Select new bitmap into memory DC. */ hOldBitmap = SelectObject(hMemDC, hBitmap); /* Bitblt screen DC to memory DC. */ BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY); /* * Select old bitmap back into memory DC and get handle to bitmap of the * screen. */ hBitmap = SelectObject(hMemDC, hOldBitmap); /* Clean up. */ DeleteDC(hScrDC); DeleteDC(hMemDC); /* Return handle to the bitmap. */ return hBitmap; } /* *---------------------------------------------------------------------- * * BitmapToDIB-- * * Converts bitmap to DIB. * * Results: * Bitmap converted. * *---------------------------------------------------------------------- */ static HANDLE BitmapToDIB( HBITMAP hBitmap, HPALETTE hPal) { BITMAP bm; BITMAPINFOHEADER bi; LPBITMAPINFOHEADER lpbi; DWORD dwLen; HANDLE hDIB; HANDLE h; HDC hDC; WORD biBits; /* Check if bitmap handle is valid. */ if (!hBitmap) { return NULL; } /* Fill in BITMAP structure, return NULL if it didn't work. */ if (!GetObjectW(hBitmap, sizeof(bm), (LPWSTR)&bm)) { return NULL; } /* Ff no palette is specified, use default palette. */ if (hPal == NULL) { hPal = GetStockObject(DEFAULT_PALETTE); } /* Calculate bits per pixel. */ biBits = bm.bmPlanes * bm.bmBitsPixel; /* Make sure bits per pixel is valid. */ if (biBits <= 1) { biBits = 1; } else if (biBits <= 4) { biBits = 4; } else if (biBits <= 8) { biBits = 8; } else { /* If greater than 8-bit, force to 24-bit. */ biBits = 24; } /* Initialize BITMAPINFOHEADER. */ bi.biSize = sizeof(BITMAPINFOHEADER); bi.biWidth = bm.bmWidth; bi.biHeight = bm.bmHeight; bi.biPlanes = 1; bi.biBitCount = biBits; bi.biCompression = BI_RGB; bi.biSizeImage = 0; bi.biXPelsPerMeter = 0; bi.biYPelsPerMeter = 0; bi.biClrUsed = 0; bi.biClrImportant = 0; /* Calculate size of memory block required to store BITMAPINFO. */ dwLen = bi.biSize + DIBNumColors(&bi) * sizeof(RGBQUAD); /* Get a DC. */ hDC = GetDC(NULL); /* Select and realize our palette. */ hPal = SelectPalette(hDC, hPal, FALSE); RealizePalette(hDC); /* Alloc memory block to store our bitmap. */ hDIB = GlobalAlloc(GHND, dwLen); /* If we couldn't get memory block. */ if (!hDIB) { /* clean up and return NULL. */ SelectPalette(hDC, hPal, TRUE); RealizePalette(hDC); ReleaseDC(NULL, hDC); return NULL; } /* Lock memory and get pointer to it. */ lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB); /* Use our bitmap info. to fill BITMAPINFOHEADER. */ *lpbi = bi; /* Call GetDIBits with a NULL lpBits param, so it will calculate the * biSizeImage field for us */ GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, NULL, (LPBITMAPINFO)lpbi, DIB_RGB_COLORS); /* get the info. returned by GetDIBits and unlock memory block. */ bi = *lpbi; GlobalUnlock(hDIB); /* If the driver did not fill in the biSizeImage field, make one up. */ if (bi.biSizeImage == 0) { bi.biSizeImage = (((((DWORD)bm.bmWidth * biBits) + 31) / 32) * 4) * bm.bmHeight; } /* Realloc the buffer big enough to hold all the bits. */ dwLen = bi.biSize + DIBNumColors(&bi) * sizeof(RGBQUAD) + bi.biSizeImage; if ((h = GlobalReAlloc(hDIB, dwLen, 0)) != 0) { hDIB = h; } else { /* Clean up and return NULL. */ GlobalFree(hDIB); SelectPalette(hDC, hPal, TRUE); RealizePalette(hDC); ReleaseDC(NULL, hDC); return NULL; } /* Lock memory block and get pointer to it. */ lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB); /* Call GetDIBits with a NON-NULL lpBits param, and actualy get the * bits this time. */ if (GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, (LPSTR)lpbi + (WORD)lpbi->biSize + DIBNumColors(lpbi) * sizeof(RGBQUAD), (LPBITMAPINFO)lpbi, DIB_RGB_COLORS) == 0) { /* Clean up and return NULL. */ GlobalUnlock(hDIB); SelectPalette(hDC, hPal, TRUE); RealizePalette(hDC); ReleaseDC(NULL, hDC); return NULL; } bi = *lpbi; /* Clean up. */ GlobalUnlock(hDIB); SelectPalette(hDC, hPal, TRUE); RealizePalette(hDC); ReleaseDC(NULL, hDC); /* Return handle to the DIB. */ return hDIB; } /* *---------------------------------------------------------------------- * * CopyScreenToDIB-- * * Copies screen to DIB. * * Results: * Screen copied. * *---------------------------------------------------------------------- */ static HANDLE CopyScreenToDIB( LPRECT lpRect) { HBITMAP hBitmap; HPALETTE hPalette; HANDLE hDIB; /* * Get the device-dependent bitmap in lpRect by calling CopyScreenToBitmap * and passing it the rectangle to grab. */ hBitmap = CopyScreenToBitmap(lpRect); /* Check for a valid bitmap handle. */ if (!hBitmap) { return NULL; } /* Get the current palette. */ hPalette = GetSystemPalette(); /* convert the bitmap to a DIB. */ hDIB = BitmapToDIB(hBitmap, hPalette); /* Clean up. */ DeleteObject(hPalette); DeleteObject(hBitmap); /* Return handle to the packed-DIB. */ return hDIB; } /* *---------------------------------------------------------------------- * * GetSystemPalette-- * * Obtains the system palette. * * Results: * Returns palette. * *---------------------------------------------------------------------- */ static HPALETTE GetSystemPalette(void) { HDC hDC; /* Handle to a DC. */ static HPALETTE hPal = NULL; /* Handle to a palette. */ HANDLE hLogPal; /* Handle to a logical palette. */ LPLOGPALETTE lpLogPal; /* Pointer to a logical palette. */ int nColors; /* Number of colors. */ /* Find out how many palette entries we want.. */ hDC = GetDC(NULL); if (!hDC) { return NULL; } nColors = PalEntriesOnDevice(hDC); /* Number of palette entries. */ /* Allocate room for the palette and lock it.. */ hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) + nColors * sizeof(PALETTEENTRY)); if (!hLogPal) { /* If we didn't get a logical palette, return NULL. */ return NULL; } /* get a pointer to the logical palette. */ lpLogPal = (LPLOGPALETTE)GlobalLock(hLogPal); /* Set some important fields. */ lpLogPal->palVersion = 0x300; lpLogPal->palNumEntries = nColors; /* Copy the current system palette into our logical palette. */ GetSystemPaletteEntries(hDC, 0, nColors, (LPPALETTEENTRY) lpLogPal->palPalEntry); /* * Go ahead and create the palette. Once it's created, we no longer need * the LOGPALETTE, so free it. */ hPal = CreatePalette(lpLogPal); /* Clean up. */ GlobalUnlock(hLogPal); GlobalFree(hLogPal); ReleaseDC(NULL, hDC); return hPal; } /* *---------------------------------------------------------------------- * * PalEntriesOnDevice-- * * Returns the palettes on the device. * * Results: * Returns palettes. * *---------------------------------------------------------------------- */ static int PalEntriesOnDevice( HDC hDC) { return (1 << (GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES))); } /* * -------------------------------------------------------------------------- * * Winprint_Init-- * * Initializes printing module on Windows. * * Results: * Module initialized. * * ------------------------------------------------------------------------- */ int Winprint_Init( Tcl_Interp * interp) { size_t i; Tcl_Namespace *namespacePtr; static const char *gdiName = "::tk::print::_gdi"; static const size_t numCommands = sizeof(gdi_commands) / sizeof(struct gdi_command); /* * Set up the low-level [_gdi] command. */ namespacePtr = Tcl_CreateNamespace(interp, gdiName, NULL, (Tcl_NamespaceDeleteProc *) NULL); for (i=0; i<numCommands; i++) { char buffer[100]; sprintf(buffer, "%s::%s", gdiName, gdi_commands[i].command_string); Tcl_CreateCommand(interp, buffer, gdi_commands[i].command, NULL, (Tcl_CmdDeleteProc *) 0); Tcl_Export(interp, namespacePtr, gdi_commands[i].command_string, 0); } Tcl_CreateEnsemble(interp, gdiName, namespacePtr, 0); /* * The other printing-related commands. */ Tcl_CreateObjCommand(interp, "::tk::print::_selectprinter", PrintSelectPrinter, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_openprinter", PrintOpenPrinter, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_closeprinter", PrintClosePrinter, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_opendoc", PrintOpenDoc, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_closedoc", PrintCloseDoc, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_openpage", PrintOpenPage, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_closepage", PrintClosePage, NULL, NULL); return TCL_OK; } /* Print API functions. */ /*---------------------------------------------------------------------- * * PrintSelectPrinter-- * * Main dialog for selecting printer and initializing data for print job. * * Results: * Printer selected. * *---------------------------------------------------------------------- */ static int PrintSelectPrinter( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj* const*)) { LPCWSTR printerName = NULL; PDEVMODEW returnedDevmode = NULL; PDEVMODEW localDevmode = NULL; copies = 0; paper_width = 0; paper_height = 0; dpi_x = 0; dpi_y = 0; /* Set up print dialog and initalize property structure. */ ZeroMemory(&pd, sizeof(pd)); pd.lStructSize = sizeof(pd); pd.hwndOwner = GetDesktopWindow(); pd.Flags = PD_HIDEPRINTTOFILE | PD_DISABLEPRINTTOFILE | PD_NOSELECTION; if (PrintDlgW(&pd) == TRUE) { /*Get document info.*/ ZeroMemory(&di, sizeof(di)); di.cbSize = sizeof(di); di.lpszDocName = L"Tk Print Output"; /* Copy print attributes to local structure. */ returnedDevmode = (PDEVMODEW) GlobalLock(pd.hDevMode); devnames = (LPDEVNAMES) GlobalLock(pd.hDevNames); printerName = (LPCWSTR) devnames + devnames->wDeviceOffset; localDevmode = (LPDEVMODEW) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, returnedDevmode->dmSize); if (localDevmode != NULL) { memcpy((LPVOID)localDevmode, (LPVOID)returnedDevmode, returnedDevmode->dmSize); /* Get values from user-set and built-in properties. */ localPrinterName = localDevmode->dmDeviceName; dpi_y = localDevmode->dmYResolution; dpi_x = localDevmode->dmPrintQuality; /* Convert height and width to logical points. */ paper_height = (int) localDevmode->dmPaperLength / 0.254; paper_width = (int) localDevmode->dmPaperWidth / 0.254; copies = pd.nCopies; /* Set device context here for all GDI printing operations. */ printDC = CreateDCW(L"WINSPOOL", printerName, NULL, localDevmode); } else { localDevmode = NULL; } } if (pd.hDevMode != NULL) { GlobalFree(pd.hDevMode); } /* * Store print properties and link variables so they can be accessed from * script level. */ if (localPrinterName != NULL) { char* varlink1 = (char*)Tcl_Alloc(100 * sizeof(char)); char** varlink2 = (char**)Tcl_Alloc(sizeof(char*)); *varlink2 = varlink1; WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL); Tcl_LinkVar(interp, "::tk::print::printer_name", (char*)varlink2, TCL_LINK_STRING | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::copies", (char*)&copies, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::dpi_x", (char*)&dpi_x, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::dpi_y", (char*)&dpi_y, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::paper_width", (char*)&paper_width, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::paper_height", (char*)&paper_height, TCL_LINK_INT | TCL_LINK_READ_ONLY); } return TCL_OK; } /* * -------------------------------------------------------------------------- * * PrintOpenPrinter-- * * Open the given printer. * * Results: * Opens the selected printer. * * ------------------------------------------------------------------------- */ int PrintOpenPrinter( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, Tcl_Obj *const objv[]) { Tcl_DString ds; if (argc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "printer"); return TCL_ERROR; } /*Start an individual page.*/ if (StartPage(printDC) <= 0) { return TCL_ERROR; } const char *printer = Tcl_GetString(objv[1]); if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } Tcl_DStringInit(&ds); if ((OpenPrinterW(Tcl_UtfToWCharDString(printer, -1, &ds), (LPHANDLE)&printDC, NULL)) == FALSE) { Tcl_AppendResult(interp, "unable to open printer", NULL); Tcl_DStringFree(&ds); return TCL_ERROR; } Tcl_DStringFree(&ds); return TCL_OK; } /* * -------------------------------------------------------------------------- * * PrintClosePrinter-- * * Closes the given printer. * * Results: * Printer closed. * * ------------------------------------------------------------------------- */ int PrintClosePrinter( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } ClosePrinter(printDC); return TCL_OK; } /* * -------------------------------------------------------------------------- * * PrintOpenDoc-- * * Opens the document for printing. * * Results: * Opens the print document. * * ------------------------------------------------------------------------- */ int PrintOpenDoc( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { int output = 0; if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } /* * Start printing. */ output = StartDocW(printDC, &di); if (output <= 0) { Tcl_AppendResult(interp, "unable to start document", NULL); return TCL_ERROR; } return TCL_OK; } /* * -------------------------------------------------------------------------- * * PrintCloseDoc-- * * Closes the document for printing. * * Results: * Closes the print document. * * ------------------------------------------------------------------------- */ int PrintCloseDoc( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } if (EndDoc(printDC) <= 0) { Tcl_AppendResult(interp, "unable to establish close document", NULL); return TCL_ERROR; } DeleteDC(printDC); return TCL_OK; } /* * -------------------------------------------------------------------------- * * PrintOpenPage-- * * Opens a page for printing. * * Results: * Opens the print page. * * ------------------------------------------------------------------------- */ int PrintOpenPage( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } /*Start an individual page.*/ if (StartPage(printDC) <= 0) { Tcl_AppendResult(interp, "unable to start page", NULL); return TCL_ERROR; } return TCL_OK; } /* * -------------------------------------------------------------------------- * * PrintClosePage-- * * Closes the printed page. * * Results: * Closes the page. * * ------------------------------------------------------------------------- */ int PrintClosePage( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } if (EndPage(printDC) <= 0) { Tcl_AppendResult(interp, "unable to close page", NULL); return TCL_ERROR; } return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Added win/tkWinIco.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | /* * tkWinIco.c -- * * This file contains functions for icon-manipulation routines * in Windows. * * Copyright © 1995-1996 Microsoft Corp. * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinIco.h" /* *---------------------------------------------------------------------- * * DIBNumColors -- * * Calculates the number of entries in the color table, given by LPSTR * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code. * * Results: * WORD - Number of entries in the color table. * *---------------------------------------------------------------------- */ static WORD DIBNumColors( LPSTR lpbi) { WORD wBitCount; DWORD dwClrUsed; dwClrUsed = ((LPBITMAPINFOHEADER) lpbi)->biClrUsed; if (dwClrUsed) { return (WORD) dwClrUsed; } wBitCount = ((LPBITMAPINFOHEADER) lpbi)->biBitCount; switch (wBitCount) { case 1: return 2; case 4: return 16; case 8: return 256; default: return 0; } } /* *---------------------------------------------------------------------- * * PaletteSize -- * * Calculates the number of bytes in the color table, as given by LPSTR * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code. * * Results: * Number of bytes in the color table * *---------------------------------------------------------------------- */ static WORD PaletteSize( LPSTR lpbi) { return (WORD) (DIBNumColors(lpbi) * sizeof(RGBQUAD)); } /* *---------------------------------------------------------------------- * * FindDIBits -- * * Locate the image bits in a CF_DIB format DIB, as given by LPSTR lpbi - * pointer to the CF_DIB memory block. Used by titlebar icon code. * * Results: * pointer to the image bits * * Side effects: None * * *---------------------------------------------------------------------- */ LPSTR FindDIBBits( LPSTR lpbi) { return lpbi + *((LPDWORD) lpbi) + PaletteSize(lpbi); } /* *---------------------------------------------------------------------- * * BytesPerLine -- * * Calculates the number of bytes in one scan line, as given by * LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER that * begins the CF_DIB block. Used by titlebar icon code. * * Results: * number of bytes in one scan line (DWORD aligned) * *---------------------------------------------------------------------- */ DWORD BytesPerLine( LPBITMAPINFOHEADER lpBMIH) { return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount); } /* *---------------------------------------------------------------------- * * CreateIcoFromPhoto -- * * Create ico pointer from Tk photo block. * * Results: * Icon image is created from a valid Tk photo image. * * Side effects: * Icon is created. * *---------------------------------------------------------------------- */ HICON CreateIcoFromPhoto( int width, /* Width of image. */ int height, /* Height of image. */ Tk_PhotoImageBlock block) /* Image block to convert. */ { int idx, bufferSize; union {unsigned char *ptr; void *voidPtr;} bgraPixel; union {unsigned char *ptr; void *voidPtr;} bgraMask; HICON hIcon; BITMAPINFO bmInfo; ICONINFO iconInfo; /* * Don't use CreateIcon to create the icon, as it requires color * bitmap data in device-dependent format. Instead we use * CreateIconIndirect which takes device-independent bitmaps and * converts them as required. Initialise icon info structure. */ ZeroMemory(&iconInfo, sizeof(iconInfo)); iconInfo.fIcon = TRUE; /* * Create device-independent color bitmap. */ ZeroMemory(&bmInfo, sizeof bmInfo); bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmInfo.bmiHeader.biWidth = width; bmInfo.bmiHeader.biHeight = -height; bmInfo.bmiHeader.biPlanes = 1; bmInfo.bmiHeader.biBitCount = 32; bmInfo.bmiHeader.biCompression = BI_RGB; iconInfo.hbmColor = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS, &bgraPixel.voidPtr, NULL, 0); if (!iconInfo.hbmColor) { return NULL; } /* * Convert the photo image data into BGRA format (RGBQUAD). */ bufferSize = height * width * 4; for (idx = 0 ; idx < bufferSize ; idx += 4) { bgraPixel.ptr[idx] = block.pixelPtr[idx+2]; bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1]; bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0]; bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3]; } /* * Create a dummy mask bitmap. The contents of this don't appear to * matter, as CreateIconIndirect will setup the icon mask based on the * alpha channel in our color bitmap. */ bmInfo.bmiHeader.biBitCount = 1; iconInfo.hbmMask = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS, &bgraMask.voidPtr, NULL, 0); if (!iconInfo.hbmMask) { DeleteObject(iconInfo.hbmColor); return NULL; } ZeroMemory(bgraMask.ptr, width*height/8); /* * Create an icon from the bitmaps. */ hIcon = CreateIconIndirect(&iconInfo); DeleteObject(iconInfo.hbmColor); DeleteObject(iconInfo.hbmMask); if (hIcon == NULL) { return NULL; } return hIcon; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Added win/tkWinIco.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | /* * tkWinIco.h -- * * This file contains declarations for icon-manipulation routines * in Windows. * * Copyright © 1995-1996 Microsoft Corp. * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWin.h" #include <windows.h> #include <shellapi.h> /* * These structures represent the contents of a icon, in terms of its image * or resource. */ typedef struct { UINT Width, Height, Colors; /* Width, Height and bpp */ LPBYTE lpBits; /* Ptr to DIB bits */ DWORD dwNumBytes; /* How many bytes? */ LPBITMAPINFO lpbi; /* Ptr to header */ LPBYTE lpXOR; /* Ptr to XOR image bits */ LPBYTE lpAND; /* Ptr to AND image bits */ HICON hIcon; /* DAS ICON */ } ICONIMAGE, *LPICONIMAGE; typedef struct { BOOL bHasChanged; // Has image changed? TCHAR szOriginalICOFileName[MAX_PATH]; // Original name TCHAR szOriginalDLLFileName[MAX_PATH]; // Original name int nNumImages; // How many images? ICONIMAGE IconImages[1]; // Image entries } ICONRESOURCE, *LPICONRESOURCE; /* * This structure is how we represent a block of the above items. We will * reallocate these structures according to how many images they need to * contain. */ typedef struct { int nNumImages; /* How many images? */ ICONIMAGE IconImages[1]; /* Image entries */ } BlockOfIconImages, *BlockOfIconImagesPtr; /* * These two structures are used to read in icons from an 'icon directory' * (i.e. the contents of a .icr file, say). We only use these structures * temporarily, since we copy the information we want into a * BlockOfIconImages. */ typedef struct { BYTE bWidth; /* Width of the image */ BYTE bHeight; /* Height of the image (times 2) */ BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */ BYTE bReserved; /* Reserved */ WORD wPlanes; /* Color Planes */ WORD wBitCount; /* Bits per pixel */ DWORD dwBytesInRes; /* How many bytes in this resource? */ DWORD dwImageOffset; /* Where in the file is this image */ } ICONDIRENTRY, *LPICONDIRENTRY; typedef struct { WORD idReserved; /* Reserved */ WORD idType; /* Resource type (1 for icons) */ WORD idCount; /* How many images? */ ICONDIRENTRY idEntries[1]; /* The entries for each image */ } ICONDIR, *LPICONDIR; /* * Used in BytesPerLine */ #define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2) /* * The following are implemented in tkWinIco.c and also used in tkWinWm.c and tkWinSysTray.c. */ DWORD BytesPerLine(LPBITMAPINFOHEADER lpBMIH); LPSTR FindDIBBits(LPSTR lpbi); HICON CreateIcoFromPhoto(int width, int height, Tk_PhotoImageBlock block); /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to win/tkWinImage.c.
1 2 3 4 5 | /* * tkWinImage.c -- * * This file contains routines for manipulation full-color images. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkWinImage.c -- * * This file contains routines for manipulation full-color images. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ | |||
273 274 275 276 277 278 279 | * Returns a newly allocated image containing the data from the given * rectangle of the given drawable. * * Side effects: * None. * * This procedure is adapted from the XGetImage implementation in TkNT. That | | | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | * Returns a newly allocated image containing the data from the given * rectangle of the given drawable. * * Side effects: * None. * * This procedure is adapted from the XGetImage implementation in TkNT. That * code is Copyright © 1994 Software Research Associates, Inc. * *---------------------------------------------------------------------- */ static XImage * XGetImageZPixmap( Display *display, |
︙ | ︙ |
Changes to win/tkWinInit.c.
1 2 3 4 5 6 | /* * tkWinInit.c -- * * This file contains Windows-specific interpreter initialization * functions. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinInit.c -- * * This file contains Windows-specific interpreter initialization * functions. * * Copyright © 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ | |||
31 32 33 34 35 36 37 | *---------------------------------------------------------------------- */ int TkpInit( Tcl_Interp *interp) { | < | > > > > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | *---------------------------------------------------------------------- */ int TkpInit( Tcl_Interp *interp) { /* * This is necessary for static initialization, and is ok otherwise * because TkWinXInit flips a static bit to do its work just once. Also, * initialize printing and systray API's here. */ WinIcoInit(interp); Winprint_Init(interp); TkWinXInit(Tk_GetHINSTANCE()); Icu_Init(interp); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpGetAppName -- |
︙ | ︙ | |||
64 65 66 67 68 69 70 | */ void TkpGetAppName( Tcl_Interp *interp, Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */ { | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | */ void TkpGetAppName( Tcl_Interp *interp, Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */ { TkSizeT argc, namelength; const char **argv = NULL, *name, *p; name = Tcl_GetVar2(interp, "argv0", NULL, TCL_GLOBAL_ONLY); namelength = -1; if (name != NULL) { Tcl_SplitPath(name, &argc, &argv); if (argc > 0) { |
︙ | ︙ | |||
120 121 122 123 124 125 126 | #define TK_MAX_WARN_LEN 1024 WCHAR titleString[TK_MAX_WARN_LEN]; WCHAR *msgString; /* points to titleString, just after title, leaving space for ": " */ int len; /* size of title, including terminating NULL */ /* If running on Cygwin and we have a stderr channel, use it. */ #if !defined(STATIC_BUILD) | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #define TK_MAX_WARN_LEN 1024 WCHAR titleString[TK_MAX_WARN_LEN]; WCHAR *msgString; /* points to titleString, just after title, leaving space for ": " */ int len; /* size of title, including terminating NULL */ /* If running on Cygwin and we have a stderr channel, use it. */ #if !defined(STATIC_BUILD) if (tclStubsPtr->tcl_CreateFileHandler) { Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR); if (errChannel) { Tcl_WriteChars(errChannel, title, -1); Tcl_WriteChars(errChannel, ": ", 2); Tcl_WriteChars(errChannel, msg, -1); Tcl_WriteChars(errChannel, "\n", 1); return; |
︙ | ︙ |
Changes to win/tkWinInt.h.
1 2 3 4 5 6 7 | /* * tkWinInt.h -- * * This file contains declarations that are shared among the * Windows-specific parts of Tk, but aren't used by the rest of Tk. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkWinInt.h -- * * This file contains declarations that are shared among the * Windows-specific parts of Tk, but aren't used by the rest of Tk. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKWININT #define _TKWININT |
︙ | ︙ | |||
210 211 212 213 214 215 216 217 218 219 220 221 222 223 | /* * The following is implemented in tkWinPointer.c and also used in tkWinWindow.c */ MODULE_SCOPE void TkSetCursorPos(int x, int y); /* * Common routines used in Windows implementation */ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError); /* | > > > > > > > > > > > > > > > > > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | /* * The following is implemented in tkWinPointer.c and also used in tkWinWindow.c */ MODULE_SCOPE void TkSetCursorPos(int x, int y); /* * The following is implemented in tkWinSysTray.c */ MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp); /* * The following is implemented in tkWinGDI.c */ MODULE_SCOPE int Winprint_Init(Tcl_Interp* interp); /* * The following is implemented in tkWinSysTray.c */ MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp); /* * Common routines used in Windows implementation */ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError); /* |
︙ | ︙ |
Changes to win/tkWinKey.c.
1 2 3 4 5 6 | /* * tkWinKey.c -- * * This file contains X emulation routines for keyboard related * functions. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinKey.c -- * * This file contains X emulation routines for keyboard related * functions. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "X11/XF86keysym.h" |
︙ | ︙ | |||
40 41 42 43 44 45 46 | NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*55 0x37*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*60 0x3C*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*65 0x41*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*70 0x46*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*75 0x4B*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*80 0x50*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*85 0x55*/ | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*55 0x37*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*60 0x3C*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*65 0x41*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*70 0x46*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*75 0x4B*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*80 0x50*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*85 0x55*/ NoSymbol, XK_Super_L, XK_Super_R, XK_Menu, NoSymbol, /*90 0x5A*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*95 0x5F*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*100 0x64*/ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*105 0x69*/ NoSymbol, NoSymbol, XK_F1, XK_F2, XK_F3, /*110 0x6E*/ XK_F4, XK_F5, XK_F6, XK_F7, XK_F8, /*115 0x73*/ XK_F9, XK_F10, XK_F11, XK_F12, XK_F13, /*120 0x78*/ XK_F14, XK_F15, XK_F16, XK_F17, XK_F18, /*125 0x7D*/ |
︙ | ︙ | |||
86 87 88 89 90 91 92 | * None. * *---------------------------------------------------------------------- */ const char * TkpGetString( | | < | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | * None. * *---------------------------------------------------------------------- */ const char * TkpGetString( TCL_UNUSED(TkWindow *), /* Window where event occurred: needed to get * input context. */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Uninitialized or empty string to hold * result. */ { XKeyEvent *keyEv = &eventPtr->xkey; int len; char buf[6]; Tcl_DStringInit(dsPtr); if (keyEv->send_event == -1) { TkKeyEvent *ev = (TkKeyEvent *)keyEv; if (ev->nbytes > 0) { (void)Tcl_ExternalToUtfDStringEx(TkWinGetKeyInputEncoding(), ev->trans_chars, ev->nbytes, TCL_ENCODING_NOCOMPLAIN, dsPtr); } } else if (keyEv->send_event == -3) { /* * Special case for WM_UNICHAR and win2000 multilingual IME input */ |
︙ | ︙ | |||
148 149 150 151 152 153 154 | * None. * *---------------------------------------------------------------------- */ KeySym XKeycodeToKeysym( | | < | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | * None. * *---------------------------------------------------------------------- */ KeySym XKeycodeToKeysym( TCL_UNUSED(Display *), unsigned int keycode, int index) { int state = 0; if (index & 0x01) { state |= ShiftMask; } return KeycodeToKeysym(keycode, state, 0); } |
︙ | ︙ | |||
564 565 566 567 568 569 570 | * When mapping from a keysym to a keycode, need information about the * modifier state that should be used so that when they call XkbKeycodeToKeysym * taking into account the xkey.state, they will get back the original keysym. */ void TkpSetKeycodeAndState( | | < | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | * When mapping from a keysym to a keycode, need information about the * modifier state that should be used so that when they call XkbKeycodeToKeysym * taking into account the xkey.state, they will get back the original keysym. */ void TkpSetKeycodeAndState( TCL_UNUSED(Tk_Window), KeySym keySym, XEvent *eventPtr) { int i; SHORT result; int shift; eventPtr->xkey.keycode = 0; if (keySym == NoSymbol) { return; } /* |
︙ | ︙ | |||
623 624 625 626 627 628 629 | * None. * *---------------------------------------------------------------------- */ KeyCode XKeysymToKeycode( | | < | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | * None. * *---------------------------------------------------------------------- */ KeyCode XKeysymToKeycode( TCL_UNUSED(Display *), KeySym keysym) { int i; SHORT result; /* * We check our private map first for a virtual keycode, as VkKeyScan will * return values that don't map to X for the "extended" Syms. This may be * due to just casting problems below, but this works. */ |
︙ | ︙ | |||
672 673 674 675 676 677 678 | * Allocates a new modifier map data structure. * *---------------------------------------------------------------------- */ XModifierKeymap * XGetModifierMapping( | | < | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | * Allocates a new modifier map data structure. * *---------------------------------------------------------------------- */ XModifierKeymap * XGetModifierMapping( TCL_UNUSED(Display *)) { XModifierKeymap *map = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap)); map->max_keypermod = 1; map->modifiermap = (KeyCode *)ckalloc(sizeof(KeyCode) * 8); map->modifiermap[ShiftMapIndex] = VK_SHIFT; map->modifiermap[LockMapIndex] = VK_CAPITAL; map->modifiermap[ControlMapIndex] = VK_CONTROL; map->modifiermap[Mod1MapIndex] = VK_NUMLOCK; |
︙ | ︙ | |||
734 735 736 737 738 739 740 | * None. * *---------------------------------------------------------------------- */ KeySym XStringToKeysym( | | < < | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | * None. * *---------------------------------------------------------------------- */ KeySym XStringToKeysym( TCL_UNUSED(_Xconst char *)) { return NoSymbol; } /* *---------------------------------------------------------------------- * * XKeysymToString -- |
︙ | ︙ | |||
759 760 761 762 763 764 765 | * None. * *---------------------------------------------------------------------- */ char * XKeysymToString( | | < < | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | * None. * *---------------------------------------------------------------------- */ char * XKeysymToString( TCL_UNUSED(KeySym)) { return NULL; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to win/tkWinMenu.c.
1 2 3 4 5 6 | /* * tkWinMenu.c -- * * This module implements the Windows platform-specific features of * menus. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkWinMenu.c -- * * This module implements the Windows platform-specific features of * menus. * * Copyright © 1996-1998 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #define OEMRESOURCE #include "tkWinInt.h" |
︙ | ︙ | |||
507 508 509 510 511 512 513 | int i; const char *label = (mePtr->labelPtr == NULL) ? "" : Tcl_GetString(mePtr->labelPtr); const char *accel = ((menuPtr->menuType == MENUBAR) || (mePtr->accelPtr == NULL)) ? "" : Tcl_GetString(mePtr->accelPtr); const char *p, *next; Tcl_DString itemString; | | | > | | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | int i; const char *label = (mePtr->labelPtr == NULL) ? "" : Tcl_GetString(mePtr->labelPtr); const char *accel = ((menuPtr->menuType == MENUBAR) || (mePtr->accelPtr == NULL)) ? "" : Tcl_GetString(mePtr->accelPtr); const char *p, *next; Tcl_DString itemString; Tcl_UniChar ch = 0; /* * We have to construct the string with an ampersand preceeding the * underline character, and a tab seperating the text and the accel * text. We have to be careful with ampersands in the string. */ Tcl_DStringInit(&itemString); for (p = label, i = 0; *p != '\0'; i++, p = next) { if (i == mePtr->underline) { Tcl_DStringAppend(&itemString, "&", 1); } if (*p == '&') { Tcl_DStringAppend(&itemString, "&", 1); } next = p + Tcl_UtfToUniChar(p, &ch); Tcl_DStringAppend(&itemString, p, (int) (next - p)); } ch = 0; if (mePtr->accelLength > 0) { Tcl_DStringAppend(&itemString, "\t", 1); for (p = accel, i = 0; *p != '\0'; i++, p = next) { if (*p == '&') { Tcl_DStringAppend(&itemString, "&", 1); } next = p + Tcl_UtfToUniChar(p, &ch); Tcl_DStringAppend(&itemString, p, (int) (next - p)); } } itemText = (char *)ckalloc(Tcl_DStringLength(&itemString) + 1); strcpy(itemText, Tcl_DStringValue(&itemString)); Tcl_DStringFree(&itemString); |
︙ | ︙ | |||
877 878 879 880 881 882 883 | int x, int y, int index) /* The root X,Y coordinates where we are * posting */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; (void)dummy; | < < < < < < < | > > > > > > > > > > > > | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | int x, int y, int index) /* The root X,Y coordinates where we are * posting */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; (void)dummy; TkActivateMenuEntry(menuPtr, -1); TkRecomputeMenu(menuPtr); result = TkPostCommand(menuPtr); if (result != TCL_OK) { return result; } /* * The post commands could have deleted the menu, which means we are dead * and should go away. */ if (menuPtr->tkwin == NULL) { return TCL_OK; } /* * Adjust the menu y position so that the specified entry will be located * at the given coordinates. */ if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { y -= menuPtr->entries[index]->y; } /* * Adjust the position of the menu if necessary to keep it visible on the * screen. There are two special tricks to make this work right: * * 1. If a virtual root window manager is being used then the coordinates * are in the virtual root window of menuPtr's parent; since the menu * uses override-redirect mode it will be in the *real* root window for * the screen, so we have to map the coordinates from the virtual root |
︙ | ︙ | |||
1271 1272 1273 1274 1275 1276 1277 | for (i = 0; i < menuPtr->numEntries; i++) { underline = menuPtr->entries[i]->underline; labelPtr = menuPtr->entries[i]->labelPtr; if ((underline >= 0) && (labelPtr != NULL)) { /* * Ensure we don't exceed the label length, then check */ | | | 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | for (i = 0; i < menuPtr->numEntries; i++) { underline = menuPtr->entries[i]->underline; labelPtr = menuPtr->entries[i]->labelPtr; if ((underline >= 0) && (labelPtr != NULL)) { /* * Ensure we don't exceed the label length, then check */ const char *src = Tcl_GetStringFromObj(labelPtr, &len); Tcl_DStringFree(&ds); Tcl_DStringInit(&ds); wlabel = Tcl_UtfToWCharDString(src, len, &ds); if (((TkSizeT)underline + 1 < len + 1) && (menuChar == Tcl_UniCharToUpper(wlabel[underline]))) { *plResult = (2 << 16) | i; |
︙ | ︙ | |||
1535 1536 1537 1538 1539 1540 1541 | TkWinSetMenu(tkwin, NULL); } } /* *---------------------------------------------------------------------- * | | | | 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | TkWinSetMenu(tkwin, NULL); } } /* *---------------------------------------------------------------------- * * Tk_SetMainMenubar -- * * Puts the menu associated with a window into the menubar. Should only * be called when the window is in front. * * Results: * None. * * Side effects: * The menubar is changed. * *---------------------------------------------------------------------- */ void Tk_SetMainMenubar( Tcl_Interp *interp, /* The interpreter of the application */ Tk_Window tkwin, /* The frame we are setting up */ const char *menuName) /* The name of the menu to put in front. If * NULL, use the default menu bar. */ { (void)interp; (void)tkwin; |
︙ | ︙ |
Changes to win/tkWinPixmap.c.
1 2 3 4 5 6 | /* * tkWinPixmap.c -- * * This file contains the Xlib emulation functions pertaining to creating * and destroying pixmaps. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinPixmap.c -- * * This file contains the Xlib emulation functions pertaining to creating * and destroying pixmaps. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ |
Changes to win/tkWinPointer.c.
1 2 3 4 5 | /* * tkWinPointer.c -- * * Windows specific mouse tracking code. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinPointer.c -- * * Windows specific mouse tracking code. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ | |||
238 239 240 241 242 243 244 | ClientData dummy) { POINT pos; (void)dummy; mouseTimerSet = 0; | < < < < < | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | ClientData dummy) { POINT pos; (void)dummy; mouseTimerSet = 0; GetCursorPos(&pos); TkWinPointerEvent(NULL, pos.x, pos.y); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
377 378 379 380 381 382 383 384 385 386 387 388 389 390 | void TkSetCursorPos( int x, int y) { INPUT input; int xscreen = (int)(GetSystemMetrics(SM_CXSCREEN) - 1); int yscreen = (int)(GetSystemMetrics(SM_CYSCREEN) - 1); input.type = INPUT_MOUSE; input.mi.dx = (x * 65535 + xscreen/2) / xscreen; input.mi.dy = (y * 65535 + yscreen/2) / yscreen; /* * Horrible workaround here. There is a bug on Win 10: when warping to | > > > > > > > > > > > | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | void TkSetCursorPos( int x, int y) { INPUT input; int xscreen = (int)(GetSystemMetrics(SM_CXSCREEN) - 1); int yscreen = (int)(GetSystemMetrics(SM_CYSCREEN) - 1); /* * A multi-screen system may have different logical pixels/inch, with * Windows applying behind-the-scenes scaling on secondary screens. * Don't try and emulate that, instead fall back to SetCursor if the * requested position is off the primary screen. */ if ( x < 0 || x > xscreen || y < 0 || y > yscreen ) { SetCursorPos(x, y); return; } input.type = INPUT_MOUSE; input.mi.dx = (x * 65535 + xscreen/2) / xscreen; input.mi.dy = (y * 65535 + yscreen/2) / yscreen; /* * Horrible workaround here. There is a bug on Win 10: when warping to |
︙ | ︙ |
Changes to win/tkWinPort.h.
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 | #define REDO_KEYSYM_LOOKUP /* * See ticket [916c1095438eae56]: GetVersionExW triggers warnings */ #if defined(_MSC_VER) # pragma warning(disable:4146) # pragma warning(disable:4267) # pragma warning(disable:4244) # pragma warning(disable:4311) # pragma warning(disable:4312) # pragma warning(disable:4996) #if !defined(_WIN64) | > | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #define REDO_KEYSYM_LOOKUP /* * See ticket [916c1095438eae56]: GetVersionExW triggers warnings */ #if defined(_MSC_VER) # pragma warning(disable:4090) /* see: https://developercommunity.visualstudio.com/t/c-compiler-incorrect-propagation-of-const-qualifie/390711 */ # pragma warning(disable:4146) # pragma warning(disable:4267) # pragma warning(disable:4244) # pragma warning(disable:4311) # pragma warning(disable:4312) # pragma warning(disable:4996) #if !defined(_WIN64) |
︙ | ︙ | |||
120 121 122 123 124 125 126 | /* * The following Tk functions are implemented as macros under Windows. */ #define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \ | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) | < < < < < < | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | /* * The following Tk functions are implemented as macros under Windows. */ #define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \ | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) /* * These calls implement native bitmaps which are not currently * supported under Windows. The macros eliminate the calls. */ #define TkpDefineNativeBitmaps() #define TkpCreateNativeBitmap(display, source) None #define TkpGetNativeAppBitmap(display, name, w, h) None #endif /* _WINPORT */ |
Changes to win/tkWinRegion.c.
1 2 3 4 5 | /* * tkWinRegion.c -- * * Tk Region emulation code. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkWinRegion.c -- * * Tk Region emulation code. * * Copyright © 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ |
Changes to win/tkWinScrlbr.c.
1 2 3 4 5 6 | /* * tkWinScrollbar.c -- * * This file implements the Windows specific portion of the scrollbar * widget. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinScrollbar.c -- * * This file implements the Windows specific portion of the scrollbar * widget. * * Copyright © 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tkScrollbar.h" |
︙ | ︙ |
Changes to win/tkWinSend.c.
1 2 3 4 5 6 | /* * tkWinSend.c -- * * This file provides functions that implement the "send" command, * allowing commands to be passed from interpreter to interpreter. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkWinSend.c -- * * This file provides functions that implement the "send" command, * allowing commands to be passed from interpreter to interpreter. * * Copyright © 1997 Sun Microsystems, Inc. * Copyright © 2003 Pat Thoyts <[email protected]> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkWinSendCom.h" |
︙ | ︙ |
Changes to win/tkWinSendCom.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * We implement a COM class for use in registering Tcl interpreters with the * system's Running Object Table. This class implements an IDispatch interface * with the following method: * Send(String cmd) As String * In other words the Send methods takes a string and evaluates this in the * Tcl interpreter. The result is returned as another string. * | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * We implement a COM class for use in registering Tcl interpreters with the * system's Running Object Table. This class implements an IDispatch interface * with the following method: * Send(String cmd) As String * In other words the Send methods takes a string and evaluates this in the * Tcl interpreter. The result is returned as another string. * * Copyright © 2002 Pat Thoyts <[email protected]> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkWinSendCom.h" |
︙ | ︙ |
Changes to win/tkWinSendCom.h.
1 2 3 4 5 6 7 | /* * tkWinSendCom.h -- * * This file provides procedures that implement the Windows "send" * command, allowing commands to be passed from interpreter to * interpreter. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkWinSendCom.h -- * * This file provides procedures that implement the Windows "send" * command, allowing commands to be passed from interpreter to * interpreter. * * Copyright © 2002 Pat Thoyts <[email protected]> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _tkWinSendCom_h_INCLUDE #define _tkWinSendCom_h_INCLUDE |
︙ | ︙ |
Added win/tkWinSysTray.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | /* * tkWinSysTray.c -- * * tkWinSysTray.c implements a "systray" Tcl command which permits to * change the system tray/taskbar icon of a Tk toplevel window and * a "sysnotify" command to post system notifications. * * Copyright © 1995-1996 Microsoft Corp. * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany * Copyright © 2020 Kevin Walzer/WordTech Communications LLC. * Copyright © 2020 Eric Boudaillier. * Copyright © 2020 Francois Vogel. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include <windows.h> #include <shellapi.h> #include "tkWin.h" #include "tkWinInt.h" #include "tkWinIco.h" /* * Based extensively on the winico extension and sample code from Microsoft. * Some of the code was adapted into tkWinWM.c to implement the "wm iconphoto" * command (TIP 159), and here we are borrowing that code to use Tk images * to create system tray icons instead of ico files. Additionally, we are * removing obsolete parts of the winico extension, and implementing * more of the Shell_Notification API to add balloon/system notifications. */ #define GETHINSTANCE Tk_GetHINSTANCE() #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_STDINT_H #include <stdint.h> #endif #ifdef _MSC_VER /* * Earlier versions of MSVC don't know snprintf, but _snprintf is compatible. * Note that sprintf is deprecated. */ # define snprintf _snprintf #endif typedef struct IcoInfo { HICON hIcon; /* icon handle returned by LoadIcon. */ unsigned id; /* Identifier for command; used to * cancel it. */ Tcl_Obj *taskbar_txt; /* text to display in the taskbar */ Tcl_Interp *interp; /* interp which created the icon */ Tcl_Obj *taskbar_command; /* command to eval if events in the taskbar * arrive */ int taskbar_flags; /* taskbar related flags*/ HWND hwndFocus; struct IcoInfo *nextPtr; } IcoInfo; /* Per-interp struture */ typedef struct IcoInterpInfo { HWND hwnd; /* Handler window */ int counter; /* Counter for IcoInfo id generation */ IcoInfo *firstIcoPtr; /* List of created IcoInfo */ struct IcoInterpInfo *nextPtr; } IcoInterpInfo; #define TASKBAR_ICON 1 #define ICON_MESSAGE WM_USER + 1234 #define HANDLER_CLASS "Wtk_TaskbarHandler" static HWND CreateTaskbarHandlerWindow(void); static IcoInterpInfo *firstIcoInterpPtr = NULL; static Tk_EventProc WinIcoDestroy; /* * If someone wants to see the several masks somewhere on the screen... * set the ICO_DRAW define and feel free to make some Tcl commands * for accessing it. The normal drawing of an Icon to a DC is really easy: * DrawIcon(hdc,x,y,hIcon) or , more complicated * DrawIconEx32PlusMoreParameters ... */ /* #define ICO_DRAW */ #ifdef ICO_DRAW #define RectWidth(r)((r).right - (r).left + 1) #define RectHeight(r)((r).bottom - (r).top + 1) /* *---------------------------------------------------------------------- * * DrawXORMask -- * * Using DIB functions, draw XOR mask on hDC in Rect. * * Results: * Icon is rendered. * * Side effects: * None. * *---------------------------------------------------------------------- */ static BOOL DrawXORMask( HDC hDC, RECT Rect, LPLPICONIMAGE lpIcon) { int x, y; /* Sanity checks */ if (lpIcon == NULL) return FALSE; if (lpIcon->lpBits == NULL) return FALSE; /* Account for height*2 thing */ lpIcon->lpbi->bmiHeader.biHeight /= 2; /* Locate it */ x = Rect.left + ((RectWidth(Rect) - lpIcon->lpbi->bmiHeader.biWidth) / 2); y = Rect.top + ((RectHeight(Rect) - lpIcon->lpbi->bmiHeader.biHeight) / 2); /* Blast it to the screen */ SetDIBitsToDevice(hDC, x, y, lpIcon->lpbi->bmiHeader.biWidth, lpIcon->lpbi->bmiHeader.biHeight, 0, 0, 0, lpIcon->lpbi->bmiHeader.biHeight, lpIcon->lpXOR, lpIcon->lpbi, DIB_RGB_COLORS); /* UnAccount for height*2 thing */ lpIcon->lpbi->bmiHeader.biHeight *= 2; return TRUE; } /* *---------------------------------------------------------------------- * * DrawANDMask -- * * Using DIB functions, draw AND mask on hDC in Rect. * * Results: * Icon is rendered. * * Side effects: * None. * *---------------------------------------------------------------------- */ BOOL DrawANDMask( HDC hDC, RECT Rect, LPLPICONIMAGE lpIcon) { LPBITMAPINFO lpbi; int x, y; /* Sanity checks */ if (lpIcon == NULL) return FALSE; if (lpIcon->lpBits == NULL) return FALSE; /* Need a bitmap header for the mono mask */ lpbi = ckalloc(sizeof(BITMAPINFO) + (2 * sizeof(RGBQUAD))); lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); lpbi->bmiHeader.biWidth = lpIcon->lpbi->bmiHeader.biWidth; lpbi->bmiHeader.biHeight = lpIcon->lpbi->bmiHeader.biHeight / 2; lpbi->bmiHeader.biPlanes = 1; lpbi->bmiHeader.biBitCount = 1; lpbi->bmiHeader.biCompression = BI_RGB; lpbi->miHeader.biSizeImage = 0; lpbi->bmiHeader.biXPelsPerMeter = 0; lpbi->bmiHeader.biYPelsPerMeter = 0; lpbi->bmiHeader.biClrUsed = 0; lpbi->bmiHeader.biClrImportant = 0; lpbi->bmiColors[0].rgbRed = 0; lpbi->bmiColors[0].rgbGreen = 0; lpbi->bmiColors[0].rgbBlue = 0; lpbi->bmiColors[0].rgbReserved = 0; lpbi->bmiColors[1].rgbRed = 255; lpbi->bmiColors[1].rgbGreen = 255; lpbi->bmiColors[1].rgbBlue = 255; lpbi->bmiColors[1].rgbReserved = 0; /* Locate it */ x = Rect.left + ((RectWidth(Rect) - lpbi->bmiHeader.biWidth) / 2); y = Rect.top + ((RectHeight(Rect) - lpbi->bmiHeader.biHeight) / 2); /* Blast it to the screen */ SetDIBitsToDevice(hDC, x, y, lpbi->bmiHeader.biWidth, lpbi->bmiHeader.biHeight, 0, 0, 0, lpbi->bmiHeader.biHeight, lpIcon->lpAND, lpbi, DIB_RGB_COLORS); /* clean up */ ckfree((char *) lpbi); return TRUE; } #endif /* ICO_DRAW */ /* *---------------------------------------------------------------------- * * TaskbarOperation -- * * Management of icon display. * * Results: * Icon is displayed or deleted. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int TaskbarOperation( IcoInterpInfo *icoInterpPtr, IcoInfo *icoPtr, int oper) { NOTIFYICONDATAW ni; WCHAR *str; ni.cbSize = sizeof(NOTIFYICONDATAW); ni.hWnd = icoInterpPtr->hwnd; ni.uID = icoPtr->id; ni.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE; ni.uCallbackMessage = ICON_MESSAGE; ni.hIcon = icoPtr->hIcon; if (icoPtr->taskbar_txt != NULL) { Tcl_DString dst; Tcl_DStringInit(&dst); str = (WCHAR *)Tcl_UtfToWCharDString(Tcl_GetString(icoPtr->taskbar_txt), -1, &dst); wcsncpy(ni.szTip, str, (Tcl_DStringLength(&dst) + 2) / 2); Tcl_DStringFree(&dst); } else { ni.szTip[0] = 0; } if (Shell_NotifyIconW(oper, &ni) == 1) { if (oper == NIM_ADD || oper == NIM_MODIFY) { icoPtr->taskbar_flags |= TASKBAR_ICON; } if (oper == NIM_DELETE) { icoPtr->taskbar_flags &= ~TASKBAR_ICON; } } /* Silently ignore error? */ return TCL_OK; } /* *---------------------------------------------------------------------- * * NewIcon -- * * Create icon for display in system tray. * * Results: * Icon is created for display. * * Side effects: * None. * *---------------------------------------------------------------------- */ static IcoInfo * NewIcon( Tcl_Interp *interp, IcoInterpInfo *icoInterpPtr, HICON hIcon) { IcoInfo *icoPtr; icoPtr = (IcoInfo *)ckalloc(sizeof(IcoInfo)); memset(icoPtr, 0, sizeof(IcoInfo)); icoPtr->id = ++icoInterpPtr->counter; icoPtr->hIcon = hIcon; icoPtr->taskbar_txt = NULL; icoPtr->interp = interp; icoPtr->taskbar_command = NULL; icoPtr->taskbar_flags = 0; icoPtr->hwndFocus = NULL; icoPtr->nextPtr = icoInterpPtr->firstIcoPtr; icoInterpPtr->firstIcoPtr = icoPtr; return icoPtr; } /* *---------------------------------------------------------------------- * * FreeIcoPtr -- * * Delete icon and free memory. * * Results: * Icon is removed from display. * * Side effects: * Memory/resources freed. * *---------------------------------------------------------------------- */ static void FreeIcoPtr( IcoInterpInfo *icoInterpPtr, IcoInfo *icoPtr) { IcoInfo *prevPtr; if (icoInterpPtr->firstIcoPtr == icoPtr) { icoInterpPtr->firstIcoPtr = icoPtr->nextPtr; } else { for (prevPtr = icoInterpPtr->firstIcoPtr; prevPtr->nextPtr != icoPtr; prevPtr = prevPtr->nextPtr) { /* Empty loop body. */ } prevPtr->nextPtr = icoPtr->nextPtr; } if (icoPtr->taskbar_flags & TASKBAR_ICON) { TaskbarOperation(icoInterpPtr, icoPtr, NIM_DELETE); } if (icoPtr->taskbar_txt != NULL) { Tcl_DecrRefCount(icoPtr->taskbar_txt); } if (icoPtr->taskbar_command != NULL) { Tcl_DecrRefCount(icoPtr->taskbar_command); } ckfree(icoPtr); } /* *---------------------------------------------------------------------- * * GetIcoPtr -- * * Get pointer to icon for display. * * Results: * Icon is obtained for display. * * Side effects: * None. * *---------------------------------------------------------------------- */ static IcoInfo * GetIcoPtr( Tcl_Interp *interp, IcoInterpInfo *icoInterpPtr, const char *string) { IcoInfo *icoPtr; unsigned id; const char *start; char *end; if (strncmp(string, "ico#", 4) != 0) { goto notfound; } start = string + 4; id = strtoul(start, &end, 10); if ((end == start) || (*end != 0)) { goto notfound; } for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) { if (icoPtr->id == id) { return icoPtr; } } notfound: Tcl_AppendResult(interp, "icon \"", string, "\" doesn't exist", NULL); return NULL; } /* *---------------------------------------------------------------------- * * GetInt -- * * Utility function for calculating buffer length. * * Results: * Length. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int GetInt( long theint, char *buffer, size_t len) { snprintf(buffer, len, "0x%lx", theint); buffer[len - 1] = 0; return (int) strlen(buffer); } /* *---------------------------------------------------------------------- * * GetIntDec -- * * Utility function for calculating buffer length. * * Results: * Length. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int GetIntDec( long theint, char *buffer, size_t len) { snprintf(buffer, len - 1, "%ld", theint); buffer[len - 1] = 0; return (int) strlen(buffer); } /* *---------------------------------------------------------------------- * * TaskbarExpandPercents -- * * Parse strings in taskbar display. * * Results: * Strings. * * Side effects: * None. * *---------------------------------------------------------------------- */ static char* TaskbarExpandPercents( IcoInfo *icoPtr, const char *msgstring, WPARAM wParam, LPARAM lParam, char *before, char *after, int *aftersize) { #define SPACELEFT (*aftersize-(dst-after)-1) #define AFTERLEN ((*aftersize>0)?(*aftersize*2):1024) #define ALLOCLEN ((len>AFTERLEN)?(len*2):AFTERLEN) char buffer[TCL_INTEGER_SPACE + 5]; char* dst; dst = after; while (*before) { const char *ptr = before; int len = 1; if(*before == '%') { switch(before[1]){ case 'M': case 'm': { before++; len = strlen(msgstring); ptr = msgstring; break; } /* case 'W': { before++; len = (int)strlen(winstring); ptr = winstring; break; } */ case 'i': { before++; snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id); len = strlen(buffer); ptr = buffer; break; } case 'w': { before++; len = GetInt((long)wParam,buffer, sizeof(buffer)); ptr = buffer; break; } case 'l': { before++; len = GetInt((long)lParam,buffer, sizeof(buffer)); ptr = buffer; break; } case 't': { before++; len = GetInt((long)GetTickCount(), buffer, sizeof(buffer)); ptr = buffer; break; } case 'x': { POINT pt; GetCursorPos(&pt); before++; len = GetIntDec((long)pt.x, buffer, sizeof(buffer)); ptr = buffer; break; } case 'y': { POINT pt; GetCursorPos(&pt); before++; len = GetIntDec((long)pt.y,buffer, sizeof(buffer)); ptr = buffer; break; } case 'X': { DWORD dw; dw = GetMessagePos(); before++; len = GetIntDec((long)LOWORD(dw),buffer, sizeof(buffer)); ptr = buffer; break; } case 'Y': { DWORD dw; dw = GetMessagePos(); before++; len = GetIntDec((long)HIWORD(dw),buffer, sizeof(buffer)); ptr = buffer; break; } case 'H': { before++; len = GetInt(PTR2INT(icoPtr->hwndFocus), buffer, sizeof(buffer)); ptr = buffer; break; } case '%': { before++; len = 1; ptr = "%"; break; } } } if (SPACELEFT < len) { char *newspace; ptrdiff_t dist = dst - after; int alloclen = ALLOCLEN; newspace = (char *)ckalloc(alloclen); if (dist>0) memcpy(newspace, after, dist); if (after && *aftersize) { ckfree(after); } *aftersize =alloclen; after = newspace; dst = after + dist; } if (len > 0) { memcpy(dst, ptr, len); } dst += len; if ((dst-after)>(*aftersize-1)) { printf("oops\n"); } before++; } *dst = 0; return after; } /* *---------------------------------------------------------------------- * * TaskbarEval -- * * Parse mouse and keyboard events over taskbar. * * Results: * Event processing. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void TaskbarEval( IcoInfo *icoPtr, WPARAM wParam, LPARAM lParam) { const char *msgstring = "none"; char evalspace[200]; int evalsize = 200; char *expanded; int fixup = 0; switch (lParam) { case WM_MOUSEMOVE: msgstring = "WM_MOUSEMOVE"; icoPtr->hwndFocus = GetFocus(); break; case WM_LBUTTONDOWN: msgstring = "WM_LBUTTONDOWN"; fixup = 1; break; case WM_LBUTTONUP: msgstring = "WM_LBUTTONUP"; fixup = 1; break; case WM_LBUTTONDBLCLK: msgstring = "WM_LBUTTONDBLCLK"; fixup = 1; break; case WM_RBUTTONDOWN: msgstring = "WM_RBUTTONDOWN"; fixup = 1; break; case WM_RBUTTONUP: msgstring = "WM_RBUTTONUP"; fixup = 1; break; case WM_RBUTTONDBLCLK: msgstring = "WM_RBUTTONDBLCLK"; fixup = 1; break; case WM_MBUTTONDOWN: msgstring = "WM_MBUTTONDOWN"; fixup = 1; break; case WM_MBUTTONUP: msgstring = "WM_MBUTTONUP"; fixup = 1; break; case WM_MBUTTONDBLCLK: msgstring = "WM_MBUTTONDBLCLK"; fixup = 1; break; default: msgstring = "WM_NULL"; fixup = 0; } expanded = TaskbarExpandPercents(icoPtr, msgstring, wParam, lParam, Tcl_GetString(icoPtr->taskbar_command), evalspace, &evalsize); if (icoPtr->interp != NULL) { int result; HWND hwnd = NULL; /* See http://support.microsoft.com/kb/q135788/ * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */ if (fixup) { if (icoPtr->hwndFocus != NULL && IsWindow(icoPtr->hwndFocus)) { hwnd = icoPtr->hwndFocus; } else { Tk_Window tkwin = Tk_MainWindow(icoPtr->interp); if (tkwin != NULL) { hwnd = Tk_GetHWND(Tk_WindowId(tkwin)); } } if (hwnd != NULL) { SetForegroundWindow(hwnd); } } result = Tcl_GlobalEval(icoPtr->interp, expanded); if (hwnd != NULL) { /* See http://support.microsoft.com/kb/q135788/ * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */ PostMessageW(hwnd, WM_NULL, 0, 0); } if (result != TCL_OK) { char buffer[100]; sprintf(buffer, "\n (command bound to taskbar-icon ico#%d)", icoPtr->id); Tcl_AddErrorInfo(icoPtr->interp, buffer); Tcl_BackgroundError(icoPtr->interp); } } if (expanded != evalspace) { ckfree(expanded); } } /* *---------------------------------------------------------------------- * * TaskbarHandlerProc -- * * Windows callback procedure, if ICON_MESSAGE arrives, try to execute * the taskbar_command. * * Results: * Command execution. * * Side effects: * None. * *---------------------------------------------------------------------- */ static LRESULT CALLBACK TaskbarHandlerProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static UINT msgTaskbarCreated = 0; IcoInterpInfo *icoInterpPtr; IcoInfo *icoPtr; switch (message) { case WM_CREATE: msgTaskbarCreated = RegisterWindowMessage(TEXT("TaskbarCreated")); break; case ICON_MESSAGE: for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) { if (icoInterpPtr->hwnd == hwnd) { for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) { if (icoPtr->id == wParam) { if (icoPtr->taskbar_command != NULL) { TaskbarEval(icoPtr, wParam, lParam); } break; } } break; } } break; default: /* * Check to see if explorer has been restarted and we need to * re-add our icons. */ if (message == msgTaskbarCreated) { for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) { if (icoInterpPtr->hwnd == hwnd) { for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) { if (icoPtr->taskbar_flags & TASKBAR_ICON) { TaskbarOperation(icoInterpPtr, icoPtr, NIM_ADD); } } break; } } } return DefWindowProc(hwnd, message, wParam, lParam); } return 0; } /* *---------------------------------------------------------------------- * * RegisterHandlerClass -- * * Registers the handler window class. * * Results: * Handler class registered. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int RegisterHandlerClass( HINSTANCE hInstance) { WNDCLASS wndclass; memset(&wndclass, 0, sizeof(WNDCLASS)); wndclass.style = 0; wndclass.lpfnWndProc = TaskbarHandlerProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = HANDLER_CLASS; return RegisterClass(&wndclass); } /* *---------------------------------------------------------------------- * * CreateTaskbarHandlerWindow -- * * Creates a hidden window to handle taskbar messages. * * Results: * Hidden window created. * * Side effects: * None. * *---------------------------------------------------------------------- */ static HWND CreateTaskbarHandlerWindow(void) { static int registered = 0; HINSTANCE hInstance = GETHINSTANCE; if (!registered) { if (!RegisterHandlerClass(hInstance)) return 0; registered = 1; } return CreateWindow(HANDLER_CLASS, "", WS_OVERLAPPED, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); } /* *---------------------------------------------------------------------- * * WinIcoDestroy -- * * Event handler to delete systray icons when interp main window * is deleted, either by destroy, interp deletion or application * exit. * * Results: * Icon/window removed and memory freed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void WinIcoDestroy( ClientData clientData, XEvent *eventPtr) { IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData; IcoInterpInfo *prevIcoInterpPtr; IcoInfo *icoPtr; IcoInfo *nextPtr; if (eventPtr->type != DestroyNotify) { return; } if (firstIcoInterpPtr == icoInterpPtr) { firstIcoInterpPtr = icoInterpPtr->nextPtr; } else { for (prevIcoInterpPtr = firstIcoInterpPtr; prevIcoInterpPtr->nextPtr != icoInterpPtr; prevIcoInterpPtr = prevIcoInterpPtr->nextPtr) { /* Empty loop body. */ } prevIcoInterpPtr->nextPtr = icoInterpPtr->nextPtr; } DestroyWindow(icoInterpPtr->hwnd); for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = nextPtr) { nextPtr = icoPtr->nextPtr; FreeIcoPtr(icoInterpPtr, icoPtr); } ckfree((char *) icoInterpPtr); } /* *---------------------------------------------------------------------- * * WinSystrayCmd -- * * Main command for creating, displaying, and removing icons from taskbar. * * Results: * Management of icon display in taskbar/system tray. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int WinSystrayCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { static const char *const cmdStrings[] = { "add", "delete", "modify", NULL }; enum { CMD_ADD, CMD_DELETE, CMD_MODIFY }; static const char *const optStrings[] = { "-callback", "-image", "-text", NULL }; enum { OPT_CALLBACK, OPT_IMAGE, OPT_TEXT }; int cmd, opt; HICON hIcon; int i; IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData; IcoInfo *icoPtr = NULL; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command ..."); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], cmdStrings, "command", 0, &cmd) == TCL_ERROR) { return TCL_ERROR; } switch (cmd) { case CMD_ADD: case CMD_MODIFY: { Tcl_Obj *imageObj = NULL, *textObj = NULL, *callbackObj = NULL; int optStart; int oper; if (cmd == CMD_ADD) { optStart = 2; oper = NIM_ADD; } else { optStart = 3; oper = NIM_MODIFY; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "id option value"); return TCL_ERROR; } icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2])); if (icoPtr == NULL) { return TCL_ERROR; } } for (i = optStart; i < objc; i += 2) { if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option", 0, &opt) == TCL_ERROR) { return TCL_ERROR; } if (i+1 >= objc) { Tcl_AppendResult(interp, "missing value for option \"", Tcl_GetString(objv[i]), "\"", NULL); return TCL_ERROR; } switch (opt) { case OPT_IMAGE: imageObj = objv[i+1]; break; case OPT_TEXT: textObj = objv[i+1]; break; case OPT_CALLBACK: callbackObj = objv[i+1]; break; } } if (cmd == CMD_ADD && imageObj == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("missing required option \"-image\"", -1)); return TCL_ERROR; } if (imageObj != NULL) { Tk_PhotoHandle photo; int width, height; Tk_PhotoImageBlock block; photo = Tk_FindPhoto(interp, Tcl_GetString(imageObj)); if (photo == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image \"%s\" doesn't exist", Tcl_GetString(imageObj))); return TCL_ERROR; } Tk_PhotoGetSize(photo, &width, &height); Tk_PhotoGetImage(photo, &block); hIcon = CreateIcoFromPhoto(width, height, block); if (hIcon == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "failed to create an iconphoto with image \"%s\"", Tcl_GetString(imageObj))); return TCL_ERROR; } } if (cmd == CMD_ADD) { icoPtr = NewIcon(interp, icoInterpPtr, hIcon); } else { if (imageObj != NULL) { DestroyIcon(icoPtr->hIcon); icoPtr->hIcon = hIcon; } } if (callbackObj != NULL) { if (icoPtr->taskbar_command != NULL) { Tcl_DecrRefCount(icoPtr->taskbar_command); } icoPtr->taskbar_command = callbackObj; Tcl_IncrRefCount(icoPtr->taskbar_command); } if (textObj != NULL) { if (icoPtr->taskbar_txt != NULL) { Tcl_DecrRefCount(icoPtr->taskbar_txt); } icoPtr->taskbar_txt = textObj; Tcl_IncrRefCount(icoPtr->taskbar_txt); } TaskbarOperation(icoInterpPtr, icoPtr, oper); if (cmd == CMD_ADD) { char buffer[5 + TCL_INTEGER_SPACE]; int n; n = _snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id); buffer[n] = 0; Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, n)); } return TCL_OK; } case CMD_DELETE: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "id"); return TCL_ERROR; } icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2])); if (icoPtr == NULL) { return TCL_ERROR; } FreeIcoPtr(icoInterpPtr, icoPtr); return TCL_OK; } return TCL_OK; } /* *---------------------------------------------------------------------- * * WinSysNotifyCmd -- * * Main command for creating and displaying notifications/balloons from system tray. * * Results: * Display of notifications. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int WinSysNotifyCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData; IcoInfo *icoPtr; Tcl_DString infodst; Tcl_DString titledst; NOTIFYICONDATAW ni; char *msgtitle; char *msginfo; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command ..."); return TCL_ERROR; } if (strcmp(Tcl_GetString(objv[1]), "notify") != 0) { Tcl_AppendResult(interp, "unknown subcommand \"", Tcl_GetString(objv[1]), "\": must be notify", NULL); return TCL_ERROR; } if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "id title detail"); return TCL_ERROR; } icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2])); if (icoPtr == NULL) { return TCL_ERROR; } ni.cbSize = sizeof(NOTIFYICONDATAW); ni.hWnd = icoInterpPtr->hwnd; ni.uID = icoPtr->id; ni.uFlags = NIF_INFO; ni.uCallbackMessage = ICON_MESSAGE; ni.hIcon = icoPtr->hIcon; ni.dwInfoFlags = NIIF_INFO; /* Use a sane platform-specific icon here.*/ msgtitle = Tcl_GetString(objv[3]); msginfo = Tcl_GetString(objv[4]); /* Balloon notification for system tray icon. */ if (msgtitle != NULL) { WCHAR *title; Tcl_DStringInit(&titledst); title = Tcl_UtfToWCharDString(msgtitle, -1, &titledst); wcsncpy(ni.szInfoTitle, title, (Tcl_DStringLength(&titledst) + 2) / 2); Tcl_DStringFree(&titledst); } if (msginfo != NULL) { WCHAR *info; Tcl_DStringInit(&infodst); info = Tcl_UtfToWCharDString(msginfo, -1, &infodst); wcsncpy(ni.szInfo, info, (Tcl_DStringLength(&infodst) + 2) / 2); Tcl_DStringFree(&infodst); } Shell_NotifyIconW(NIM_MODIFY, &ni); return TCL_OK; } /* *---------------------------------------------------------------------- * * WinIcoInit -- * * Initialize this package and create script-level commands. * * Results: * Initialization of code. * * Side effects: * None. * *---------------------------------------------------------------------- */ int WinIcoInit( Tcl_Interp *interp) { IcoInterpInfo *icoInterpPtr; Tk_Window mainWindow; mainWindow = Tk_MainWindow(interp); if (mainWindow == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("main window has been destroyed", -1)); return TCL_ERROR; } icoInterpPtr = (IcoInterpInfo*) ckalloc(sizeof(IcoInterpInfo)); icoInterpPtr->counter = 0; icoInterpPtr->firstIcoPtr = NULL; icoInterpPtr->hwnd = CreateTaskbarHandlerWindow(); icoInterpPtr->nextPtr = firstIcoInterpPtr; firstIcoInterpPtr = icoInterpPtr; Tcl_CreateObjCommand(interp, "::tk::systray::_systray", WinSystrayCmd, (ClientData) icoInterpPtr, NULL); Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", WinSysNotifyCmd, (ClientData) icoInterpPtr, NULL); Tk_CreateEventHandler(mainWindow, StructureNotifyMask, WinIcoDestroy, (ClientData) icoInterpPtr); return TCL_OK; } /* * Local variables: * mode: c * indent-tabs-mode: nil * End: */ |
Changes to win/tkWinTest.c.
1 2 3 4 5 6 | /* * tkWinTest.c -- * * Contains commands for platform specific tests for the Windows * platform. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkWinTest.c -- * * Contains commands for platform specific tests for the Windows * platform. * * Copyright © 1997 Sun Microsystems, Inc. * Copyright © 2000 Scriptics Corporation. * Copyright © 2001 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #undef USE_TCL_STUBS #define USE_TCL_STUBS |
︙ | ︙ | |||
307 308 309 310 311 312 313 | {-1, NULL} }; (void)dummy; if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]), "debug") == 0)) { int b; | | | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | {-1, NULL} }; (void)dummy; if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]), "debug") == 0)) { int b; if (Tcl_GetBooleanFromObj(interp, objv[2], &b) != TCL_OK) { return TCL_ERROR; } TkWinDialogDebug(b); return TCL_OK; } if (objc < 4) { |
︙ | ︙ | |||
377 378 379 380 381 382 383 | Tcl_ObjPrintf("Could not find control with id %d", id)); return TCL_ERROR; } buf[0] = 0; SendMessageA(control, WM_GETTEXT, (WPARAM)sizeof(buf), (LPARAM) buf); #endif | | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | Tcl_ObjPrintf("Could not find control with id %d", id)); return TCL_ERROR; } buf[0] = 0; SendMessageA(control, WM_GETTEXT, (WPARAM)sizeof(buf), (LPARAM) buf); #endif (void)Tcl_ExternalToUtfDStringEx(NULL, buf, -1, TCL_ENCODING_NOCOMPLAIN, &ds); Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL); Tcl_DStringFree(&ds); break; } case WM_SETTEXT: { Tcl_DString ds; control = TestFindControl(hwnd, id); if (control == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("Could not find control with id %d", id)); return TCL_ERROR; } Tcl_DStringInit(&ds); (void)Tcl_UtfToExternalDStringEx(NULL, Tcl_GetString(objv[4]), -1, TCL_ENCODING_NOCOMPLAIN, &ds); result = SendMessageA(control, WM_SETTEXT, 0, (LPARAM) Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); if (result == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to send text to dialog: ", -1)); AppendSystemError(interp, GetLastError()); return TCL_ERROR; |
︙ | ︙ |
Changes to win/tkWinWindow.c.
1 2 3 4 5 6 | /* * tkWinWindow.c -- * * Xlib emulation routines for Windows related to creating, displaying * and destroying windows. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinWindow.c -- * * Xlib emulation routines for Windows related to creating, displaying * and destroying windows. * * Copyright © 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tkBusy.h" |
︙ | ︙ | |||
243 244 245 246 247 248 249 | * Side effects: * Creates a new window. * *---------------------------------------------------------------------- */ Window | | | > | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | * Side effects: * Creates a new window. * *---------------------------------------------------------------------- */ Window Tk_MakeWindow( Tk_Window tkwin, Window parent) { HWND parentWin; int style; HWND hwnd; TkWindow *winPtr = (TkWindow *)tkwin; if (parent != None) { parentWin = Tk_GetHWND(parent); style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; } else { parentWin = NULL; style = WS_POPUP | WS_CLIPCHILDREN; |
︙ | ︙ |
Changes to win/tkWinWm.c.
1 2 3 4 5 6 7 8 | /* * tkWinWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window * manager. * | | | > > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * tkWinWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window * manager. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include <windows.h> #include <wtypes.h> #include <shobjidl.h> #include <shlguid.h> #include <shellapi.h> #include "tkWinIco.h" /* * These next two defines are only valid on Win2K/XP+. */ #ifndef WS_EX_LAYERED #define WS_EX_LAYERED 0x00080000 #endif |
︙ | ︙ | |||
73 74 75 76 77 78 79 | */ typedef struct TkWmStackorderToplevelPair { Tcl_HashTable *table; TkWindow **windowPtr; } TkWmStackorderToplevelPair; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | */ typedef struct TkWmStackorderToplevelPair { Tcl_HashTable *table; TkWindow **windowPtr; } TkWmStackorderToplevelPair; /* * A pointer to one of these structures is associated with each toplevel. * This allows us to free up all memory associated with icon resources when a * window is deleted or if the window's icon is changed. They are simply * reference counted according to: * * (1) How many WmInfo structures point to this object * (2) Whether the ThreadSpecificData defined in this file contains a pointer * to this object. |
︙ | ︙ | |||
354 355 356 357 358 359 360 | #define EX_TRANSIENT_STYLE (WS_EX_DLGMODALFRAME) /* * The following structure is the official type record for geometry management * of top-level windows. */ | | | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | #define EX_TRANSIENT_STYLE (WS_EX_DLGMODALFRAME) /* * The following structure is the official type record for geometry management * of top-level windows. */ static void TopLevelReqProc(void *dummy, Tk_Window tkwin); static void RemapWindows(TkWindow *winPtr, HWND parentHWND); static const Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ NULL, /* lostContentProc */ }; |
︙ | ︙ | |||
393 394 395 396 397 398 399 400 401 402 403 404 405 406 | */ static int initialized; /* Flag indicating whether module has been * initialized. */ TCL_DECLARE_MUTEX(winWmMutex) /* * Forward declarations for functions defined in this file: */ static int ActivateWindow(Tcl_Event *evPtr, int flags); static void ConfigureTopLevel(WINDOWPOS *pos); static void GenerateConfigureNotify(TkWindow *winPtr); | > > > > > > > > > > | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | */ static int initialized; /* Flag indicating whether module has been * initialized. */ TCL_DECLARE_MUTEX(winWmMutex) /* * The following records the "TaskbarButtonCreated" message ID * for overlay icons. */ static UINT TaskbarButtonCreatedMessageId = WM_NULL; /* Reference to taskbarlist API for overlay icons. */ ITaskbarList3 *ptbl; /* * Forward declarations for functions defined in this file: */ static int ActivateWindow(Tcl_Event *evPtr, int flags); static void ConfigureTopLevel(WINDOWPOS *pos); static void GenerateConfigureNotify(TkWindow *winPtr); |
︙ | ︙ | |||
419 420 421 422 423 424 425 | TkWindow *winPtr); static void RefreshColormap(Colormap colormap, TkDisplay *dispPtr); static void SetLimits(HWND hwnd, MINMAXINFO *info); static void TkWmStackorderToplevelWrapperMap(TkWindow *winPtr, Display *display, Tcl_HashTable *table); static LRESULT CALLBACK TopLevelProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); | | | | | > < | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | TkWindow *winPtr); static void RefreshColormap(Colormap colormap, TkDisplay *dispPtr); static void SetLimits(HWND hwnd, MINMAXINFO *info); static void TkWmStackorderToplevelWrapperMap(TkWindow *winPtr, Display *display, Tcl_HashTable *table); static LRESULT CALLBACK TopLevelProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static void TopLevelEventProc(void *clientData, XEvent *eventPtr); static void TopLevelReqProc(void *dummy, Tk_Window tkwin); static void UpdateGeometryInfo(void *clientData); static void UpdateWrapper(TkWindow *winPtr); static LRESULT CALLBACK WmProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static void WmWaitVisibilityOrMapProc(void *clientData, XEvent *eventPtr); static BlockOfIconImagesPtr ReadIconOrCursorFromFile(Tcl_Interp *interp, Tcl_Obj* fileName, BOOL isIcon); static WinIconPtr ReadIconFromFile(Tcl_Interp *interp, Tcl_Obj *fileName); static BOOL AdjustIconImagePointers(LPICONIMAGE lpImage); static WinIconPtr GetIconFromPixmap(Display *dsPtr, Pixmap pixmap); static int ReadICOHeader(Tcl_Channel channel); static HICON MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon); static HICON GetIcon(WinIconPtr titlebaricon, int icon_size); static int WinSetIcon(Tcl_Interp *interp, WinIconPtr titlebaricon, Tk_Window tkw); static void FreeIconBlock(BlockOfIconImagesPtr lpIR); static void DecrIconRefCount(WinIconPtr titlebaricon); |
︙ | ︙ | |||
479 480 481 482 483 484 485 486 487 488 489 490 491 492 | Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconmaskCmd(Tk_Window tkwin, | > > > | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbadgeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmIconmaskCmd(Tk_Window tkwin, |
︙ | ︙ | |||
533 534 535 536 537 538 539 540 541 542 543 544 545 546 | Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); | > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTouchCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); /* *---------------------------------------------------------------------- * * MakeIconOrCursorFromResource -- * * Construct an actual HICON structure from the information in a |
︙ | ︙ | |||
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 | titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; } return titlebaricon; } /* *---------------------------------------------------------------------- * * GetIconFromPixmap -- * * Turn a Tk Pixmap (i.e. a bitmap) into an icon resource, if possible, * otherwise NULL is returned. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 | titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; } return titlebaricon; } /* *---------------------------------------------------------------------- * * AdjustIconImagePointers -- * * Adjusts internal pointers in icon resource struct, as given by * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon * code. * * Results: * BOOL - TRUE for success, FALSE for failure * *---------------------------------------------------------------------- */ static BOOL AdjustIconImagePointers( LPICONIMAGE lpImage) { /* * Sanity check. */ if (lpImage == NULL) { return FALSE; } /* * BITMAPINFO is at beginning of bits. */ lpImage->lpbi = (LPBITMAPINFO) lpImage->lpBits; /* * Width - simple enough. */ lpImage->Width = lpImage->lpbi->bmiHeader.biWidth; /* * Icons are stored in funky format where height is doubled so account for * that. */ lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2; /* * How many colors? */ lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes * lpImage->lpbi->bmiHeader.biBitCount; /* * XOR bits follow the header and color table. */ lpImage->lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage->lpbi); /* * AND bits follow the XOR bits. */ lpImage->lpAND = lpImage->lpXOR + lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER) lpImage->lpbi); return TRUE; } /* *---------------------------------------------------------------------- * * GetIconFromPixmap -- * * Turn a Tk Pixmap (i.e. a bitmap) into an icon resource, if possible, * otherwise NULL is returned. |
︙ | ︙ | |||
1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 | tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { return; } tsdPtr->initialized = 0; UnregisterClassW(TK_WIN_TOPLEVEL_CLASS_NAME, hInstance); } /* *-------------------------------------------------------------- * * TkWmNewWindow -- | > > > > > > | 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 | tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { return; } tsdPtr->initialized = 0; /* * COM library cleanup. */ CoUninitialize(); UnregisterClassW(TK_WIN_TOPLEVEL_CLASS_NAME, hInstance); } /* *-------------------------------------------------------------- * * TkWmNewWindow -- |
︙ | ︙ | |||
1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 | WmInfo *wmPtr = winPtr->wmInfoPtr; HWND parentHWND, oldWrapper = wmPtr->wrapper; HWND child, nextHWND, focusHWND; int x, y, width, height, state; WINDOWPLACEMENT place; HICON hSmallIcon = NULL; HICON hBigIcon = NULL; Tcl_DString titleString; int *childStateInfo = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->window == None) { /* | > | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 | WmInfo *wmPtr = winPtr->wmInfoPtr; HWND parentHWND, oldWrapper = wmPtr->wrapper; HWND child, nextHWND, focusHWND; int x, y, width, height, state; WINDOWPLACEMENT place; HICON hSmallIcon = NULL; HICON hBigIcon = NULL; HRESULT hr; Tcl_DString titleString; int *childStateInfo = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->window == None) { /* |
︙ | ︙ | |||
2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 | if (tsdPtr->firstWindow) { tsdPtr->firstWindow = 0; SetActiveWindow(wmPtr->wrapper); } else if (focusHWND) { SetFocus(focusHWND); } } /* *-------------------------------------------------------------- * * TkWmMapWindow -- * | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 | if (tsdPtr->firstWindow) { tsdPtr->firstWindow = 0; SetActiveWindow(wmPtr->wrapper); } else if (focusHWND) { SetFocus(focusHWND); } /* * Initialize hooks for overlay icon. * Start with TaskbarButtonCreated message. */ TaskbarButtonCreatedMessageId = RegisterWindowMessage(TEXT("TaskbarButtonCreated")); /* * In case the application is run elevated, allow the * TaskbarButtonCreated message through. */ ChangeWindowMessageFilter(TaskbarButtonCreatedMessageId, MSGFLT_ADD); /* * Load COM library for icon overlay. */ hr = CoInitialize(0); if (SUCCEEDED(hr)) { hr = CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, (void **) &ptbl); if (FAILED(hr)) { printf("Unable to initialize ITaskbarList3 API"); ptbl->lpVtbl->Release(NULL); ptbl = NULL; } } } /* *-------------------------------------------------------------- * * TkWmMapWindow -- * |
︙ | ︙ | |||
2736 2737 2738 2739 2740 2741 2742 | * A window property may get updated. * *-------------------------------------------------------------- */ void TkWmSetClass( | | < < | 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 | * A window property may get updated. * *-------------------------------------------------------------- */ void TkWmSetClass( TCL_UNUSED(TkWindow *)) /* Newly-created top-level window. */ { /* Do nothing */ return; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2763 2764 2765 2766 2767 2768 2769 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_WmObjCmd( | | | | | | | | 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_WmObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", "frame", "geometry", "grid", "group", "iconbadge", "iconbitmap", "iconify", "iconmask", "iconname", "iconphoto", "iconposition", "iconwindow", "manage", "maxsize", "minsize", "overrideredirect", "positionfrom", "protocol", "resizable", "sizefrom", "stackorder", "state", "title", "touch", "transient", "withdraw", NULL }; enum options { WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS, WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FORGET, WMOPT_FRAME, WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBADGE, WMOPT_ICONBITMAP, WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME, WMOPT_ICONPHOTO, WMOPT_ICONPOSITION, WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TOUCH, WMOPT_TRANSIENT, WMOPT_WITHDRAW }; int index; TkSizeT length; const char *argv1; TkWindow *winPtr, **winPtrPtr = &winPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objc < 2) { wrongNumArgs: Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } argv1 = Tcl_GetStringFromObj(objv[1], &length); if ((argv1[0] == 't') && !strncmp(argv1, "tracing", length) && (length >= 3)) { int wmTracing; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 2, objv, "?boolean?"); return TCL_ERROR; |
︙ | ︙ | |||
2830 2831 2832 2833 2834 2835 2836 | dispPtr->flags |= TK_DISPLAY_WM_TRACING; } else { dispPtr->flags &= ~TK_DISPLAY_WM_TRACING; } return TCL_OK; } | | | | | 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 | dispPtr->flags |= TK_DISPLAY_WM_TRACING; } else { dispPtr->flags &= ~TK_DISPLAY_WM_TRACING; } return TCL_OK; } if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } if (objc < 3) { goto wrongNumArgs; } if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) winPtrPtr) != TCL_OK) { return TCL_ERROR; } if (!Tk_IsTopLevel(winPtr) && (index != WMOPT_MANAGE) && (index != WMOPT_TOUCH) && (index != WMOPT_FORGET)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't a top-level window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TOPLEVEL", winPtr->pathName, NULL); return TCL_ERROR; } |
︙ | ︙ | |||
2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 | return WmFrameCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GEOMETRY: return WmGeometryCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GRID: return WmGridCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GROUP: return WmGroupCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBITMAP: return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONIFY: return WmIconifyCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONMASK: return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONNAME: | > > | 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 | return WmFrameCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GEOMETRY: return WmGeometryCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GRID: return WmGridCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_GROUP: return WmGroupCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBADGE: return WmIconbadgeCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONBITMAP: return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONIFY: return WmIconifyCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONMASK: return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_ICONNAME: |
︙ | ︙ | |||
2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 | return WmSizefromCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STACKORDER: return WmStackorderCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STATE: return WmStateCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TITLE: return WmTitleCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TRANSIENT: return WmTransientCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_WITHDRAW: return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv); } /* This should not happen */ | > > | 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 | return WmSizefromCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STACKORDER: return WmStackorderCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_STATE: return WmStateCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TITLE: return WmTitleCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TOUCH: return WmTouchCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_TRANSIENT: return WmTransientCmd(tkwin, winPtr, interp, objc, objv); case WMOPT_WITHDRAW: return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv); } /* This should not happen */ |
︙ | ︙ | |||
2942 2943 2944 2945 2946 2947 2948 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmAspectCmd( | | < | 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmAspectCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?minNumer minDenom maxNumer maxDenom?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
3070 3071 3072 3073 3074 3075 3076 | Tcl_NewStringObj("-topmost", -1)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((exStyle & WS_EX_TOPMOST) != 0)); Tcl_SetObjResult(interp, objPtr); return TCL_OK; } for (i = 3; i < objc; i += 2) { | | < < < | 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 | Tcl_NewStringObj("-topmost", -1)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((exStyle & WS_EX_TOPMOST) != 0)); Tcl_SetObjResult(interp, objPtr); return TCL_OK; } for (i = 3; i < objc; i += 2) { string = Tcl_GetStringFromObj(objv[i], &length); if (strncmp(string, "-disabled", length) == 0) { stylePtr = &style; styleBit = WS_DISABLED; } else if ((strncmp(string, "-alpha", length) == 0) || ((length > 2) && (strncmp(string, "-transparentcolor", length) == 0))) { stylePtr = &exStyle; |
︙ | ︙ | |||
3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 | if ((i < objc-1) && (winPtr->flags & TK_EMBEDDED)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't set topmost flag on %s: it is an embedded window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ATTR", "TOPMOST", NULL); return TCL_ERROR; } } else { goto configArgs; } if (styleBit == WS_EX_LAYERED) { if (objc == 4) { if (string[1] == 'a') { /* -alpha */ Tcl_SetObjResult(interp, Tcl_NewDoubleObj(wmPtr->alpha)); | > > > > > > | 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 | if ((i < objc-1) && (winPtr->flags & TK_EMBEDDED)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't set topmost flag on %s: it is an embedded window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ATTR", "TOPMOST", NULL); return TCL_ERROR; } } else if (i == 3) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad attribute \"%s\": must be -alpha, -disabled, -fullscreen, -toolwindow, -topmost, or -transparentcolor", string)); Tcl_SetErrorCode(interp, "TK", "WM", "ATTR", "UNRECOGNIZED", NULL); return TCL_ERROR; } else { goto configArgs; } if (styleBit == WS_EX_LAYERED) { if (objc == 4) { if (string[1] == 'a') { /* -alpha */ Tcl_SetObjResult(interp, Tcl_NewDoubleObj(wmPtr->alpha)); |
︙ | ︙ | |||
3138 3139 3140 3141 3142 3143 3144 | if (dval < 0.0) { dval = 0; } else if (dval > 1.0) { dval = 1; } wmPtr->alpha = dval; } else { /* -transparentcolor */ | | | 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 | if (dval < 0.0) { dval = 0; } else if (dval > 1.0) { dval = 1; } wmPtr->alpha = dval; } else { /* -transparentcolor */ const char *crefstr = Tcl_GetStringFromObj(objv[i+1], &length); if (length == 0) { /* reset to no transparent color */ if (wmPtr->crefObj) { Tcl_DecrRefCount(wmPtr->crefObj); wmPtr->crefObj = NULL; } |
︙ | ︙ | |||
3309 3310 3311 3312 3313 3314 3315 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmClientCmd( | | < | | 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmClientCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->clientMachine != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->clientMachine, -1)); } return TCL_OK; } argv3 = Tcl_GetStringFromObj(objv[3], &length); if (argv3[0] == 0) { if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); wmPtr->clientMachine = NULL; if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XDeleteProperty(winPtr->display, winPtr->window, Tk_InternAtom((Tk_Window) winPtr,"WM_CLIENT_MACHINE")); |
︙ | ︙ | |||
3474 3475 3476 3477 3478 3479 3480 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmCommandCmd( | | < | 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmCommandCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int cmdArgc; const char **cmdArgv; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->cmdArgv != NULL) { |
︙ | ︙ | |||
3544 3545 3546 3547 3548 3549 3550 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmDeiconifyCmd( | | < | 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmDeiconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
3597 3598 3599 3600 3601 3602 3603 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmFocusmodelCmd( | | < | | | 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmFocusmodelCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "active", "passive", NULL }; enum options { OPT_ACTIVE, OPT_PASSIVE }; int index; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?"); return TCL_ERROR; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( wmPtr->hints.input ? "passive" : "active", -1)); return TCL_OK; } if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,&index) != TCL_OK) { return TCL_ERROR; } if (index == OPT_ACTIVE) { wmPtr->hints.input = False; } else { /* OPT_PASSIVE */ wmPtr->hints.input = True; } |
︙ | ︙ | |||
3654 3655 3656 3657 3658 3659 3660 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmForgetCmd( | | | | | < < < < | | | | | 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmForgetCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */ TCL_UNUSED(int), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; if (Tk_IsTopLevel(frameWin)) { Tk_UnmapWindow(frameWin); winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr); RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window)); /* * Make sure wm no longer manages this window */ Tk_ManageGeometry(frameWin, NULL, NULL); TkWmDeadWindow(winPtr); /* flags (above) must be cleared before calling */ /* TkMapTopFrame (below) */ TkMapTopFrame(frameWin); } else { /* Already not managed by wm - ignore it */ |
︙ | ︙ | |||
3706 3707 3708 3709 3710 3711 3712 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmFrameCmd( | | < | 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmFrameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; char buf[TCL_INTEGER_SPACE]; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } if (Tk_WindowId((Tk_Window) winPtr) == None) { Tk_MakeWindowExist((Tk_Window) winPtr); |
︙ | ︙ | |||
3752 3753 3754 3755 3756 3757 3758 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmGeometryCmd( | | < | 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmGeometryCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; int width, height; const char *argv3; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
3821 3822 3823 3824 3825 3826 3827 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmGridCmd( | | < | 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmGridCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?baseWidth baseHeight widthInc heightInc?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
3941 3942 3943 3944 3945 3946 3947 | } if (objc == 3) { if (wmPtr->hints.flags & WindowGroupHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, -1)); } return TCL_OK; } | | | 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 | } if (objc == 3) { if (wmPtr->hints.flags & WindowGroupHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, -1)); } return TCL_OK; } argv3 = Tcl_GetStringFromObj(objv[3], &length); if (*argv3 == '\0') { wmPtr->hints.flags &= ~WindowGroupHint; if (wmPtr->leaderName != NULL) { ckfree(wmPtr->leaderName); } wmPtr->leaderName = NULL; } else { |
︙ | ︙ | |||
3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconbitmapCmd -- * * This function is invoked to process the "wm iconbitmap" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconbitmapCmd( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconbadgeCmd -- * * This function is invoked to process the "wm iconbadge" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconbadgeCmd( Tk_Window tkwin, /* Main window of the application. */ TCL_UNUSED(TkWindow *), /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { HWND hwnd; Tk_PhotoHandle photo; Tk_PhotoImageBlock block; int width, height; HICON overlayicon; int badgenumber; char *badgestring = NULL; char photoname[4096]; LPCWSTR string; HRESULT hr; Tk_Window badgewindow; WmInfo *wmPtr; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window badge"); return TCL_ERROR; } /* * Parse args, get native wrapper window, and determine image. */ badgewindow = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin); wmPtr = ((TkWindow *) badgewindow)->wmInfoPtr; hwnd = wmPtr->wrapper; badgestring = Tcl_GetString(objv[3]); badgenumber = atoi(badgestring); if (badgenumber > 9) { strcpy(photoname, "::tk::icons::9plus-badge"); } else { strcpy(photoname, "::tk::icons::"); strcat(photoname, badgestring); strcat(photoname, "-badge"); } /* * If badgestring is empty string, remove icon. */ if (strcmp("", badgestring) == 0) { ptbl->lpVtbl->SetOverlayIcon(ptbl, hwnd, NULL, NULL); return TCL_OK; } /* * If photo does not exist, return error. This means we do not have * to test for decimal or negative values; no photo for such values * is present. */ photo = Tk_FindPhoto(interp, photoname); if (photo == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use \"%s\" as icon badge", badgestring)); return TCL_ERROR; } /* * We have found the image. Convert to icon. */ Tk_PhotoGetSize(photo, &width, &height); Tk_PhotoGetImage(photo, &block); overlayicon = CreateIcoFromPhoto(width, height, block); if (overlayicon == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Failed to create badge icon", -1)); return TCL_ERROR; } /* * Place overlay icon on taskbar icon. */ string = L"Alert"; hr = ptbl->lpVtbl->SetOverlayIcon(ptbl, hwnd, overlayicon, string); if (hr != S_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Failed to create badge icon", -1)); return TCL_ERROR; } DestroyIcon(overlayicon); return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconbitmapCmd -- * * This function is invoked to process the "wm iconbitmap" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconbitmapCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ const char *string; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?"); return TCL_ERROR; } else if (objc == 5) { /* * If we have 5 arguments, we must have a '-default' flag. |
︙ | ︙ | |||
4120 4121 4122 4123 4124 4125 4126 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconifyCmd( | | < | 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { if (!SendMessageW(wmPtr->wrapper, TK_ICONIFY, 0, 0)) { |
︙ | ︙ | |||
4245 4246 4247 4248 4249 4250 4251 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconnameCmd( | | < | | 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconnameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); return TCL_ERROR; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( (wmPtr->iconName ? wmPtr->iconName : ""), -1)); return TCL_OK; } else { if (wmPtr->iconName != NULL) { ckfree(wmPtr->iconName); } argv3 = Tcl_GetStringFromObj(objv[3], &length); wmPtr->iconName = (char *)ckalloc(length + 1); memcpy(wmPtr->iconName, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); } } return TCL_OK; |
︙ | ︙ | |||
4297 4298 4299 4300 4301 4302 4303 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconphotoCmd( | | | < < < < < | 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconphotoCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ Tk_PhotoHandle photo; Tk_PhotoImageBlock block; int i, width, height, startObj = 3; BlockOfIconImagesPtr lpIR; WinIconPtr titlebaricon = NULL; HICON hIcon; unsigned size; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
4359 4360 4361 4362 4363 4364 4365 | size = sizeof(BlockOfIconImages) + (sizeof(ICONIMAGE) * (objc-startObj-1)); lpIR = (BlockOfIconImagesPtr)attemptckalloc(size); if (lpIR == NULL) { return TCL_ERROR; } ZeroMemory(lpIR, size); | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < | | > > > | < | 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 | size = sizeof(BlockOfIconImages) + (sizeof(ICONIMAGE) * (objc-startObj-1)); lpIR = (BlockOfIconImagesPtr)attemptckalloc(size); if (lpIR == NULL) { return TCL_ERROR; } ZeroMemory(lpIR, size); for (i = startObj; i < objc; i++) { photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i])); Tk_PhotoGetSize(photo, &width, &height); Tk_PhotoGetImage(photo, &block); hIcon = CreateIcoFromPhoto(width, height, block); if (hIcon == NULL) { FreeIconBlock(lpIR); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "failed to create an iconphoto with image \"%s\"", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "ICON", NULL); return TCL_ERROR; } lpIR->IconImages[i-startObj].Width = width; lpIR->IconImages[i-startObj].Height = height; lpIR->IconImages[i-startObj].Colors = 4; lpIR->IconImages[i-startObj].hIcon = hIcon; lpIR->nNumImages++; } titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; if (WinSetIcon(interp, titlebaricon, (Tk_Window) useWinPtr) != TCL_OK) { /* * We didn't use the titlebaricon after all. */ DecrIconRefCount(titlebaricon); return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconpositionCmd -- * * This function is invoked to process the "wm iconposition" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconpositionCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPositionHint) { |
︙ | ︙ | |||
4658 4659 4660 4661 4662 4663 4664 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmManageCmd( | | | | < < < | 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmManageCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" is not manageable: must be a frame," " labelframe or toplevel", Tk_PathName(frameWin))); Tcl_SetErrorCode(interp, "TK", "WM", "MANAGE", NULL); |
︙ | ︙ | |||
4715 4716 4717 4718 4719 4720 4721 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMaxsizeCmd( | | < | 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMaxsizeCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; |
︙ | ︙ | |||
4767 4768 4769 4770 4771 4772 4773 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMinsizeCmd( | | < | 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMinsizeCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; |
︙ | ︙ | |||
4819 4820 4821 4822 4823 4824 4825 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmOverrideredirectCmd( | | < | 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmOverrideredirectCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean, curValue; XSetWindowAttributes atts; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { curValue = SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1; |
︙ | ︙ | |||
4892 4893 4894 4895 4896 4897 4898 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmPositionfromCmd( | | < | | | 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmPositionfromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { OPT_PROGRAM, OPT_USER }; int index; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?"); return TCL_ERROR; } if (objc == 3) { const char *sourceStr = ""; if (wmPtr->sizeHintsFlags & USPosition) { sourceStr = "user"; } else if (wmPtr->sizeHintsFlags & PPosition) { sourceStr = "program"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, -1)); return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~(USPosition|PPosition); } else { if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == OPT_USER) { wmPtr->sizeHintsFlags &= ~PPosition; wmPtr->sizeHintsFlags |= USPosition; } else { wmPtr->sizeHintsFlags &= ~USPosition; |
︙ | ︙ | |||
4961 4962 4963 4964 4965 4966 4967 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmProtocolCmd( | | < | 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmProtocolCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; TkSizeT cmdLength; Tcl_Obj *resultObj; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); return TCL_ERROR; } if (objc == 3) { /* |
︙ | ︙ | |||
5027 5028 5029 5030 5031 5032 5033 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } | | | 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } cmd = Tcl_GetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { protPtr = (ProtocolHandler *)ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; protPtr->interp = interp; memcpy(protPtr->command, cmd, cmdLength + 1); |
︙ | ︙ | |||
5058 5059 5060 5061 5062 5063 5064 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmResizableCmd( | | < | 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmResizableCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; |
︙ | ︙ | |||
5121 5122 5123 5124 5125 5126 5127 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmSizefromCmd( | | < | | | 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmSizefromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { OPT_PROGRAM, OPT_USER }; int index; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?"); return TCL_ERROR; } if (objc == 3) { const char *sourceStr = ""; if (wmPtr->sizeHintsFlags & USSize) { sourceStr = "user"; } else if (wmPtr->sizeHintsFlags & PSize) { sourceStr = "program"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, -1)); return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~(USSize|PSize); } else { if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == OPT_USER) { wmPtr->sizeHintsFlags &= ~PSize; wmPtr->sizeHintsFlags |= USSize; } else { /* OPT_PROGRAM */ wmPtr->sizeHintsFlags &= ~USSize; |
︙ | ︙ | |||
5286 5287 5288 5289 5290 5291 5292 | Tcl_Panic("winPtr window not found"); } else if (index2 == -1) { Tcl_Panic("winPtr2 window not found"); } ckfree(windows); | | | | 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 | Tcl_Panic("winPtr window not found"); } else if (index2 == -1) { Tcl_Panic("winPtr2 window not found"); } ckfree(windows); if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } |
︙ | ︙ | |||
5319 5320 5321 5322 5323 5324 5325 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmStateCmd( | | | | < | | | 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmStateCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "iconic", "normal", "withdrawn", "zoomed", NULL }; enum options { OPT_ICONIC, OPT_NORMAL, OPT_WITHDRAWN, OPT_ZOOMED }; int index; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); return TCL_ERROR; } if (objc == 4) { if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't change state of %s: it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "ICON", NULL); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { int state = 0; switch (index) { |
︙ | ︙ | |||
5460 5461 5462 5463 5464 5465 5466 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmTitleCmd( | | < | 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmTitleCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; HWND wrapper; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { |
︙ | ︙ | |||
5503 5504 5505 5506 5507 5508 5509 | Tcl_SetObjResult(interp, Tcl_NewStringObj( (wmPtr->title ? wmPtr->title : winPtr->nameUid), -1)); } } else { if (wmPtr->title != NULL) { ckfree(wmPtr->title); } | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 | Tcl_SetObjResult(interp, Tcl_NewStringObj( (wmPtr->title ? wmPtr->title : winPtr->nameUid), -1)); } } else { if (wmPtr->title != NULL) { ckfree(wmPtr->title); } argv3 = Tcl_GetStringFromObj(objv[3], &length); wmPtr->title = (char *)ckalloc(length + 1); memcpy(wmPtr->title, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED) && wmPtr->wrapper != NULL) { Tcl_DString titleString; Tcl_DStringInit(&titleString); Tcl_UtfToWCharDString(wmPtr->title, -1, &titleString); SetWindowTextW(wrapper, (LPCWSTR) Tcl_DStringValue(&titleString)); Tcl_DStringFree(&titleString); } } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmTouchCmd -- * * This function is invoked to process the "wm touch" Tcl command. See * the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int WmTouchCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Window win; HWND hwnd; int i, index, gCnt = 0, value; ULONG flags = 0; int touch = 0, panFlag; GESTURECONFIG gcPan = { 0, 0, 0 }; GESTURECONFIG gc[10]; /* TBD: protect from overflow */ static const char *const optionStrings[] = { "-all", "-fine", "-pan", "-pangutter", "-paninertia", "-pansfh", "-pansfv", "-pressandtap", "-rotate", "-touch", "-twofingertap", "-wantpalm", "-zoom", NULL }; enum options { TOUCH_ALL, TOUCH_FINE, TOUCH_PAN, TOUCH_PANGUTTER, TOUCH_PANINERTIA, TOUCH_PANSFH, TOUCH_PANSFV, TOUCH_PRESSANDTAP, TOUCH_ROTATE, TOUCH_TOUCH, TOUCH_TWOFINGERTAP, TOUCH_WANTPALM, TOUCH_ZOOM }; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?"); return TCL_ERROR; } ZeroMemory(&gc, sizeof(gc)); for (i = 3; i < objc; i++) { if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum options) index) { case TOUCH_ALL: gc[gCnt++].dwWant = GC_ALLGESTURES; break; case TOUCH_FINE: flags |= TWF_FINETOUCH; touch = 1; break; case TOUCH_PAN: panFlag = GC_PAN; goto pan; case TOUCH_PANGUTTER: panFlag = GC_PAN_WITH_GUTTER; goto pan; case TOUCH_PANINERTIA: panFlag = GC_PAN_WITH_INERTIA; goto pan; case TOUCH_PANSFH: panFlag = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; goto pan; case TOUCH_PANSFV: panFlag = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; pan: if (++i >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing value", -1)); return TCL_ERROR; } if (Tcl_GetBooleanFromObj(interp, objv[i], &value) != TCL_OK) { return TCL_ERROR; } gcPan.dwID = GID_PAN; if (value) { gcPan.dwWant |= panFlag; } else { gcPan.dwBlock |= panFlag; } break; case TOUCH_PRESSANDTAP: if (++i >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing pressandtap", -1)); return TCL_ERROR; } if (Tcl_GetBooleanFromObj(interp, objv[i], &value) != TCL_OK) { return TCL_ERROR; } gc[gCnt].dwID = GID_PRESSANDTAP; if (value) { gc[gCnt++].dwWant = GC_PRESSANDTAP; } else { gc[gCnt++].dwBlock = GC_PRESSANDTAP; } break; case TOUCH_ROTATE: if (++i >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing rotate", -1)); return TCL_ERROR; } if (Tcl_GetBooleanFromObj(interp, objv[i], &value) != TCL_OK) { return TCL_ERROR; } gc[gCnt].dwID = GID_ROTATE; if (value) { gc[gCnt++].dwWant = GC_ROTATE; } else { gc[gCnt++].dwBlock = GC_ROTATE; } break; case TOUCH_TOUCH: touch = 1; break; case TOUCH_TWOFINGERTAP: if (++i >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing pressandtap", -1)); return TCL_ERROR; } if (Tcl_GetBooleanFromObj(interp, objv[i], &value) != TCL_OK) { return TCL_ERROR; } gc[gCnt].dwID = GID_TWOFINGERTAP; if (value) { gc[gCnt++].dwWant = GC_TWOFINGERTAP; } else { gc[gCnt++].dwBlock = GC_TWOFINGERTAP; } break; case TOUCH_WANTPALM: flags |= TWF_WANTPALM; touch = 1; break; case TOUCH_ZOOM: if (++i >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing zoom", -1)); return TCL_ERROR; } if (Tcl_GetBooleanFromObj(interp, objv[i], &value) != TCL_OK) { return TCL_ERROR; } gc[gCnt].dwID = GID_ZOOM; if (value) { gc[gCnt++].dwWant = GC_ZOOM; } else { gc[gCnt++].dwBlock = GC_ZOOM; } break; } } if (gcPan.dwID != 0) { gc[gCnt++] = gcPan; } win = Tk_WindowId((Tk_Window) winPtr); if (win == None) { Tk_MakeWindowExist((Tk_Window) winPtr); win = Tk_WindowId((Tk_Window) winPtr); } hwnd = Tk_GetHWND(win); if (touch) { /* TBD: support to unregister */ RegisterTouchWindow(hwnd, flags); } if (gCnt > 0) { SetGestureConfig(hwnd, 0, gCnt, gc, sizeof(GESTURECONFIG)); } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmTransientCmd -- * * This function is invoked to process the "wm transient" Tcl command. |
︙ | ︙ | |||
5604 5605 5606 5607 5608 5609 5610 | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't make \"%s\" a container: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; | | | 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't make \"%s\" a container: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; w = (TkWindow *)w->wmInfoPtr->containerPtr) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't set \"%s\" as container: would cause management loop", Tk_PathName(containerPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
5666 5667 5668 5669 5670 5671 5672 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmWithdrawCmd( | | < | 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmWithdrawCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
5720 5721 5722 5723 5724 5725 5726 | Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr); wmPtr->flags |= WM_UPDATE_PENDING; } } static void WmWaitVisibilityOrMapProc( | | | 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 | Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr); wmPtr->flags |= WM_UPDATE_PENDING; } } static void WmWaitVisibilityOrMapProc( void *clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { TkWindow *winPtr = (TkWindow *)clientData; TkWindow *containerPtr = winPtr->wmInfoPtr->containerPtr; if (containerPtr == NULL) return; |
︙ | ︙ | |||
5937 5938 5939 5940 5941 5942 5943 | * the structural change. * *---------------------------------------------------------------------- */ static void TopLevelEventProc( | | | 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 | * the structural change. * *---------------------------------------------------------------------- */ static void TopLevelEventProc( void *clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { Tk_ErrorHandler handler; |
︙ | ︙ | |||
5982 5983 5984 5985 5986 5987 5988 | * happens as a when-idle action). * *---------------------------------------------------------------------- */ static void TopLevelReqProc( | | < | 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 | * happens as a when-idle action). * *---------------------------------------------------------------------- */ static void TopLevelReqProc( TCL_UNUSED(void *), /* Not used. */ Tk_Window tkwin) /* Information about window. */ { TkWindow *winPtr = (TkWindow *) tkwin; WmInfo *wmPtr; wmPtr = winPtr->wmInfoPtr; if (wmPtr) { if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) { SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin), Tk_ReqHeight(tkwin)); } |
︙ | ︙ | |||
6025 6026 6027 6028 6029 6030 6031 | * from happening. * *---------------------------------------------------------------------- */ static void UpdateGeometryInfo( | | | 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 | * from happening. * *---------------------------------------------------------------------- */ static void UpdateGeometryInfo( void *clientData) /* Pointer to the window's record. */ { int x, y; /* Position of border on desktop. */ int width, height; /* Size of client area. */ int min, max; RECT rect; TkWindow *winPtr = (TkWindow *)clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; |
︙ | ︙ | |||
6534 6535 6536 6537 6538 6539 6540 | * Vroot window information is refreshed if it is out of date. * *---------------------------------------------------------------------- */ void Tk_GetVRootGeometry( | | < < | 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 | * Vroot window information is refreshed if it is out of date. * *---------------------------------------------------------------------- */ void Tk_GetVRootGeometry( TCL_UNUSED(Tk_Window),/* Window whose virtual root is to be * queried. */ int *xPtr, int *yPtr, /* Store x and y offsets of virtual root * here. */ int *widthPtr, int *heightPtr) /* Store dimensions of virtual root here. */ { *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN); *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN); *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN); *heightPtr = GetSystemMetrics(SM_CYVIRTUALSCREEN); } /* |
︙ | ︙ | |||
8006 8007 8008 8009 8010 8011 8012 | result = 0; goto done; case WM_NCHITTEST: { winPtr = GetTopLevel(hwnd); if (winPtr && (TkGrabState(winPtr) == TK_GRAB_EXCLUDED)) { /* | | | 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 | result = 0; goto done; case WM_NCHITTEST: { winPtr = GetTopLevel(hwnd); if (winPtr && (TkGrabState(winPtr) == TK_GRAB_EXCLUDED)) { /* * This window is outside the grab hierarchy, so don't let any of * the normal non-client processing occur. Note that this * implementation is not strictly correct because the grab might * change between now and when the event would have been processed * by Tk, but it's close enough. */ result = HTCLIENT; |
︙ | ︙ | |||
8325 8326 8327 8328 8329 8330 8331 | if (!IsWindow(eventPtr->hwnd)) { return 1; } /* * If the toplevel is in the middle of a move or size operation then * we must delay handling of this event to avoid stealing the focus | | | 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 | if (!IsWindow(eventPtr->hwnd)) { return 1; } /* * If the toplevel is in the middle of a move or size operation then * we must delay handling of this event to avoid stealing the focus * while the window manager is in control. */ if (eventPtr->flagPtr && *eventPtr->flagPtr) { return 0; } /* |
︙ | ︙ | |||
8393 8394 8395 8396 8397 8398 8399 | } /* *---------------------------------------------------------------------- * * TkpWinToplevelWithdraw -- * | | | 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 | } /* *---------------------------------------------------------------------- * * TkpWinToplevelWithdraw -- * * This function is to be used by a window manager to withdraw a toplevel * window. * * Results: * none * * Side effects: * May withdraw the toplevel window. |
︙ | ︙ | |||
8420 8421 8422 8423 8424 8425 8426 | } /* *---------------------------------------------------------------------- * * TkpWinToplevelIconify -- * | | | 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 | } /* *---------------------------------------------------------------------- * * TkpWinToplevelIconify -- * * This function is to be used by a window manager to iconify a toplevel * window. * * Results: * none * * Side effects: * May iconify the toplevel window. |
︙ | ︙ | |||
8444 8445 8446 8447 8448 8449 8450 | } /* *---------------------------------------------------------------------- * * TkpWinToplevelDeiconify -- * | | | 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 | } /* *---------------------------------------------------------------------- * * TkpWinToplevelDeiconify -- * * This function is to be used by a window manager to deiconify a toplevel * window. * * Results: * none * * Side effects: * May deiconify the toplevel window. |
︙ | ︙ | |||
8511 8512 8513 8514 8515 8516 8517 | } /* *---------------------------------------------------------------------- * * TkpWinGeometryIsControlledByWm -- * | | | 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 | } /* *---------------------------------------------------------------------- * * TkpWinGeometryIsControlledByWm -- * * This function is to be used by a window manager to see if wm has * canceled geometry control. * * Results: * 0 - if the window manager has canceled its control * 1 - if the window manager controls the geometry * * Side effects: |
︙ | ︙ |
Changes to win/tkWinX.c.
1 2 3 4 5 | /* * tkWinX.c -- * * This file contains Windows emulation procedures for X routines. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkWinX.c -- * * This file contains Windows emulation procedures for X routines. * * Copyright © 1995-1996 Sun Microsystems, Inc. * Copyright © 1994 Software Research Associates, Inc. * Copyright © 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" |
︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | * WM_UNICHAR is a message for Unicode input on all windows systems. * Perhaps this definition should be moved in another file. */ #ifndef WM_UNICHAR #define WM_UNICHAR 0x0109 #define UNICODE_NOCHAR 0xFFFF #endif /* * Declarations of static variables used in this file. */ static const char winScreenName[] = ":0"; /* Default name of windows display. */ static HINSTANCE tkInstance = NULL; /* Application instance handle. */ | > > > > > > > > > > > > > > > > > > > > > > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | * WM_UNICHAR is a message for Unicode input on all windows systems. * Perhaps this definition should be moved in another file. */ #ifndef WM_UNICHAR #define WM_UNICHAR 0x0109 #define UNICODE_NOCHAR 0xFFFF #endif #ifndef WM_TOUCH #define WM_TOUCH 0x0240 #endif #ifndef WM_GESTURE #define WM_GESTURE 0x0119 #endif /* * Helpers for touch event to fill in its dictionary. */ #define ADD_DICT_STR(d, s, v) \ Tcl_DictObjPut(NULL, d, Tcl_NewStringObj(s, -1), Tcl_NewStringObj(v, -1)) #define ADD_DICT_INT(d, s, v) \ Tcl_DictObjPut(NULL, d, Tcl_NewStringObj(s, -1), Tcl_NewIntObj(v)) #define ADD_DICT_WIDE(d, s, v) \ Tcl_DictObjPut(NULL, d, Tcl_NewStringObj(s, -1), Tcl_NewWideIntObj(v)) #define ADD_DICT_DOUB(d, s, v) \ Tcl_DictObjPut(NULL, d, Tcl_NewStringObj(s, -1), Tcl_NewDoubleObj(v)) /* * Declarations of static variables used in this file. */ static const char winScreenName[] = ":0"; /* Default name of windows display. */ static HINSTANCE tkInstance = NULL; /* Application instance handle. */ |
︙ | ︙ | |||
76 77 78 79 80 81 82 | */ typedef struct { TkDisplay *winDisplay; /* TkDisplay structure that represents Windows * screen. */ int updatingClipboard; /* If 1, we are updating the clipboard. */ int surrogateBuffer; /* Buffer for first of surrogate pair. */ | | < | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | */ typedef struct { TkDisplay *winDisplay; /* TkDisplay structure that represents Windows * screen. */ int updatingClipboard; /* If 1, we are updating the clipboard. */ int surrogateBuffer; /* Buffer for first of surrogate pair. */ DWORD wheelTickPrev; /* For high resolution wheels. */ int vWheelAcc; /* For high resolution wheels (vertical). */ int hWheelAcc; /* For high resolution wheels (horizontal). */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations of functions used in this file. */ |
︙ | ︙ | |||
124 125 126 127 128 129 130 | * display and server. */ { static char buffer[32]; /* Empty string means not initialized yet. */ OSVERSIONINFOW os; (void)tkwin; if (!buffer[0]) { | < < < < < | < | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | * display and server. */ { static char buffer[32]; /* Empty string means not initialized yet. */ OSVERSIONINFOW os; (void)tkwin; if (!buffer[0]) { GetVersionExW(&os); /* Write the first character last, preventing multi-thread issues. */ sprintf(buffer+1, "indows %d.%d %d %s", (int)os.dwMajorVersion, (int)os.dwMinorVersion, (int)os.dwBuildNumber, #ifdef _WIN64 "Win64" #else "Win32" |
︙ | ︙ | |||
523 524 525 526 527 528 529 | TkDisplay * TkpOpenDisplay( const char *display_name) { Display *display; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | < | < < | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | TkDisplay * TkpOpenDisplay( const char *display_name) { Display *display; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->winDisplay != NULL) { if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) { return tsdPtr->winDisplay; } else { return NULL; } } display = XkbOpenDisplay((char *)display_name, NULL, NULL, NULL, NULL, NULL); TkWinDisplayChanged(display); tsdPtr->winDisplay =(TkDisplay *) ckalloc(sizeof(TkDisplay)); ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay)); tsdPtr->winDisplay->display = display; tsdPtr->updatingClipboard = FALSE; tsdPtr->wheelTickPrev = GetTickCount(); tsdPtr->vWheelAcc = 0; tsdPtr->hWheelAcc = 0; /* * Key map info must be available immediately, because of "send event". */ TkpInitKeymapInfo(tsdPtr->winDisplay); |
︙ | ︙ | |||
830 831 832 833 834 835 836 837 838 839 840 841 842 843 | Tcl_ServiceAll(); return result; } /* *---------------------------------------------------------------------- * * TkTranslateWinEvent -- * * This function is called by widget window functions to handle the * translation from Win32 events to Tk events. * * Results: * Returns 1 if the event was handled, else 0. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | Tcl_ServiceAll(); return result; } /* *---------------------------------------------------------------------- * * InitTouchEvent -- * * This function initialises an event structure with the base * fields used in a TouchEvent. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void InitTouchEvent(XEvent *event, HWND hwnd, int rootx, int rooty) { POINT sInput, cInput; Tk_Window tkwin; TkWindow *winPtr; sInput.x = rootx; sInput.y = rooty; cInput = sInput; ScreenToClient(hwnd, &cInput); tkwin = Tk_HWNDToWindow(hwnd); winPtr = (TkWindow *)tkwin; memset(event, 0, sizeof(*event)); event->xany.type = VirtualEvent; event->xany.serial = LastKnownRequestProcessed(winPtr->display); event->xany.send_event = False; event->xany.window = Tk_WindowId(tkwin); event->xany.display = winPtr->display; event->xkey.root = RootWindow(winPtr->display,winPtr->screenNum); event->xkey.x_root = sInput.x; event->xkey.y_root = sInput.y; event->xkey.x = cInput.x; event->xkey.y = cInput.y; } /* *---------------------------------------------------------------------- * * GenerateTouchEvent -- * * This function generate touch events when a WM_TOUCH event has * been received. * * Results: * Returns 1 if the event was handled, else 0. * * Side effects: * May queue one or more X events. * *---------------------------------------------------------------------- */ static int GenerateTouchEvent( HWND hwnd, WPARAM wParam, LPARAM lParam) { BOOL bHandled = FALSE; UINT cInputs = LOWORD(wParam); PTOUCHINPUT pInputs = ckalloc(sizeof(TOUCHINPUT)*cInputs); union {XEvent general; XVirtualEvent virtual;} event; Tcl_Obj *dictPtr; if (pInputs != NULL) { if (GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))) { for (UINT i=0; i < cInputs; i++){ TOUCHINPUT ti = pInputs[i]; InitTouchEvent(&event.general, hwnd, TOUCH_COORD_TO_PIXEL(ti.x), TOUCH_COORD_TO_PIXEL(ti.y)); /* * Which info needs to be passed to the event, and how should * is be passed ? * Put it into a dict and pass it through %d */ dictPtr = Tcl_NewDictObj(); Tcl_IncrRefCount(dictPtr); /* Identify as a touch event */ ADD_DICT_STR(dictPtr, "event", "touch"); /* Touch ID */ ADD_DICT_INT(dictPtr, "id", ti.dwID); /* Raw flags value */ ADD_DICT_INT(dictPtr, "flags", ti.dwFlags); /* Decode known flags */ if (ti.dwFlags & TOUCHEVENTF_MOVE) { ADD_DICT_INT(dictPtr, "move", 1); event.virtual.name = Tk_GetUid("FingerMotion"); } if (ti.dwFlags & TOUCHEVENTF_DOWN) { ADD_DICT_INT(dictPtr, "down", 1); event.virtual.name = Tk_GetUid("FingerDown"); } if (ti.dwFlags & TOUCHEVENTF_UP) { ADD_DICT_INT(dictPtr, "up", 1); event.virtual.name = Tk_GetUid("FingerUp"); } if (ti.dwFlags & TOUCHEVENTF_INRANGE) { ADD_DICT_INT(dictPtr, "inrange", 1); } if (ti.dwFlags & TOUCHEVENTF_PRIMARY) { ADD_DICT_INT(dictPtr, "primary", 1); } if (ti.dwFlags & TOUCHEVENTF_NOCOALESCE) { ADD_DICT_INT(dictPtr, "nocoalesce", 1); } if (ti.dwFlags & TOUCHEVENTF_PALM) { ADD_DICT_INT(dictPtr, "palm", 1); } event.virtual.user_data = dictPtr; Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } bHandled = TRUE; } ckfree(pInputs); } if (bHandled) { CloseTouchInputHandle((HTOUCHINPUT)lParam); return 1; } return 0; } /* *---------------------------------------------------------------------- * * GenerateGestureEvent -- * * This function generate touch events when a WM_GESTURE event has * been received. * * Results: * Returns 1 if the event was handled, else 0. * * Side effects: * May queue an X event. * *---------------------------------------------------------------------- */ static int GenerateGestureEvent( HWND hwnd, TCL_UNUSED(WPARAM), LPARAM lParam) { GESTUREINFO gi; union {XEvent general; XVirtualEvent virtual;} event; Tcl_Obj *dictPtr; POINT sLoc, delta; POINTS pts; UINT LInt, HInt; ZeroMemory(&gi, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); if (!GetGestureInfo((HGESTUREINFO)lParam, &gi)){ return 0; } /* Is it something we want to handle? */ switch (gi.dwID) { case GID_BEGIN: case GID_END: /* These should not be handled */ return 0; case GID_ZOOM: case GID_PAN: case GID_ROTATE: case GID_TWOFINGERTAP: case GID_PRESSANDTAP: break; default: /* A gesture was not recognized */ return 0; } POINTSTOPOINT(sLoc, gi.ptsLocation); InitTouchEvent(&event.general, hwnd, sLoc.x, sLoc.y); event.virtual.name = Tk_GetUid("Gesture"); dictPtr = Tcl_NewDictObj(); Tcl_IncrRefCount(dictPtr); /* Identify as a gesture event */ ADD_DICT_STR(dictPtr, "event", "gesture"); /* Raw flags value */ ADD_DICT_INT(dictPtr, "flags", gi.dwFlags); /* Decode known flags */ if (gi.dwFlags & GF_BEGIN) { ADD_DICT_INT(dictPtr, "begin", 1); } if (gi.dwFlags & GF_INERTIA) { ADD_DICT_INT(dictPtr, "inertia", 1); } if (gi.dwFlags & GF_END) { ADD_DICT_INT(dictPtr, "end", 1); } LInt = (UINT) (gi.ullArguments & 0xFFFFFFFF); HInt = (UINT) (gi.ullArguments >> 32); switch (gi.dwID){ case GID_ZOOM: ADD_DICT_STR(dictPtr, "gesture", "zoom"); ADD_DICT_WIDE(dictPtr, "distance", gi.ullArguments); event.virtual.name = Tk_GetUid("PinchToZoom"); break; case GID_PAN: ADD_DICT_STR(dictPtr, "gesture", "pan"); ADD_DICT_WIDE(dictPtr, "distance", LInt); if (gi.dwFlags & GF_INERTIA) { pts = MAKEPOINTS(HInt); ADD_DICT_INT(dictPtr, "inertiax", pts.x); ADD_DICT_INT(dictPtr, "inertiay", pts.y); } break; case GID_ROTATE: ADD_DICT_STR(dictPtr, "gesture", "rotate"); ADD_DICT_DOUB(dictPtr, "angle", GID_ROTATE_ANGLE_FROM_ARGUMENT(gi.ullArguments)); break; case GID_TWOFINGERTAP: ADD_DICT_STR(dictPtr, "gesture", "twofingertap"); ADD_DICT_WIDE(dictPtr, "distance", gi.ullArguments); break; case GID_PRESSANDTAP: ADD_DICT_STR(dictPtr, "gesture", "pressandtap"); pts = MAKEPOINTS(LInt); POINTSTOPOINT(delta, pts); ADD_DICT_INT(dictPtr, "deltax", delta.x); ADD_DICT_INT(dictPtr, "deltay", delta.y); break; } event.virtual.user_data = dictPtr; Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); return 1; } /* *---------------------------------------------------------------------- * * TkTranslateWinEvent -- * * This function is called by widget window functions to handle the * translation from Win32 events to Tk events. * * Results: * Returns 1 if the event was handled, else 0. |
︙ | ︙ | |||
917 918 919 920 921 922 923 924 925 926 927 928 929 930 | case WM_MBUTTONUP: case WM_RBUTTONUP: case WM_XBUTTONUP: case WM_MOUSEMOVE: TkWinPointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam)); return 1; case WM_SYSKEYDOWN: case WM_KEYDOWN: if (wParam == VK_PACKET) { /* * This will trigger WM_CHAR event(s) with unicode data. */ *resultPtr = | > > > > > > | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | case WM_MBUTTONUP: case WM_RBUTTONUP: case WM_XBUTTONUP: case WM_MOUSEMOVE: TkWinPointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam)); return 1; case WM_TOUCH: return GenerateTouchEvent(hwnd, wParam, lParam); case WM_GESTURE: return GenerateGestureEvent(hwnd, wParam, lParam); case WM_SYSKEYDOWN: case WM_KEYDOWN: if (wParam == VK_PACKET) { /* * This will trigger WM_CHAR event(s) with unicode data. */ *resultPtr = |
︙ | ︙ | |||
1143 1144 1145 1146 1147 1148 1149 1150 | switch (message) { case WM_MOUSEWHEEL: { /* * Support for high resolution wheels (vertical). */ DWORD wheelTick = GetTickCount(); | > > | < < > | | | > > > > > > | | > > | < < > | | | > > > > > > | | | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 | switch (message) { case WM_MOUSEWHEEL: { /* * Support for high resolution wheels (vertical). */ DWORD wheelTick = GetTickCount(); BOOL timeout = wheelTick - tsdPtr->wheelTickPrev >= 300; int intDelta; tsdPtr->wheelTickPrev = wheelTick; if (timeout) { tsdPtr->vWheelAcc = tsdPtr->hWheelAcc = 0; } tsdPtr->vWheelAcc += (short) HIWORD(wParam); if (!tsdPtr->vWheelAcc || (!timeout && abs(tsdPtr->vWheelAcc) < WHEEL_DELTA * 6 / 10)) { return; } /* * We have invented a new X event type to handle this event. It * still uses the KeyPress struct. However, the keycode field has * been overloaded to hold the zDelta of the wheel. Set nbytes to * 0 to prevent conversion of the keycode to a keysym in * TkpGetString. [Bug 1118340]. */ intDelta = (abs(tsdPtr->vWheelAcc) + WHEEL_DELTA/2) / WHEEL_DELTA * WHEEL_DELTA; if (intDelta == 0) { intDelta = (tsdPtr->vWheelAcc < 0) ? -WHEEL_DELTA : WHEEL_DELTA; } else if (tsdPtr->vWheelAcc < 0) { intDelta = -intDelta; } event.x.type = MouseWheelEvent; event.x.xany.send_event = -1; event.key.nbytes = 0; event.x.xkey.keycode = intDelta; tsdPtr->vWheelAcc -= intDelta; break; } case WM_MOUSEHWHEEL: { /* * Support for high resolution wheels (horizontal). */ DWORD wheelTick = GetTickCount(); BOOL timeout = wheelTick - tsdPtr->wheelTickPrev >= 300; int intDelta; tsdPtr->wheelTickPrev = wheelTick; if (timeout) { tsdPtr->vWheelAcc = tsdPtr->hWheelAcc = 0; } tsdPtr->hWheelAcc -= (short) HIWORD(wParam); if (!tsdPtr->hWheelAcc || (!timeout && abs(tsdPtr->hWheelAcc) < WHEEL_DELTA * 6 / 10)) { return; } /* * We have invented a new X event type to handle this event. It * still uses the KeyPress struct. However, the keycode field has * been overloaded to hold the zDelta of the wheel. Set nbytes to * 0 to prevent conversion of the keycode to a keysym in * TkpGetString. [Bug 1118340]. */ intDelta = (abs(tsdPtr->hWheelAcc) + WHEEL_DELTA/2) / WHEEL_DELTA * WHEEL_DELTA; if (intDelta == 0) { intDelta = (tsdPtr->hWheelAcc < 0) ? -WHEEL_DELTA : WHEEL_DELTA; } else if (tsdPtr->hWheelAcc < 0) { intDelta = -intDelta; } event.x.type = MouseWheelEvent; event.x.xany.send_event = -1; event.key.nbytes = 0; event.x.xkey.state |= ShiftMask; event.x.xkey.keycode = intDelta; tsdPtr->hWheelAcc -= intDelta; break; } case WM_SYSKEYDOWN: case WM_KEYDOWN: /* * Check for translated characters in the event queue. Setting * xany.send_event to -1 indicates to the Windows implementation |
︙ | ︙ | |||
1437 1438 1439 1440 1441 1442 1443 | TkKeyEvent *xkey, UINT type) { MSG msg; xkey->nbytes = 0; | | | 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 | TkKeyEvent *xkey, UINT type) { MSG msg; xkey->nbytes = 0; while ((xkey->nbytes < sizeof(xkey->trans_chars)) && (PeekMessageA(&msg, NULL, type, type, PM_NOREMOVE) != 0)) { if (msg.message != type) { break; } GetMessageA(&msg, NULL, type, type); |
︙ | ︙ |
Added win/touch.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | # Example usage of the touch interface if 0 { The current interface is as follows. All configuration is done via: wm touch <win> ?options? Some gestures are on by default. It seems like all but rotate. To get raw touch events, they must be turned on. To control gestures: -all : Turn on all gestures -pressandtap <bool> : Turn on or off PressAndTap gesture -rotate <bool> : Turn on or off Rotate gesture -twofingertap <bool> : Turn on or off TwoFingerTap gesture -zoom <bool> : Turn on or off Zoom gesture -pan <bool> : Turn on or off Pan gestures -pansfh <bool> : Turn on or off Pan single finger horizontal gesture -pansfv <bool> : Turn on or off Pan single finger vertical gesture -pangutter <bool> : Turn on or off Pan gutter mode -paninertia <bool> : Turn on or off Pan inertial mode See GESTURECONFIG in win API for pan flags. To get raw touch events: If any of the flags -touch, -fine or -wantpalm is given, the window is registered to receive raw touch event. It will no longer receive any gesture events. The flags -fine/-wantpalm corresponds to the Windows API RegisterTouchWindow. Events are received as virtual events. These events support at least base %W %x %y %X %Y fields. All extra information is given in a dictionary in the %d field. <<FingerDown>> <<FingerUp>> <<FingerMotion>> : Raw touch events <<PinchToZoom>> : Zoom gesture <<Gesture>> : Other gestures Any boolean field in the dictionary is either present with the value 1 or not present. Below they are written without a value. Touch fields: event = touch : Identify event as a touch. (i.e. not a gesture) id <val> : Id to know what events belong to the same touch. flags <val> : Raw flags value, in case future flags are provided. down : Start of touch move : Touch is moving up : End of touch primary : First touch in a multi touch. Primary touch might also cause button events. inrange/nocoalesce/palm : See TOUCHINPUT in Windows API. Gesture fields: event = gesture : Identify event as a gesture. flags <val> : Raw flags value, in case future flags are provided. begin : Start of gesture end : End of gesture inertia : Gesture has triggered inertia Note that begin and end can both be set, e.g. in two finger tap. gesture <type> : Where type is one of: zoom : Zoom gesture. %x/y is between fingers pan : Pan gesture. %x/y is between fingers rotate : Rotate gesture. %x/y is between fingers twofingertap : Two finger tap gesture. %x/y is between fingers pressandtap : Press and tap gesture. %x/y is first finger distance <i> : For zoom/pan/twofingertap: Distance between fingers. angle <r> : For rotate: Rotation angle in radians. deltax <i> : For pressandtap: Locates second finger. Valid with begin. deltay <i> : For pressandtap: Locates second finger. Valid with begin. inertiax <i> : For pan: Inertia vector. Valid with inertia flag. inertiay <i> : For pan: Inertia vector. Valid with inertia flag. } namespace import tcl::mathop::* proc rndCol {} { set lst {orange yellow green cyan blue purple violet pink} set i [expr {int(rand()*[llength $lst])}] return [lindex $lst $i] } proc Circle {w x y r args} { $w create oval [- $x $r] [- $y $r] [+ $x $r] [+ $y $r] \ -fill "" -outline black -width 2 {*}$args } proc Touch1 {W d x y X Y} { set id [dict get $d id] set move [dict exists $d move] set down [dict exists $d down] set up [dict exists $d up] set primary [dict exists $d primary] if {![info exists ::t($id,id)]} { set ::t($id,id) [$W create oval $x $y $x $y] if {$primary} { $W itemconfigure $::t($id,id) -fill red } else { $W itemconfigure $::t($id,id) -fill [rndCol] } } if {$up} { $W delete $::t($id,id) array unset ::t $id,* return } # Filter unnecessary movement if {$move && $x == $::t($id,x) && $y == $::t($id,y)} { return } set r [expr {[winfo screenwidth .] / 50}] set ::t($id,x) $x set ::t($id,y) $y $W coords $::t($id,id) [- $x $r] [- $y $r] [+ $x $r] [+ $y $r] } proc Log {W d} { # Make a little log of messages for now if {[lindex $::messages 9] ne $d} { lappend ::messages $d set ::messages [lrange $::messages end-9 end] } set txt [join $::messages \n] $W itemconfigure gesture -text $txt $W raise gesture } proc Touch2 {W d x y X Y} { if {[dict get $d event] ne "gesture"} return switch [dict get $d gesture] { twofingertap { $W delete twofingertap set r [expr {[dict get $d distance] / 2}] Circle $W $x $y $r -fill yellow -tags twofingertap } pressandtap { if {[dict exists $d begin]} { # Only the begin message has delta set $W delete pressandtap set x1 [expr {$x + [dict get $d deltax]}] set y1 [expr {$y + [dict get $d deltay]}] $W create line $x $y $x1 $y1 -width 5 -fill red \ -tags pressandtap } if {[dict exists $d end]} { # Make end visible by changing colour $W itemconfigure pressandtap -fill purple } } zoom { $W delete zoom set r [expr {[dict get $d distance] / 2}] Circle $W $x $y $r -fill blue -tags zoom } pan { $W delete pan set dist [dict get $d distance] if {$dist == 0} { # Must be one finger? set r 40 set col red } else { set r [expr {$dist / 2}] set col green } Circle $W $x $y $r -fill $col -tags pan } rotate { $W delete rotate set a [expr {180.0*[dict get $d angle]/3.141592 - 20}] set r [expr {$::size/4}] $W create arc [- $x $r] [- $y $r] [+ $x $r] [+ $y $r] \ -fill orange -outline black -width 2 -tags rotate \ -start $a -extent 40 } } Log $W $d } console show set ::size [expr {[winfo screenwidth .] / 4}] canvas .c1 -width $::size -height $::size -bd 3 -relief solid canvas .c2 -width $::size -height $::size -bd 3 -relief solid canvas .c3 -width $::size -height $::size -bd 3 -relief solid .c1 create text [expr {$::size /2}] [expr {$::size /2}] -text Touch lappend ::messages "Gesture" .c2 create text [expr {$::size / 2}] [expr {$::size / 2}] -text GestureAll -tags gesture .c3 create text [expr {$::size / 2}] [expr {$::size / 2}] -text Gesture -tags gesture grid .c1 - -sticky news grid .c2 .c3 -sticky news grid columnconfigure . all -weight 1 grid rowconfigure . all -weight 1 wm touch .c1 -touch wm touch .c2 -all wm touch .c3 -pan 1 -pansfv 0 -pansfh 0 -pangutter 0 -paninertia 0 bind .c1 <<FingerDown>> "Touch1 %W %d %x %y %X %Y" bind .c1 <<FingerUp>> "Touch1 %W %d %x %y %X %Y" bind .c1 <<FingerMotion>> "Touch1 %W %d %x %y %X %Y" bind .c2 <<Gesture>> "Touch2 %W %d %x %y %X %Y" bind .c2 <<PinchToZoom>> "Touch2 %W %d %x %y %X %Y" bind .c3 <<Gesture>> "Touch2 %W %d %x %y %X %Y" bind .c3 <<PinchToZoom>> "Touch2 %W %d %x %y %X %Y" |
Changes to win/ttkWinMonitor.c.
1 2 3 4 | #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN #endif | | | 1 2 3 4 5 6 7 8 9 10 11 12 | #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN #endif #include "tkWinInt.h" #include "ttk/ttkTheme.h" #if !defined(WM_THEMECHANGED) #define WM_THEMECHANGED 0x031A #endif static LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); |
︙ | ︙ |
Changes to win/ttkWinTheme.c.
|
| | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* winTheme.c - Copyright © 2004 Pat Thoyts <[email protected]> */ #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN #endif #include "tkWinInt.h" #ifndef DFCS_HOT /* Windows 98/Me, Windows 2000/XP only */ #define DFCS_HOT 0 #endif #include "ttk/ttkTheme.h" |
︙ | ︙ |
Changes to win/ttkWinXPTheme.c.
1 2 3 4 | /* * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. * * Copyright © 2003 Georgios Petasis, [email protected]. * Copyright © 2003 Joe English * Copyright © 2003 Pat Thoyts * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * See also: * * <URL: http://msdn.microsoft.com/library/en-us/ * shellcc/platform/commctls/userex/refentry.asp > */ #include "tkWinInt.h" #ifndef HAVE_UXTHEME_H /* Stub for platforms that lack the XP theme API headers: */ int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; } #else #include <windows.h> #include <uxtheme.h> |
︙ | ︙ | |||
834 835 836 837 838 839 840 | const char *src; TkSizeT len; Tcl_DString ds; if (!InitElementData(elementData, tkwin, 0)) return; | | | | 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | const char *src; TkSizeT len; Tcl_DString ds; if (!InitElementData(elementData, tkwin, 0)) return; src = Tcl_GetStringFromObj(element->textObj, &len); Tcl_DStringInit(&ds); hr = elementData->procs->GetThemeTextExtent( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, 0), Tcl_UtfToWCharDString(src, len, &ds), -1, DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, NULL, &rc); if (SUCCEEDED(hr)) { *widthPtr = rc.right - rc.left; *heightPtr = rc.bottom - rc.top; } |
︙ | ︙ | |||
873 874 875 876 877 878 879 | const char *src; TkSizeT len; Tcl_DString ds; if (!InitElementData(elementData, tkwin, d)) return; | | | | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | const char *src; TkSizeT len; Tcl_DString ds; if (!InitElementData(elementData, tkwin, d)) return; src = Tcl_GetStringFromObj(element->textObj, &len); Tcl_DStringInit(&ds); hr = elementData->procs->DrawThemeText( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, state), Tcl_UtfToWCharDString(src, len, &ds), -1, DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0, &rc); Tcl_DStringFree(&ds); FreeElementData(elementData); } |
︙ | ︙ | |||
1123 1124 1125 1126 1127 1128 1129 | TkSizeT length = 0; char *name; LPWSTR wname; const Ttk_ElementSpec *elementSpec = &GenericElementSpec; Tcl_DString classBuf; static const char *const optionStrings[] = | | | | | | | | | 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | TkSizeT length = 0; char *name; LPWSTR wname; const Ttk_ElementSpec *elementSpec = &GenericElementSpec; Tcl_DString classBuf; static const char *const optionStrings[] = { "-halfheight", "-halfwidth", "-height", "-margins", "-padding", "-syssize", "-width", NULL }; enum { O_HALFHEIGHT, O_HALFWIDTH, O_HEIGHT, O_MARGINS, O_PADDING, O_SYSSIZE, O_WIDTH }; if (objc < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing required arguments 'class' and/or 'partId'", -1)); Tcl_SetErrorCode(interp, "TTK", "VSAPI", "REQUIRED", NULL); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[1], &partId) != TCL_OK) { return TCL_ERROR; } name = Tcl_GetStringFromObj(objv[0], &length); Tcl_DStringInit(&classBuf); className = Tcl_UtfToWCharDString(name, length, &classBuf); /* flags or padding */ if (objc > 3) { int i = 3, option = 0; for (i = 3; i < objc; i += 2) { int tmp = 0; if (i == objc -1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Missing value for \"%s\".", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TTK", "VSAPI", "MISSING", NULL); goto retErr; } if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0, &option) != TCL_OK) goto retErr; switch (option) { case O_PADDING: if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK) { goto retErr; } break; |
︙ | ︙ |
Changes to win/winMain.c.
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 | #include "tk.h" #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN #include <locale.h> #include <stdlib.h> #include <tchar.h> #if defined(__GNUC__) int _CRT_glob = 0; #endif /* __GNUC__ */ | > > > > < | | > > | > > > > > | | | | | > > > > > > | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | #include "tk.h" #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN #include <locale.h> #include <stdlib.h> #include <tchar.h> #if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 # define Tcl_LibraryInitProc Tcl_PackageInitProc # define Tcl_StaticLibrary Tcl_StaticPackage #endif #if defined(__GNUC__) int _CRT_glob = 0; #endif /* __GNUC__ */ #ifdef __cplusplus extern "C" { #endif #ifdef TK_TEST extern Tcl_LibraryInitProc Tktest_Init; #endif /* TK_TEST */ #if !defined(TCL_USE_STATIC_PACKAGES) # if TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6 # define TCL_USE_STATIC_PACKAGES 1 # else # define TCL_USE_STATIC_PACKAGES 0 # endif #endif #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES extern Tcl_LibraryInitProc Registry_Init; extern Tcl_LibraryInitProc Dde_Init; extern Tcl_LibraryInitProc Dde_SafeInit; #endif #ifdef __cplusplus } #endif #ifdef TCL_BROKEN_MAINARGS static void setargv(int *argcPtr, TCHAR ***argvPtr); #endif /* * Forward declarations for procedures defined later in this file: */ static BOOL consoleRequired = TRUE; /* * The following #if block allows you to change the AppInit function by using * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The * #if checks for that #define and uses Tcl_AppInit if it doesn't exist. */ #ifndef TK_LOCAL_APPINIT #define TK_LOCAL_APPINIT Tcl_AppInit #endif #ifndef MODULE_SCOPE # ifdef __cplusplus # define MODULE_SCOPE extern "C" # else # define MODULE_SCOPE extern # endif #endif MODULE_SCOPE int TK_LOCAL_APPINIT(Tcl_Interp *interp); /* * The following #if block allows you to change how Tcl finds the startup * script, prime the library or encoding paths, fiddle with the argv, etc., * without needing to rewrite Tk_Main() |
︙ | ︙ | |||
186 187 188 189 190 191 192 193 194 195 | int Tcl_AppInit( Tcl_Interp *interp) /* Interpreter for application. */ { if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } | > > > > > > > > > > > | < < < < < < < < < < < < | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | int Tcl_AppInit( Tcl_Interp *interp) /* Interpreter for application. */ { if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES if (Registry_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticLibrary(interp, "Registry", Registry_Init, 0); if (Dde_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticLibrary(interp, "Dde", Dde_Init, Dde_SafeInit); #endif if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticLibrary(interp, "Tk", Tk_Init, Tk_SafeInit); /* * Initialize the console only if we are running as an interactive * application. */ if (consoleRequired) { if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { return TCL_ERROR; } } #ifdef TK_TEST if (Tktest_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticLibrary(interp, "Tktest", Tktest_Init, 0); #endif /* TK_TEST */ /* * Call the init procedures for included packages. Each call should look * like this: * * if (Mod_Init(interp) == TCL_ERROR) { |
︙ | ︙ |
Changes to win/wish.exe.manifest.in.
︙ | ︙ | |||
24 25 26 27 28 29 30 | <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> <!-- Windows 8.1 --> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> <!-- Windows 8 --> <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> | < < > > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> <!-- Windows 8.1 --> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> <!-- Windows 8 --> <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> </application> </compatibility> <asmv3:application> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>true</dpiAware> </asmv3:windowsSettings> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings"> <activeCodePage>UTF-8</activeCodePage> </asmv3:windowsSettings> </asmv3:application> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" |
︙ | ︙ |
Added win/x86_64-w64-mingw32-nmakehlp.exe.
cannot compute difference between binary files
Changes to xlib/X11/HPkeysym.h.
︙ | ︙ | |||
42 43 44 45 46 47 48 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFTWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. */ |
︙ | ︙ |
Changes to xlib/X11/XF86keysym.h.
1 2 3 4 5 | /* * XFree86 vendor specific keysyms. * * The XFree86 keysym range is 0x10080001 - 0x1008FFFF. * | | > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * XFree86 vendor specific keysyms. * * The XFree86 keysym range is 0x10080001 - 0x1008FFFF. * * The XF86 set of keysyms is a catch-all set of defines for keysyms found * on various multimedia keyboards. Originally specific to XFree86 they have * been been adopted over time and are considered a "standard" part of X * keysym definitions. * XFree86 never properly commented these keysyms, so we have done our * best to explain the semantic meaning of these keys. * * XFree86 has removed their mail archives of the period, that might have * shed more light on some of these definitions. Until/unless we resurrect * these archives, these are from memory and usage. */ |
︙ | ︙ | |||
203 204 205 206 207 208 209 210 211 212 213 214 215 216 | #define XF86XK_WWAN 0x1008FFB4 /* Toggle WWAN (LTE, UMTS, etc.) radio */ #define XF86XK_RFKill 0x1008FFB5 /* Toggle radios on/off */ #define XF86XK_AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. theatre-mode */ #define XF86XK_RotationLockToggle 0x1008FFB7 /* Toggle screen rotation lock on/off */ /* Keys for special action keys (hot keys) */ /* Virtual terminals on some operating systems */ #define XF86XK_Switch_VT_1 0x1008FE01 #define XF86XK_Switch_VT_2 0x1008FE02 #define XF86XK_Switch_VT_3 0x1008FE03 #define XF86XK_Switch_VT_4 0x1008FE04 #define XF86XK_Switch_VT_5 0x1008FE05 | > > | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | #define XF86XK_WWAN 0x1008FFB4 /* Toggle WWAN (LTE, UMTS, etc.) radio */ #define XF86XK_RFKill 0x1008FFB5 /* Toggle radios on/off */ #define XF86XK_AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. theatre-mode */ #define XF86XK_RotationLockToggle 0x1008FFB7 /* Toggle screen rotation lock on/off */ #define XF86XK_FullScreen 0x1008FFB8 /* Toggle fullscreen */ /* Keys for special action keys (hot keys) */ /* Virtual terminals on some operating systems */ #define XF86XK_Switch_VT_1 0x1008FE01 #define XF86XK_Switch_VT_2 0x1008FE02 #define XF86XK_Switch_VT_3 0x1008FE03 #define XF86XK_Switch_VT_4 0x1008FE04 #define XF86XK_Switch_VT_5 0x1008FE05 |
︙ | ︙ | |||
224 225 226 227 228 229 230 | #define XF86XK_Ungrab 0x1008FE20 /* force ungrab */ #define XF86XK_ClearGrab 0x1008FE21 /* kill application with grab */ #define XF86XK_Next_VMode 0x1008FE22 /* next video mode available */ #define XF86XK_Prev_VMode 0x1008FE23 /* prev. video mode available */ #define XF86XK_LogWindowTree 0x1008FE24 /* print window tree to log */ #define XF86XK_LogGrabInfo 0x1008FE25 /* print all active grabs to log */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | #define XF86XK_Ungrab 0x1008FE20 /* force ungrab */ #define XF86XK_ClearGrab 0x1008FE21 /* kill application with grab */ #define XF86XK_Next_VMode 0x1008FE22 /* next video mode available */ #define XF86XK_Prev_VMode 0x1008FE23 /* prev. video mode available */ #define XF86XK_LogWindowTree 0x1008FE24 /* print window tree to log */ #define XF86XK_LogGrabInfo 0x1008FE25 /* print all active grabs to log */ /* * Reserved range for evdev symbols: 0x10081000-0x10081FFF * * Key syms within this range must match the Linux kernel * input-event-codes.h file in the format: * XF86XK_CamelCaseKernelName _EVDEVK(kernel value) * For example, the kernel * #define KEY_MACRO_RECORD_START 0x2b0 * effectively ends up as: * #define XF86XK_MacroRecordStart 0x100812b0 * * For historical reasons, some keysyms within the reserved range will be * missing, most notably all "normal" keys that are mapped through default * XKB layouts (e.g. KEY_Q). * * CamelCasing is done with a human control as last authority, e.g. see VOD * instead of Vod for the Video on Demand key. * * The format for #defines is strict: * * #define XF86XK_FOO<tab...>_EVDEVK(0xABC)<tab><tab> |* kver KEY_FOO *| * * Where * - alignment by tabs * - the _EVDEVK macro must be used * - the hex code must be in uppercase hex * - the kernel version (kver) is in the form v5.10 * - kver and key name are within a slash-star comment (a pipe is used in * this example for technical reasons) * These #defines are parsed by scripts. Do not stray from the given format. * * Where the evdev keycode is mapped to a different symbol, please add a * comment line starting with Use: but otherwise the same format, e.g. * Use: XF86XK_RotationLockToggle _EVDEVK(0x231) v4.16 KEY_ROTATE_LOCK_TOGGLE * */ #define _EVDEVK(_v) (0x10081000 + _v) /* Use: XF86XK_Eject _EVDEVK(0x0A2) KEY_EJECTCLOSECD */ /* Use: XF86XK_New _EVDEVK(0x0B5) v2.6.14 KEY_NEW */ /* Use: XK_Redo _EVDEVK(0x0B6) v2.6.14 KEY_REDO */ /* KEY_DASHBOARD has been mapped to LaunchB in xkeyboard-config since 2011 */ /* Use: XF86XK_LaunchB _EVDEVK(0x0CC) v2.6.28 KEY_DASHBOARD */ /* Use: XF86XK_Display _EVDEVK(0x0E3) v2.6.12 KEY_SWITCHVIDEOMODE */ /* Use: XF86XK_KbdLightOnOff _EVDEVK(0x0E4) v2.6.12 KEY_KBDILLUMTOGGLE */ /* Use: XF86XK_KbdBrightnessDown _EVDEVK(0x0E5) v2.6.12 KEY_KBDILLUMDOWN */ /* Use: XF86XK_KbdBrightnessUp _EVDEVK(0x0E6) v2.6.12 KEY_KBDILLUMUP */ /* Use: XF86XK_Send _EVDEVK(0x0E7) v2.6.14 KEY_SEND */ /* Use: XF86XK_Reply _EVDEVK(0x0E8) v2.6.14 KEY_REPLY */ /* Use: XF86XK_MailForward _EVDEVK(0x0E9) v2.6.14 KEY_FORWARDMAIL */ /* Use: XF86XK_Save _EVDEVK(0x0EA) v2.6.14 KEY_SAVE */ /* Use: XF86XK_Documents _EVDEVK(0x0EB) v2.6.14 KEY_DOCUMENTS */ /* Use: XF86XK_Battery _EVDEVK(0x0EC) v2.6.17 KEY_BATTERY */ /* Use: XF86XK_Bluetooth _EVDEVK(0x0ED) v2.6.19 KEY_BLUETOOTH */ /* Use: XF86XK_WLAN _EVDEVK(0x0EE) v2.6.19 KEY_WLAN */ /* Use: XF86XK_UWB _EVDEVK(0x0EF) v2.6.24 KEY_UWB */ /* Use: XF86XK_Next_VMode _EVDEVK(0x0F1) v2.6.23 KEY_VIDEO_NEXT */ /* Use: XF86XK_Prev_VMode _EVDEVK(0x0F2) v2.6.23 KEY_VIDEO_PREV */ /* Use: XF86XK_MonBrightnessCycle _EVDEVK(0x0F3) v2.6.23 KEY_BRIGHTNESS_CYCLE */ #define XF86XK_BrightnessAuto _EVDEVK(0x0F4) /* v3.16 KEY_BRIGHTNESS_AUTO */ #define XF86XK_DisplayOff _EVDEVK(0x0F5) /* v2.6.23 KEY_DISPLAY_OFF */ /* Use: XF86XK_WWAN _EVDEVK(0x0F6) v3.13 KEY_WWAN */ /* Use: XF86XK_RFKill _EVDEVK(0x0F7) v2.6.33 KEY_RFKILL */ /* Use: XF86XK_AudioMicMute _EVDEVK(0x0F8) v3.1 KEY_MICMUTE */ #define XF86XK_Info _EVDEVK(0x166) /* KEY_INFO */ /* Use: XF86XK_CycleAngle _EVDEVK(0x173) KEY_ANGLE */ /* Use: XF86XK_FullScreen _EVDEVK(0x174) v5.1 KEY_FULL_SCREEN */ #define XF86XK_AspectRatio _EVDEVK(0x177) /* v5.1 KEY_ASPECT_RATIO */ #define XF86XK_DVD _EVDEVK(0x185) /* KEY_DVD */ #define XF86XK_Audio _EVDEVK(0x188) /* KEY_AUDIO */ /* Use: XF86XK_Video _EVDEVK(0x189) KEY_VIDEO */ /* Use: XF86XK_Calendar _EVDEVK(0x18D) KEY_CALENDAR */ #define XF86XK_ChannelUp _EVDEVK(0x192) /* KEY_CHANNELUP */ #define XF86XK_ChannelDown _EVDEVK(0x193) /* KEY_CHANNELDOWN */ /* Use: XF86XK_AudioRandomPlay _EVDEVK(0x19A) KEY_SHUFFLE */ #define XF86XK_Break _EVDEVK(0x19B) /* KEY_BREAK */ #define XF86XK_VideoPhone _EVDEVK(0x1A0) /* v2.6.20 KEY_VIDEOPHONE */ /* Use: XF86XK_Game _EVDEVK(0x1A1) v2.6.20 KEY_GAMES */ /* Use: XF86XK_ZoomIn _EVDEVK(0x1A2) v2.6.20 KEY_ZOOMIN */ /* Use: XF86XK_ZoomOut _EVDEVK(0x1A3) v2.6.20 KEY_ZOOMOUT */ #define XF86XK_ZoomReset _EVDEVK(0x1A4) /* v2.6.20 KEY_ZOOMRESET */ /* Use: XF86XK_Word _EVDEVK(0x1A5) v2.6.20 KEY_WORDPROCESSOR */ #define XF86XK_Editor _EVDEVK(0x1A6) /* v2.6.20 KEY_EDITOR */ /* Use: XF86XK_Excel _EVDEVK(0x1A7) v2.6.20 KEY_SPREADSHEET */ #define XF86XK_GraphicsEditor _EVDEVK(0x1A8) /* v2.6.20 KEY_GRAPHICSEDITOR */ #define XF86XK_Presentation _EVDEVK(0x1A9) /* v2.6.20 KEY_PRESENTATION */ #define XF86XK_Database _EVDEVK(0x1AA) /* v2.6.20 KEY_DATABASE */ /* Use: XF86XK_News _EVDEVK(0x1AB) v2.6.20 KEY_NEWS */ #define XF86XK_Voicemail _EVDEVK(0x1AC) /* v2.6.20 KEY_VOICEMAIL */ #define XF86XK_Addressbook _EVDEVK(0x1AD) /* v2.6.20 KEY_ADDRESSBOOK */ /* Use: XF86XK_Messenger _EVDEVK(0x1AE) v2.6.20 KEY_MESSENGER */ #define XF86XK_DisplayToggle _EVDEVK(0x1AF) /* v2.6.20 KEY_DISPLAYTOGGLE */ #define XF86XK_SpellCheck _EVDEVK(0x1B0) /* v2.6.24 KEY_SPELLCHECK */ /* Use: XF86XK_LogOff _EVDEVK(0x1B1) v2.6.24 KEY_LOGOFF */ /* Use: XK_dollar _EVDEVK(0x1B2) v2.6.24 KEY_DOLLAR */ /* Use: XK_EuroSign _EVDEVK(0x1B3) v2.6.24 KEY_EURO */ /* Use: XF86XK_FrameBack _EVDEVK(0x1B4) v2.6.24 KEY_FRAMEBACK */ /* Use: XF86XK_FrameForward _EVDEVK(0x1B5) v2.6.24 KEY_FRAMEFORWARD */ #define XF86XK_ContextMenu _EVDEVK(0x1B6) /* v2.6.24 KEY_CONTEXT_MENU */ #define XF86XK_MediaRepeat _EVDEVK(0x1B7) /* v2.6.26 KEY_MEDIA_REPEAT */ #define XF86XK_10ChannelsUp _EVDEVK(0x1B8) /* v2.6.38 KEY_10CHANNELSUP */ #define XF86XK_10ChannelsDown _EVDEVK(0x1B9) /* v2.6.38 KEY_10CHANNELSDOWN */ #define XF86XK_Images _EVDEVK(0x1BA) /* v2.6.39 KEY_IMAGES */ #define XF86XK_NotificationCenter _EVDEVK(0x1BC) /* v5.10 KEY_NOTIFICATION_CENTER */ #define XF86XK_PickupPhone _EVDEVK(0x1BD) /* v5.10 KEY_PICKUP_PHONE */ #define XF86XK_HangupPhone _EVDEVK(0x1BE) /* v5.10 KEY_HANGUP_PHONE */ #define XF86XK_Fn _EVDEVK(0x1D0) /* KEY_FN */ #define XF86XK_Fn_Esc _EVDEVK(0x1D1) /* KEY_FN_ESC */ #define XF86XK_FnRightShift _EVDEVK(0x1E5) /* v5.10 KEY_FN_RIGHT_SHIFT */ /* Use: XK_braille_dot_1 _EVDEVK(0x1F1) v2.6.17 KEY_BRL_DOT1 */ /* Use: XK_braille_dot_2 _EVDEVK(0x1F2) v2.6.17 KEY_BRL_DOT2 */ /* Use: XK_braille_dot_3 _EVDEVK(0x1F3) v2.6.17 KEY_BRL_DOT3 */ /* Use: XK_braille_dot_4 _EVDEVK(0x1F4) v2.6.17 KEY_BRL_DOT4 */ /* Use: XK_braille_dot_5 _EVDEVK(0x1F5) v2.6.17 KEY_BRL_DOT5 */ /* Use: XK_braille_dot_6 _EVDEVK(0x1F6) v2.6.17 KEY_BRL_DOT6 */ /* Use: XK_braille_dot_7 _EVDEVK(0x1F7) v2.6.17 KEY_BRL_DOT7 */ /* Use: XK_braille_dot_8 _EVDEVK(0x1F8) v2.6.17 KEY_BRL_DOT8 */ /* Use: XK_braille_dot_9 _EVDEVK(0x1F9) v2.6.23 KEY_BRL_DOT9 */ /* Use: XK_braille_dot_1 _EVDEVK(0x1FA) v2.6.23 KEY_BRL_DOT10 */ #define XF86XK_Numeric0 _EVDEVK(0x200) /* v2.6.28 KEY_NUMERIC_0 */ #define XF86XK_Numeric1 _EVDEVK(0x201) /* v2.6.28 KEY_NUMERIC_1 */ #define XF86XK_Numeric2 _EVDEVK(0x202) /* v2.6.28 KEY_NUMERIC_2 */ #define XF86XK_Numeric3 _EVDEVK(0x203) /* v2.6.28 KEY_NUMERIC_3 */ #define XF86XK_Numeric4 _EVDEVK(0x204) /* v2.6.28 KEY_NUMERIC_4 */ #define XF86XK_Numeric5 _EVDEVK(0x205) /* v2.6.28 KEY_NUMERIC_5 */ #define XF86XK_Numeric6 _EVDEVK(0x206) /* v2.6.28 KEY_NUMERIC_6 */ #define XF86XK_Numeric7 _EVDEVK(0x207) /* v2.6.28 KEY_NUMERIC_7 */ #define XF86XK_Numeric8 _EVDEVK(0x208) /* v2.6.28 KEY_NUMERIC_8 */ #define XF86XK_Numeric9 _EVDEVK(0x209) /* v2.6.28 KEY_NUMERIC_9 */ #define XF86XK_NumericStar _EVDEVK(0x20A) /* v2.6.28 KEY_NUMERIC_STAR */ #define XF86XK_NumericPound _EVDEVK(0x20B) /* v2.6.28 KEY_NUMERIC_POUND */ #define XF86XK_NumericA _EVDEVK(0x20C) /* v4.1 KEY_NUMERIC_A */ #define XF86XK_NumericB _EVDEVK(0x20D) /* v4.1 KEY_NUMERIC_B */ #define XF86XK_NumericC _EVDEVK(0x20E) /* v4.1 KEY_NUMERIC_C */ #define XF86XK_NumericD _EVDEVK(0x20F) /* v4.1 KEY_NUMERIC_D */ #define XF86XK_CameraFocus _EVDEVK(0x210) /* v2.6.33 KEY_CAMERA_FOCUS */ #define XF86XK_WPSButton _EVDEVK(0x211) /* v2.6.34 KEY_WPS_BUTTON */ /* Use: XF86XK_TouchpadToggle _EVDEVK(0x212) v2.6.37 KEY_TOUCHPAD_TOGGLE */ /* Use: XF86XK_TouchpadOn _EVDEVK(0x213) v2.6.37 KEY_TOUCHPAD_ON */ /* Use: XF86XK_TouchpadOff _EVDEVK(0x214) v2.6.37 KEY_TOUCHPAD_OFF */ #define XF86XK_CameraZoomIn _EVDEVK(0x215) /* v2.6.39 KEY_CAMERA_ZOOMIN */ #define XF86XK_CameraZoomOut _EVDEVK(0x216) /* v2.6.39 KEY_CAMERA_ZOOMOUT */ #define XF86XK_CameraUp _EVDEVK(0x217) /* v2.6.39 KEY_CAMERA_UP */ #define XF86XK_CameraDown _EVDEVK(0x218) /* v2.6.39 KEY_CAMERA_DOWN */ #define XF86XK_CameraLeft _EVDEVK(0x219) /* v2.6.39 KEY_CAMERA_LEFT */ #define XF86XK_CameraRight _EVDEVK(0x21A) /* v2.6.39 KEY_CAMERA_RIGHT */ #define XF86XK_AttendantOn _EVDEVK(0x21B) /* v3.10 KEY_ATTENDANT_ON */ #define XF86XK_AttendantOff _EVDEVK(0x21C) /* v3.10 KEY_ATTENDANT_OFF */ #define XF86XK_AttendantToggle _EVDEVK(0x21D) /* v3.10 KEY_ATTENDANT_TOGGLE */ #define XF86XK_LightsToggle _EVDEVK(0x21E) /* v3.10 KEY_LIGHTS_TOGGLE */ #define XF86XK_ALSToggle _EVDEVK(0x230) /* v3.13 KEY_ALS_TOGGLE */ /* Use: XF86XK_RotationLockToggle _EVDEVK(0x231) v4.16 KEY_ROTATE_LOCK_TOGGLE */ #define XF86XK_Buttonconfig _EVDEVK(0x240) /* v3.16 KEY_BUTTONCONFIG */ #define XF86XK_Taskmanager _EVDEVK(0x241) /* v3.16 KEY_TASKMANAGER */ #define XF86XK_Journal _EVDEVK(0x242) /* v3.16 KEY_JOURNAL */ #define XF86XK_ControlPanel _EVDEVK(0x243) /* v3.16 KEY_CONTROLPANEL */ #define XF86XK_AppSelect _EVDEVK(0x244) /* v3.16 KEY_APPSELECT */ #define XF86XK_Screensaver _EVDEVK(0x245) /* v3.16 KEY_SCREENSAVER */ #define XF86XK_VoiceCommand _EVDEVK(0x246) /* v3.16 KEY_VOICECOMMAND */ #define XF86XK_Assistant _EVDEVK(0x247) /* v4.13 KEY_ASSISTANT */ /* Use: XK_ISO_Next_Group _EVDEVK(0x248) v5.2 KEY_KBD_LAYOUT_NEXT */ #define XF86XK_EmojiPicker _EVDEVK(0x249) /* v5.13 KEY_EMOJI_PICKER */ #define XF86XK_Dictate _EVDEVK(0x24A) /* v5.17 KEY_DICTATE */ #define XF86XK_BrightnessMin _EVDEVK(0x250) /* v3.16 KEY_BRIGHTNESS_MIN */ #define XF86XK_BrightnessMax _EVDEVK(0x251) /* v3.16 KEY_BRIGHTNESS_MAX */ #define XF86XK_KbdInputAssistPrev _EVDEVK(0x260) /* v3.18 KEY_KBDINPUTASSIST_PREV */ #define XF86XK_KbdInputAssistNext _EVDEVK(0x261) /* v3.18 KEY_KBDINPUTASSIST_NEXT */ #define XF86XK_KbdInputAssistPrevgroup _EVDEVK(0x262) /* v3.18 KEY_KBDINPUTASSIST_PREVGROUP */ #define XF86XK_KbdInputAssistNextgroup _EVDEVK(0x263) /* v3.18 KEY_KBDINPUTASSIST_NEXTGROUP */ #define XF86XK_KbdInputAssistAccept _EVDEVK(0x264) /* v3.18 KEY_KBDINPUTASSIST_ACCEPT */ #define XF86XK_KbdInputAssistCancel _EVDEVK(0x265) /* v3.18 KEY_KBDINPUTASSIST_CANCEL */ #define XF86XK_RightUp _EVDEVK(0x266) /* v4.7 KEY_RIGHT_UP */ #define XF86XK_RightDown _EVDEVK(0x267) /* v4.7 KEY_RIGHT_DOWN */ #define XF86XK_LeftUp _EVDEVK(0x268) /* v4.7 KEY_LEFT_UP */ #define XF86XK_LeftDown _EVDEVK(0x269) /* v4.7 KEY_LEFT_DOWN */ #define XF86XK_RootMenu _EVDEVK(0x26A) /* v4.7 KEY_ROOT_MENU */ #define XF86XK_MediaTopMenu _EVDEVK(0x26B) /* v4.7 KEY_MEDIA_TOP_MENU */ #define XF86XK_Numeric11 _EVDEVK(0x26C) /* v4.7 KEY_NUMERIC_11 */ #define XF86XK_Numeric12 _EVDEVK(0x26D) /* v4.7 KEY_NUMERIC_12 */ #define XF86XK_AudioDesc _EVDEVK(0x26E) /* v4.7 KEY_AUDIO_DESC */ #define XF86XK_3DMode _EVDEVK(0x26F) /* v4.7 KEY_3D_MODE */ #define XF86XK_NextFavorite _EVDEVK(0x270) /* v4.7 KEY_NEXT_FAVORITE */ #define XF86XK_StopRecord _EVDEVK(0x271) /* v4.7 KEY_STOP_RECORD */ #define XF86XK_PauseRecord _EVDEVK(0x272) /* v4.7 KEY_PAUSE_RECORD */ #define XF86XK_VOD _EVDEVK(0x273) /* v4.7 KEY_VOD */ #define XF86XK_Unmute _EVDEVK(0x274) /* v4.7 KEY_UNMUTE */ #define XF86XK_FastReverse _EVDEVK(0x275) /* v4.7 KEY_FASTREVERSE */ #define XF86XK_SlowReverse _EVDEVK(0x276) /* v4.7 KEY_SLOWREVERSE */ #define XF86XK_Data _EVDEVK(0x277) /* v4.7 KEY_DATA */ #define XF86XK_OnScreenKeyboard _EVDEVK(0x278) /* v4.12 KEY_ONSCREEN_KEYBOARD */ #define XF86XK_PrivacyScreenToggle _EVDEVK(0x279) /* v5.5 KEY_PRIVACY_SCREEN_TOGGLE */ #define XF86XK_SelectiveScreenshot _EVDEVK(0x27A) /* v5.6 KEY_SELECTIVE_SCREENSHOT */ #define XF86XK_Macro1 _EVDEVK(0x290) /* v5.5 KEY_MACRO1 */ #define XF86XK_Macro2 _EVDEVK(0x291) /* v5.5 KEY_MACRO2 */ #define XF86XK_Macro3 _EVDEVK(0x292) /* v5.5 KEY_MACRO3 */ #define XF86XK_Macro4 _EVDEVK(0x293) /* v5.5 KEY_MACRO4 */ #define XF86XK_Macro5 _EVDEVK(0x294) /* v5.5 KEY_MACRO5 */ #define XF86XK_Macro6 _EVDEVK(0x295) /* v5.5 KEY_MACRO6 */ #define XF86XK_Macro7 _EVDEVK(0x296) /* v5.5 KEY_MACRO7 */ #define XF86XK_Macro8 _EVDEVK(0x297) /* v5.5 KEY_MACRO8 */ #define XF86XK_Macro9 _EVDEVK(0x298) /* v5.5 KEY_MACRO9 */ #define XF86XK_Macro10 _EVDEVK(0x299) /* v5.5 KEY_MACRO10 */ #define XF86XK_Macro11 _EVDEVK(0x29A) /* v5.5 KEY_MACRO11 */ #define XF86XK_Macro12 _EVDEVK(0x29B) /* v5.5 KEY_MACRO12 */ #define XF86XK_Macro13 _EVDEVK(0x29C) /* v5.5 KEY_MACRO13 */ #define XF86XK_Macro14 _EVDEVK(0x29D) /* v5.5 KEY_MACRO14 */ #define XF86XK_Macro15 _EVDEVK(0x29E) /* v5.5 KEY_MACRO15 */ #define XF86XK_Macro16 _EVDEVK(0x29F) /* v5.5 KEY_MACRO16 */ #define XF86XK_Macro17 _EVDEVK(0x2A0) /* v5.5 KEY_MACRO17 */ #define XF86XK_Macro18 _EVDEVK(0x2A1) /* v5.5 KEY_MACRO18 */ #define XF86XK_Macro19 _EVDEVK(0x2A2) /* v5.5 KEY_MACRO19 */ #define XF86XK_Macro20 _EVDEVK(0x2A3) /* v5.5 KEY_MACRO20 */ #define XF86XK_Macro21 _EVDEVK(0x2A4) /* v5.5 KEY_MACRO21 */ #define XF86XK_Macro22 _EVDEVK(0x2A5) /* v5.5 KEY_MACRO22 */ #define XF86XK_Macro23 _EVDEVK(0x2A6) /* v5.5 KEY_MACRO23 */ #define XF86XK_Macro24 _EVDEVK(0x2A7) /* v5.5 KEY_MACRO24 */ #define XF86XK_Macro25 _EVDEVK(0x2A8) /* v5.5 KEY_MACRO25 */ #define XF86XK_Macro26 _EVDEVK(0x2A9) /* v5.5 KEY_MACRO26 */ #define XF86XK_Macro27 _EVDEVK(0x2AA) /* v5.5 KEY_MACRO27 */ #define XF86XK_Macro28 _EVDEVK(0x2AB) /* v5.5 KEY_MACRO28 */ #define XF86XK_Macro29 _EVDEVK(0x2AC) /* v5.5 KEY_MACRO29 */ #define XF86XK_Macro30 _EVDEVK(0x2AD) /* v5.5 KEY_MACRO30 */ #define XF86XK_MacroRecordStart _EVDEVK(0x2B0) /* v5.5 KEY_MACRO_RECORD_START */ #define XF86XK_MacroRecordStop _EVDEVK(0x2B1) /* v5.5 KEY_MACRO_RECORD_STOP */ #define XF86XK_MacroPresetCycle _EVDEVK(0x2B2) /* v5.5 KEY_MACRO_PRESET_CYCLE */ #define XF86XK_MacroPreset1 _EVDEVK(0x2B3) /* v5.5 KEY_MACRO_PRESET1 */ #define XF86XK_MacroPreset2 _EVDEVK(0x2B4) /* v5.5 KEY_MACRO_PRESET2 */ #define XF86XK_MacroPreset3 _EVDEVK(0x2B5) /* v5.5 KEY_MACRO_PRESET3 */ #define XF86XK_KbdLcdMenu1 _EVDEVK(0x2B8) /* v5.5 KEY_KBD_LCD_MENU1 */ #define XF86XK_KbdLcdMenu2 _EVDEVK(0x2B9) /* v5.5 KEY_KBD_LCD_MENU2 */ #define XF86XK_KbdLcdMenu3 _EVDEVK(0x2BA) /* v5.5 KEY_KBD_LCD_MENU3 */ #define XF86XK_KbdLcdMenu4 _EVDEVK(0x2BB) /* v5.5 KEY_KBD_LCD_MENU4 */ #define XF86XK_KbdLcdMenu5 _EVDEVK(0x2BC) /* v5.5 KEY_KBD_LCD_MENU5 */ #undef _EVDEVK |
Changes to xlib/X11/Xfuncproto.h.
︙ | ︙ | |||
213 214 215 216 217 218 219 220 221 | /* requires xproto >= 7.0.30 */ #if __has_attribute(no_sanitize_thread) # define _X_NOTSAN __attribute__((no_sanitize_thread)) #else # define _X_NOTSAN #endif #endif /* _XFUNCPROTO_H_ */ | > > > > > > > > | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | /* requires xproto >= 7.0.30 */ #if __has_attribute(no_sanitize_thread) # define _X_NOTSAN __attribute__((no_sanitize_thread)) #else # define _X_NOTSAN #endif /* Mark a char array/pointer as not containing a NUL-terminated string */ /* requires xproto >= 7.0.33 */ #if __has_attribute(nonstring) # define _X_NONSTRING __attribute__((nonstring)) #else # define _X_NONSTRING #endif #endif /* _XFUNCPROTO_H_ */ |
Changes to xlib/X11/Xlib.h.
︙ | ︙ | |||
202 203 204 205 206 207 208 | unsigned long background;/* background pixel */ int line_width; /* line width */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ int fill_style; /* FillSolid, FillTiled, | | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | unsigned long background;/* background pixel */ int line_width; /* line width */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ int fill_style; /* FillSolid, FillTiled, FillStippled, FillOpaqueStippled */ int fill_rule; /* EvenOddRule, WindingRule */ int arc_mode; /* ArcChord, ArcPieSlice */ Pixmap tile; /* tile pixmap for tiling operations */ Pixmap stipple; /* stipple 1 plane pixmap for stippling */ int ts_x_origin; /* offset for tile or stipple operations */ int ts_y_origin; Font font; /* default text font for text operations */ int subwindow_mode; /* ClipByChildren, IncludeInferiors */ Bool graphics_exposures;/* boolean, should exposures be generated */ int clip_x_origin; /* origin for clipping */ int clip_y_origin; |
︙ | ︙ | |||
300 301 302 303 304 305 306 | Pixmap background_pixmap; /* background or None or ParentRelative */ unsigned long background_pixel; /* background pixel */ Pixmap border_pixmap; /* border of the window */ unsigned long border_pixel; /* border pixel value */ int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ | | | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | Pixmap background_pixmap; /* background or None or ParentRelative */ unsigned long background_pixel; /* background pixel */ Pixmap border_pixmap; /* border of the window */ unsigned long border_pixel; /* border pixel value */ int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes;/* planes to be preserved if possible */ unsigned long backing_pixel;/* value to use in restoring planes */ Bool save_under; /* should bits under be saved? (popups) */ long event_mask; /* set of events that should be saved */ long do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Colormap colormap; /* color map to be associated with window */ Cursor cursor; /* cursor to be displayed (or None) */ |
︙ | ︙ | |||
372 373 374 375 376 377 378 | int format; /* XYBitmap, XYPixmap, ZPixmap */ char *data; /* pointer to image data */ int byte_order; /* data byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* quant. of scanline 8, 16, 32 */ int bitmap_bit_order; /* LSBFirst, MSBFirst */ int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ int depth; /* depth of image */ | | | | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | int format; /* XYBitmap, XYPixmap, ZPixmap */ char *data; /* pointer to image data */ int byte_order; /* data byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* quant. of scanline 8, 16, 32 */ int bitmap_bit_order; /* LSBFirst, MSBFirst */ int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ int depth; /* depth of image */ int bytes_per_line; /* accelerator to next line */ int bits_per_pixel; /* bits per pixel (ZPixmap) */ unsigned long red_mask; /* bits in z arrangement */ unsigned long green_mask; unsigned long blue_mask; XPointer obdata; /* hook for the object routines to hang on */ struct funcs { /* image manipulation routines */ struct _XImage *(*create_image)( struct _XDisplay* /* display */, Visual* /* visual */, |
︙ | ︙ | |||
582 583 584 585 586 587 588 | } Display; #if NeedFunctionPrototypes /* prototypes require event type definitions */ #undef _XEVENT_ #endif #ifndef _XEVENT_ | < < | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | } Display; #if NeedFunctionPrototypes /* prototypes require event type definitions */ #undef _XEVENT_ #endif #ifndef _XEVENT_ /* * Definitions of specific events. */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ |
︙ | ︙ | |||
1716 1717 1718 1719 1720 1721 1722 | int* /* num_prop_return */ ); EXTERN XHostAddress *XListHosts( Display* /* display */, int* /* nhosts_return */, Bool* /* state_return */ ); | > | | 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 | int* /* num_prop_return */ ); EXTERN XHostAddress *XListHosts( Display* /* display */, int* /* nhosts_return */, Bool* /* state_return */ ); _X_DEPRECATED EXTERN KeySym XKeycodeToKeysym( Display* /* display */, #if NeedWidePrototypes unsigned int /* keycode */, #else KeyCode /* keycode */, #endif int /* index */ |
︙ | ︙ |
Changes to xlib/X11/ap_keysym.h.
︙ | ︙ | |||
9 10 11 12 13 14 15 | that the above copyright notice appear in such copy and that this copyright notice appear in all supporting documentation, and that the names of Apollo Computer Inc., the Hewlett-Packard Company, or the X Consortium not be used in advertising or publicity pertaining to distribution of the software without written prior permission. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | that the above copyright notice appear in such copy and that this copyright notice appear in all supporting documentation, and that the names of Apollo Computer Inc., the Hewlett-Packard Company, or the X Consortium not be used in advertising or publicity pertaining to distribution of the software without written prior permission. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFTWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. This software is not subject to any license of the American |
︙ | ︙ |
Changes to xlib/X11/keysymdef.h.
︙ | ︙ | |||
82 83 84 85 86 87 88 | * * Where several mnemonic names are defined for the same keysym in this * file, all but the first one listed should be considered deprecated. * * Mnemonic names for keysyms are defined in this file with lines * that match one of these Perl regular expressions: * | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | * * Where several mnemonic names are defined for the same keysym in this * file, all but the first one listed should be considered deprecated. * * Mnemonic names for keysyms are defined in this file with lines * that match one of these Perl regular expressions: * * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U\+([0-9A-F]{4,6}) (.*) \*\/\s*$/ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U\+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/ * * Before adding new keysyms, please do consider the following: In * addition to the keysym names defined in this file, the * XStringToKeysym() and XKeysymToString() functions will also handle * any keysym string of the form "U0020" to "U007E" and "U00A0" to * "U10FFFF" for all possible Unicode characters. In other words, |
︙ | ︙ | |||
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | #define XK_Prior 0xff55 /* Prior, previous */ #define XK_Page_Up 0xff55 #define XK_Next 0xff56 /* Next */ #define XK_Page_Down 0xff56 #define XK_End 0xff57 /* EOL */ #define XK_Begin 0xff58 /* BOL */ /* Special Windows keyboard keys */ #define XK_Win_L 0xFF5B /* Left-hand Windows */ #define XK_Win_R 0xFF5C /* Right-hand Windows */ #define XK_App 0xFF5D /* Menu key */ /* Misc functions */ #define XK_Select 0xff60 /* Select, mark */ #define XK_Print 0xff61 #define XK_Execute 0xff62 /* Execute, run, do */ #define XK_Insert 0xff63 /* Insert, insert here */ | > > > > | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | #define XK_Prior 0xff55 /* Prior, previous */ #define XK_Page_Up 0xff55 #define XK_Next 0xff56 /* Next */ #define XK_Page_Down 0xff56 #define XK_End 0xff57 /* EOL */ #define XK_Begin 0xff58 /* BOL */ #ifndef TK_NO_DEPRECATED /* Special Windows keyboard keys */ #define XK_Win_L 0xFF5B /* Left-hand Windows */ #define XK_Win_R 0xFF5C /* Right-hand Windows */ #define XK_App 0xFF5D /* Menu key */ #endif /* Misc functions */ #define XK_Select 0xff60 /* Select, mark */ #define XK_Print 0xff61 #define XK_Execute 0xff62 /* Execute, run, do */ #define XK_Insert 0xff63 /* Insert, insert here */ |
︙ | ︙ | |||
882 883 884 885 886 887 888 | #define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ #define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ #define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ #define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ #define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ #endif /* XK_LATIN4 */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | #define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ #define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ #define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ #define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ #define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ #endif /* XK_LATIN4 */ /* * Latin 9 * Byte 3 = 0x13 */ #ifdef XK_LATIN9 #define XK_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */ |
︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | /* * Arabic * Byte 3 = 5 */ #ifdef XK_ARABIC | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | /* * Arabic * Byte 3 = 5 */ #ifdef XK_ARABIC #define XK_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */ #define XK_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */ #define XK_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */ #define XK_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */ #define XK_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */ #define XK_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */ #define XK_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */ #define XK_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */ |
︙ | ︙ | |||
1086 1087 1088 1089 1090 1091 1092 | #define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */ #define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */ #define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */ #define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */ #define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */ #define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */ #define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | #define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */ #define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */ #define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */ #define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */ #define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */ #define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */ #define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */ #define XK_Arabic_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_ARABIC */ /* * Cyrillic * Byte 3 = 6 */ #ifdef XK_CYRILLIC #define XK_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */ #define XK_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */ #define XK_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */ #define XK_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */ #define XK_Ukranian_je 0x06a4 /* deprecated */ #define XK_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */ #define XK_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ |
︙ | ︙ | |||
1456 1457 1458 1459 1460 1461 1462 | #define XK_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */ #define XK_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */ #define XK_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */ #define XK_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */ #define XK_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */ #define XK_careof 0x0ab8 /* U+2105 CARE OF */ #define XK_figdash 0x0abb /* U+2012 FIGURE DASH */ | | | | 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | #define XK_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */ #define XK_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */ #define XK_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */ #define XK_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */ #define XK_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */ #define XK_careof 0x0ab8 /* U+2105 CARE OF */ #define XK_figdash 0x0abb /* U+2012 FIGURE DASH */ #define XK_leftanglebracket 0x0abc /*(U+2329 LEFT-POINTING ANGLE BRACKET)*/ #define XK_decimalpoint 0x0abd /*(U+002E FULL STOP)*/ #define XK_rightanglebracket 0x0abe /*(U+232A RIGHT-POINTING ANGLE BRACKET)*/ #define XK_marker 0x0abf #define XK_oneeighth 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */ #define XK_threeeighths 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */ #define XK_fiveeighths 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */ #define XK_seveneighths 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */ #define XK_trademark 0x0ac9 /* U+2122 TRADE MARK SIGN */ #define XK_signaturemark 0x0aca /*(U+2613 SALTIRE)*/ |
︙ | ︙ | |||
1711 1712 1713 1714 1715 1716 1717 | #define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */ #define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ #define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ #define XK_Hangul_Special 0xff3f /* Special symbols */ #define XK_Hangul_switch 0xff7e /* Alias for mode_switch */ /* Hangul Consonant Characters */ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 | #define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */ #define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ #define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ #define XK_Hangul_Special 0xff3f /* Special symbols */ #define XK_Hangul_switch 0xff7e /* Alias for mode_switch */ /* Hangul Consonant Characters */ #define XK_Hangul_Kiyeog 0x0ea1 /* U+3131 HANGUL LETTER KIYEOK */ #define XK_Hangul_SsangKiyeog 0x0ea2 /* U+3132 HANGUL LETTER SSANGKIYEOK */ #define XK_Hangul_KiyeogSios 0x0ea3 /* U+3133 HANGUL LETTER KIYEOK-SIOS */ #define XK_Hangul_Nieun 0x0ea4 /* U+3134 HANGUL LETTER NIEUN */ #define XK_Hangul_NieunJieuj 0x0ea5 /* U+3135 HANGUL LETTER NIEUN-CIEUC */ #define XK_Hangul_NieunHieuh 0x0ea6 /* U+3136 HANGUL LETTER NIEUN-HIEUH */ #define XK_Hangul_Dikeud 0x0ea7 /* U+3137 HANGUL LETTER TIKEUT */ #define XK_Hangul_SsangDikeud 0x0ea8 /* U+3138 HANGUL LETTER SSANGTIKEUT */ #define XK_Hangul_Rieul 0x0ea9 /* U+3139 HANGUL LETTER RIEUL */ #define XK_Hangul_RieulKiyeog 0x0eaa /* U+313A HANGUL LETTER RIEUL-KIYEOK */ #define XK_Hangul_RieulMieum 0x0eab /* U+313B HANGUL LETTER RIEUL-MIEUM */ #define XK_Hangul_RieulPieub 0x0eac /* U+313C HANGUL LETTER RIEUL-PIEUP */ #define XK_Hangul_RieulSios 0x0ead /* U+313D HANGUL LETTER RIEUL-SIOS */ #define XK_Hangul_RieulTieut 0x0eae /* U+313E HANGUL LETTER RIEUL-THIEUTH */ #define XK_Hangul_RieulPhieuf 0x0eaf /* U+313F HANGUL LETTER RIEUL-PHIEUPH */ #define XK_Hangul_RieulHieuh 0x0eb0 /* U+3140 HANGUL LETTER RIEUL-HIEUH */ #define XK_Hangul_Mieum 0x0eb1 /* U+3141 HANGUL LETTER MIEUM */ #define XK_Hangul_Pieub 0x0eb2 /* U+3142 HANGUL LETTER PIEUP */ #define XK_Hangul_SsangPieub 0x0eb3 /* U+3143 HANGUL LETTER SSANGPIEUP */ #define XK_Hangul_PieubSios 0x0eb4 /* U+3144 HANGUL LETTER PIEUP-SIOS */ #define XK_Hangul_Sios 0x0eb5 /* U+3145 HANGUL LETTER SIOS */ #define XK_Hangul_SsangSios 0x0eb6 /* U+3146 HANGUL LETTER SSANGSIOS */ #define XK_Hangul_Ieung 0x0eb7 /* U+3147 HANGUL LETTER IEUNG */ #define XK_Hangul_Jieuj 0x0eb8 /* U+3148 HANGUL LETTER CIEUC */ #define XK_Hangul_SsangJieuj 0x0eb9 /* U+3149 HANGUL LETTER SSANGCIEUC */ #define XK_Hangul_Cieuc 0x0eba /* U+314A HANGUL LETTER CHIEUCH */ #define XK_Hangul_Khieuq 0x0ebb /* U+314B HANGUL LETTER KHIEUKH */ #define XK_Hangul_Tieut 0x0ebc /* U+314C HANGUL LETTER THIEUTH */ #define XK_Hangul_Phieuf 0x0ebd /* U+314D HANGUL LETTER PHIEUPH */ #define XK_Hangul_Hieuh 0x0ebe /* U+314E HANGUL LETTER HIEUH */ /* Hangul Vowel Characters */ #define XK_Hangul_A 0x0ebf /* U+314F HANGUL LETTER A */ #define XK_Hangul_AE 0x0ec0 /* U+3150 HANGUL LETTER AE */ #define XK_Hangul_YA 0x0ec1 /* U+3151 HANGUL LETTER YA */ #define XK_Hangul_YAE 0x0ec2 /* U+3152 HANGUL LETTER YAE */ #define XK_Hangul_EO 0x0ec3 /* U+3153 HANGUL LETTER EO */ #define XK_Hangul_E 0x0ec4 /* U+3154 HANGUL LETTER E */ #define XK_Hangul_YEO 0x0ec5 /* U+3155 HANGUL LETTER YEO */ #define XK_Hangul_YE 0x0ec6 /* U+3156 HANGUL LETTER YE */ #define XK_Hangul_O 0x0ec7 /* U+3157 HANGUL LETTER O */ #define XK_Hangul_WA 0x0ec8 /* U+3158 HANGUL LETTER WA */ #define XK_Hangul_WAE 0x0ec9 /* U+3159 HANGUL LETTER WAE */ #define XK_Hangul_OE 0x0eca /* U+315A HANGUL LETTER OE */ #define XK_Hangul_YO 0x0ecb /* U+315B HANGUL LETTER YO */ #define XK_Hangul_U 0x0ecc /* U+315C HANGUL LETTER U */ #define XK_Hangul_WEO 0x0ecd /* U+315D HANGUL LETTER WEO */ #define XK_Hangul_WE 0x0ece /* U+315E HANGUL LETTER WE */ #define XK_Hangul_WI 0x0ecf /* U+315F HANGUL LETTER WI */ #define XK_Hangul_YU 0x0ed0 /* U+3160 HANGUL LETTER YU */ #define XK_Hangul_EU 0x0ed1 /* U+3161 HANGUL LETTER EU */ #define XK_Hangul_YI 0x0ed2 /* U+3162 HANGUL LETTER YI */ #define XK_Hangul_I 0x0ed3 /* U+3163 HANGUL LETTER I */ /* Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_Kiyeog 0x0ed4 /* U+11A8 HANGUL JONGSEONG KIYEOK */ #define XK_Hangul_J_SsangKiyeog 0x0ed5 /* U+11A9 HANGUL JONGSEONG SSANGKIYEOK */ #define XK_Hangul_J_KiyeogSios 0x0ed6 /* U+11AA HANGUL JONGSEONG KIYEOK-SIOS */ #define XK_Hangul_J_Nieun 0x0ed7 /* U+11AB HANGUL JONGSEONG NIEUN */ #define XK_Hangul_J_NieunJieuj 0x0ed8 /* U+11AC HANGUL JONGSEONG NIEUN-CIEUC */ #define XK_Hangul_J_NieunHieuh 0x0ed9 /* U+11AD HANGUL JONGSEONG NIEUN-HIEUH */ #define XK_Hangul_J_Dikeud 0x0eda /* U+11AE HANGUL JONGSEONG TIKEUT */ #define XK_Hangul_J_Rieul 0x0edb /* U+11AF HANGUL JONGSEONG RIEUL */ #define XK_Hangul_J_RieulKiyeog 0x0edc /* U+11B0 HANGUL JONGSEONG RIEUL-KIYEOK */ #define XK_Hangul_J_RieulMieum 0x0edd /* U+11B1 HANGUL JONGSEONG RIEUL-MIEUM */ #define XK_Hangul_J_RieulPieub 0x0ede /* U+11B2 HANGUL JONGSEONG RIEUL-PIEUP */ #define XK_Hangul_J_RieulSios 0x0edf /* U+11B3 HANGUL JONGSEONG RIEUL-SIOS */ #define XK_Hangul_J_RieulTieut 0x0ee0 /* U+11B4 HANGUL JONGSEONG RIEUL-THIEUTH */ #define XK_Hangul_J_RieulPhieuf 0x0ee1 /* U+11B5 HANGUL JONGSEONG RIEUL-PHIEUPH */ #define XK_Hangul_J_RieulHieuh 0x0ee2 /* U+11B6 HANGUL JONGSEONG RIEUL-HIEUH */ #define XK_Hangul_J_Mieum 0x0ee3 /* U+11B7 HANGUL JONGSEONG MIEUM */ #define XK_Hangul_J_Pieub 0x0ee4 /* U+11B8 HANGUL JONGSEONG PIEUP */ #define XK_Hangul_J_PieubSios 0x0ee5 /* U+11B9 HANGUL JONGSEONG PIEUP-SIOS */ #define XK_Hangul_J_Sios 0x0ee6 /* U+11BA HANGUL JONGSEONG SIOS */ #define XK_Hangul_J_SsangSios 0x0ee7 /* U+11BB HANGUL JONGSEONG SSANGSIOS */ #define XK_Hangul_J_Ieung 0x0ee8 /* U+11BC HANGUL JONGSEONG IEUNG */ #define XK_Hangul_J_Jieuj 0x0ee9 /* U+11BD HANGUL JONGSEONG CIEUC */ #define XK_Hangul_J_Cieuc 0x0eea /* U+11BE HANGUL JONGSEONG CHIEUCH */ #define XK_Hangul_J_Khieuq 0x0eeb /* U+11BF HANGUL JONGSEONG KHIEUKH */ #define XK_Hangul_J_Tieut 0x0eec /* U+11C0 HANGUL JONGSEONG THIEUTH */ #define XK_Hangul_J_Phieuf 0x0eed /* U+11C1 HANGUL JONGSEONG PHIEUPH */ #define XK_Hangul_J_Hieuh 0x0eee /* U+11C2 HANGUL JONGSEONG HIEUH */ /* Ancient Hangul Consonant Characters */ #define XK_Hangul_RieulYeorinHieuh 0x0eef /* U+316D HANGUL LETTER RIEUL-YEORINHIEUH */ #define XK_Hangul_SunkyeongeumMieum 0x0ef0 /* U+3171 HANGUL LETTER KAPYEOUNMIEUM */ #define XK_Hangul_SunkyeongeumPieub 0x0ef1 /* U+3178 HANGUL LETTER KAPYEOUNPIEUP */ #define XK_Hangul_PanSios 0x0ef2 /* U+317F HANGUL LETTER PANSIOS */ #define XK_Hangul_KkogjiDalrinIeung 0x0ef3 /* U+3181 HANGUL LETTER YESIEUNG */ #define XK_Hangul_SunkyeongeumPhieuf 0x0ef4 /* U+3184 HANGUL LETTER KAPYEOUNPHIEUPH */ #define XK_Hangul_YeorinHieuh 0x0ef5 /* U+3186 HANGUL LETTER YEORINHIEUH */ /* Ancient Hangul Vowel Characters */ #define XK_Hangul_AraeA 0x0ef6 /* U+318D HANGUL LETTER ARAEA */ #define XK_Hangul_AraeAE 0x0ef7 /* U+318E HANGUL LETTER ARAEAE */ /* Ancient Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_PanSios 0x0ef8 /* U+11EB HANGUL JONGSEONG PANSIOS */ #define XK_Hangul_J_KkogjiDalrinIeung 0x0ef9 /* U+11F0 HANGUL JONGSEONG YESIEUNG */ #define XK_Hangul_J_YeorinHieuh 0x0efa /* U+11F9 HANGUL JONGSEONG YEORINHIEUH */ /* Korean currency symbol */ #define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/ #endif /* XK_KOREAN */ #ifdef XK_CURRENCY #define XK_EuroSign 0x20ac /* U+20AC EURO SIGN */ #endif /* XK_CURRENCY */ #ifdef XK_BRAILLE #define XK_braille_dot_1 0xfff1 #define XK_braille_dot_2 0xfff2 #define XK_braille_dot_3 0xfff3 #define XK_braille_dot_4 0xfff4 #define XK_braille_dot_5 0xfff5 #define XK_braille_dot_6 0xfff6 #define XK_braille_dot_7 0xfff7 #define XK_braille_dot_8 0xfff8 #define XK_braille_dot_9 0xfff9 #define XK_braille_dot_10 0xfffa #endif /* XK_BRAILLE */ /* Multimedia keys, defined same as on Linux * /usr/include/pkg/libxkbcommon/xkbcommon/xkbcommon-keysyms.h */ #ifndef TK_NO_DEPRECATED #define XK_XF86AudioLowerVolume 0x1008FF11 /* Volume control down */ #define XK_XF86AudioMute 0x1008FF12 /* Mute sound from the system */ |
︙ | ︙ |
Changes to xlib/xcolors.c.
1 2 3 4 5 6 | /* * xcolors.c -- * * This file contains the routines used to map from X color names to RGB * and pixel values. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * xcolors.c -- * * This file contains the routines used to map from X color names to RGB * and pixel values. * * Copyright (c) 1996 Sun Microsystems, Inc. * Copyright (c) 2012 Jan Nijtmans * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" |
︙ | ︙ |
Changes to xlib/xgc.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright 2008-2009, Apple Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" | < < | < < | < < < < < < < | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * Copyright 2008-2009, Apple Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include <X11/Xlib.h> #if defined(MAC_OSX_TK) #endif #define MAX_DASH_LIST_SIZE 10 typedef struct { XGCValues gc; char dash[MAX_DASH_LIST_SIZE]; } XGCValuesWithDash; /* *---------------------------------------------------------------------- * * AllocClipMask -- * * Static helper proc to allocate new or clear existing TkpClipMask. |
︙ | ︙ | |||
113 114 115 116 117 118 119 | /* * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars * are defined, which is invisible from the outside. The list is assumed * to end with a 0-char, so this must be set explicitly during * initialization. */ | | < < < | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | /* * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars * are defined, which is invisible from the outside. The list is assumed * to end with a 0-char, so this must be set explicitly during * initialization. */ gp = (GC)ckalloc(sizeof(XGCValuesWithDash)); #define InitField(name,maskbit,default) \ (gp->name = (mask & (maskbit)) ? values->name : (default)) InitField(function, GCFunction, GXcopy); InitField(plane_mask, GCPlaneMask, (unsigned long)(~0)); InitField(foreground, GCForeground, BlackPixelOfScreen(DefaultScreenOfDisplay(display))); InitField(background, GCBackground, WhitePixelOfScreen(DefaultScreenOfDisplay(display))); InitField(line_width, GCLineWidth, 1); InitField(line_style, GCLineStyle, LineSolid); InitField(cap_style, GCCapStyle, 0); InitField(join_style, GCJoinStyle, 0); InitField(fill_style, GCFillStyle, FillSolid); InitField(fill_rule, GCFillRule, EvenOddRule); InitField(arc_mode, GCArcMode, ArcPieSlice); InitField(tile, GCTile, 0); InitField(stipple, GCStipple, 0); InitField(ts_x_origin, GCTileStipXOrigin, 0); InitField(ts_y_origin, GCTileStipYOrigin, 0); InitField(font, GCFont, 0); InitField(subwindow_mode, GCSubwindowMode, ClipByChildren); |
︙ | ︙ | |||
154 155 156 157 158 159 160 | gp->clip_mask = None; if (mask & GCClipMask) { TkpClipMask *clip_mask = AllocClipMask(gp); clip_mask->type = TKP_CLIP_PIXMAP; clip_mask->value.pixmap = values->clip_mask; } | < < < < < < < < < < < < < < < < < < < < < < < | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | gp->clip_mask = None; if (mask & GCClipMask) { TkpClipMask *clip_mask = AllocClipMask(gp); clip_mask->type = TKP_CLIP_PIXMAP; clip_mask->value.pixmap = values->clip_mask; } return gp; } /* *---------------------------------------------------------------------- * * XChangeGC -- * * Changes the GC components specified by valuemask for the specified GC. * |
︙ | ︙ | |||
261 262 263 264 265 266 267 | Display *d, GC gc) { (void)d; if (gc != NULL) { FreeClipMask(gc); | < | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | Display *d, GC gc) { (void)d; if (gc != NULL) { FreeClipMask(gc); ckfree(gc); } return Success; } /* *---------------------------------------------------------------------- |
︙ | ︙ |
Changes to xlib/ximage.c.
︙ | ︙ | |||
47 48 49 50 51 52 53 | pix = Tk_GetPixmap(display, d, (int) width, (int) height, 1); gc = XCreateGC(display, pix, 0, NULL); if (gc == NULL) { return None; } ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width, height, 8, (width + 7) / 8); | > | | | | | > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | pix = Tk_GetPixmap(display, d, (int) width, (int) height, 1); gc = XCreateGC(display, pix, 0, NULL); if (gc == NULL) { return None; } ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width, height, 8, (width + 7) / 8); if (ximage) { ximage->bitmap_bit_order = LSBFirst; _XInitImageFuncPtrs(ximage); TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height); ximage->data = NULL; XDestroyImage(ximage); } XFreeGC(display, gc); return pix; } /* * Local Variables: * mode: c |
︙ | ︙ |